module main;

import std.stdio;

int main(string[] argv)
{
   writefln("Execution began...!");
  
   
	 Stack! (int) myStack;
	 myStack.push(2);
	 readln;
	
	
   int count=0;
	while(!myStack.isFull()){
		
		myStack.push(count);
		count+=20;
		}
	
	while(!myStack.isEmpty()){
		writefln("%d",myStack.pop());
		}
	
	readln;
	
   return 0;
   
   }


  class Stack(T){
	
	private int maxSize;	//size of the stack
	private T[] stackArray;
	private int top;		//top of the stack
	
	
	//Constructor
	this(int size){
		
		maxSize=size;
		stackArray=new int[maxSize];
		top=-1;				//indicates that no items are in the stack
		
		}
	
	//Push items to the stack
	public void push(T element){
		
		 stackArray[++top]=element;
		
		}
	
	//Take an item from the stack
	public T pop(){
		return stackArray[top--];
		}
	
	//Peek at the stack top
	public T peek(){
		return stackArray[top];
		}
	
	//Checks whether the stack is empty
	public bool isEmpty(){
		if(top==-1){
			return true;
			}
		else{
			return false;
			}
		}
	
	//Checks whether the stack is full
	public bool isFull(){
		if(top==maxSize-1){
			return true;
			}
		else{
			return false;
			}
		}
	
	}
	
