#include <iostream.h>


class LinkedList
{
	friend ostream& operator<< (ostream& out, LinkedList& t1);

public:

	LinkedList(int a);
	~LinkedList();
	void insert (int a);
	void append (int a);
	bool contains(int a);
	void display(ostream&);
	int return_and_remove_last();
	LinkedList* next;

private:
	int value;


};

class Stack
{
	// This stack is implemented as a linked list
	// with the top element being the last element in
	// the list (note it would be more efficient to 
	// make the top element the first element in the stack)

	friend ostream& operator<< (ostream& out, Stack& t1);

public:

	Stack();
	Stack(int a);
	~Stack();
	void push (int a);
	int pop ();
	bool empty();


private:
	LinkedList *elements;


};