#ifndef QUEUE_H
#define QUEUE_H

#include <string>
#include <iostream>


class Hikkey{
private:
    std::string name;
public:
    virtual void fuck() = 0;
};

class AttentionWhore : public Hikkey{
private:
    std::string name;
public:
    AttentionWhore(std::string pogonyalo){ name = pogonyalo; }
    virtual void fuck(){
        std::cout << name << " vieban i obossan" << std::endl;
    }
    void porvatsya(){ std::cout << name << " porvalsya" << std::endl; }
};



template<class T>
class NodeQueue
{
public:
        NodeQueue():head(0), tail(0){}

        ~NodeQueue()
        {
             while(head)
             {
                 tail=head->next;
                 delete head;
                 head=tail;
             }
        }

        void enqueue(T val)
        {
                Node* Temp=new Node;
                Temp->elem=val;
                if(head==0)
                {
                        head=Temp;
                        tail=Temp;
                        return;
                }
                tail->next=Temp;
                tail=Temp;
        }

        void nahooy()
        {
                if (empty())
                {
                        throw std::string("Queue is empty");
                }
                Node* delPtr=head;
                head=head->next;
                delete delPtr;
        }

        const T& front() const
        {
                if (empty())
                {
                        throw std::string("Queue is empty");
                }
                return head->elem;
        }

        void print() const
        {
                if (empty())
                {
                        throw std::string("Queue is empty");
                }
                for(Node* ptr=head; ptr!=0; ptr=ptr->next)
                        std::cout<<ptr->elem<<' ';
                std::cout<<'\n';
        }

        bool empty() const
        {
                return head==0;
        }
private:
        struct Node
        {
                Node():next(0), elem(0)
                {
                }
                Node* next;
                T elem;
        };
        Node* head;
        Node* tail;
};

#endif // QUEUE_H

int main()
{

    std::string whores[] = {"Madina", "Ponos", "Yakooy", "ID25", "Kotomi", "Smith", "Console", "Rugged", "Ba4mo", "Tolyan", "Elsa", "Stoocka", "Chaos", "Barebuh", "Sento"};
    NodeQueue<AttentionWhore*> mrazy;

    for(int i = 0; i < 15; i++)
        mrazy.enqueue(new AttentionWhore(whores[i]));
    for(int i = 0; i < 15; i++){
        mrazy.front()->fuck();
        mrazy.front()->porvatsya();
        mrazy.nahooy();
        std::cout << std::endl;
    }
    return 0;
}