class Stack<T>{
	
	private Stack(){};
	
	final int pi=17;
	
	Node<T> theStack=null;
	
	boolean isEmpty(){return theStack==null;}

	T top() throws StackException{
		if(isEmpty()) throw new StackException("top-operation on empty Stack");
		else return theStack.content;
	}
	
	void pop() throws StackException{
		if(isEmpty()) throw new StackException("pop operation on empty stack");
		else theStack=theStack.next;
	}	
	
	void push(T elt){
		Node<T> nd = new Node<T>(elt,theStack);
		theStack=nd;
	}
	
	
	class Node<T>{
		T 		content;
		Node<T> next;
		
		Node(T content, Node<T> next){
			this.content=content;
			this.next=next;
		}	
		
	}
	
	}
	

	
