//import java.util.HashMap;
//import java.util.Iterator;
//import java.util.Scanner;
//import java.util.Set;
//
//public class Main{
//
// public static void main(String[] args) {
//
// HashMap<String,String> a = new HashMap<String, String>();
//
// a.put("일본","도쿄");
//
// a.put("그리스","아테네");
//
// a.put("독일","베를린");
//
// a.put("멕시코","멕시코시티");
//
// a.put("영국","런던");
//
// a.put("중국","베이징");
//
// a.put("미국","워싱턴");
//
// a.put("캐나다","몬트리올");
//
// a.put("인도","뉴델리");
//
// Scanner in = new Scanner(System.in);
//
// System.out.println("** 수도 맞추기 게임을 시작합니다. **");
//
// while(true)
//
// {
//
//
//
// System.out.print("입력:1, 퀴즈:2, 종료:3>>");
//
// int b = in.nextInt();
//
// int i=0;
//
// if(b==1) {
//
// System.out.println("현재 "+a.size()+"개의 나라와 수도가 입력되어 있습니다.");
//
// i=a.size()+1;
//
// while(true) {
//
// System.out.print("나라와 수도 입력"+i+++">>");
//
// String country = in.next();
//
// if(country.equals("그만")) {
//
// break;
//
// }
//
//
//
// String capital = in.next();
//
//
//
// Set<String>keys = a.keySet();
//
// Iterator<String> it = keys.iterator();
//
//
//
// while(it.hasNext())
//
// {
//
// if(country.equals(it.next()))
//
// {
//
// System.out.println(country+"는 이미 있습니다!");
// i--;
// }
//
// }
//
// a.put(country, capital);
//
// }
//
//
//
// }
//
//
//
// else if(b==2)
//
// {
// while(true) {
//
// Set<String>keys = a.keySet();
// Iterator<String> it = keys.iterator();
//
// int s = keys.size();
// int t = (int)(Math.random()*s)-1;
// while(t>0) {
// it.next();
// t--;
//
// }
// String country = it.next();
// String capital = a.get(country);
//
// System.out.print(country+"의 수도는?");
//
// String answer = in.next();
// if(answer.equals("그만")) {
// break;
// }
// else if(capital.equals(answer)) {
// System.out.println("정답!!");
// }else {
// System.out.println("아닙니다!!");
// }
// }
//
// }
// else
//
// {
// System.out.println("게임을 종료합니다.");
// break;
//
// }
//
// }
//
//
//
// }
//
// }
class GStack<T>{
int tos;
Object[] stck;
public GStack() {
tos=0;
stck = new Object[10];
}
public void push(T item) {
if(tos == 10) {
return;
}
stck[tos] = item;
tos++;
}
public T pop() {
if(tos==0)
return null;
tos--;
return (T)stck[tos];
}
}
public class Main{
public static void main(String[] args) {
GStack<String> StringStack = new GStack<String>();
StringStack.push("seoul");
StringStack.push("busan");
StringStack.push("LA");
for(int n=0; n<3; n++) {
System.out.println(StringStack.pop());
}
GStack<Integer> intStack = new GStack<Integer>();
intStack.push(1);
intStack.push(2);
intStack.push(3);
for(int n =0; n<3; n++) {
System.out.println(intStack.pop());
}
}
}