#include <iostream>
using namespace std;


class Node {
	public:
         int value;
         Node* next;

         Node(int a) {
        	value = a;
            next = nullptr;
         }
};


class ForwardList {
	public:
		Node* head;
		Node* tail; // последний элемент
		
		ForwardList() {
			head = nullptr;
			tail = nullptr;
		}
		
		void push_front(int value) {
			Node* node = new Node(value);
			node->next = head;
			
			head = node;
			
			if (tail == nullptr) {
				tail = node;
			}
		}
		
		void push_back(int value) {
			Node* node = new Node(value);
			
			if (head == nullptr) {
				head = node;
			}
			
			if (tail != nullptr) {
				tail->next = node;
			}
			
			tail = node;
			
		}
};


int main() {
	ForwardList my_list;
	my_list.push_front(2);
	my_list.push_front(1);
	my_list.push_back(3);
	
	cout << my_list.head->value << ", " << my_list.head->next->value << ", " << my_list.tail->value;
	
}