import java.util.Stack;

/**
* Created by yywang on 2017/1/14.
*/
public class f

public static void main(String[] args) {
Stack<Integer> s = new Stack<Integer>();

for (int i = 0; i < 6; i++) {
s.push(i);
}
for (int i : s
) {
System.out.println(i);
}
System.out.println();
while(!s.empty()){
System.out.println(s.pop());
}
}
}