You have a stack with size n. Now there are m operations. Each operation will be one of the following cases:
Push x: If the stack is not full, push x into the stack. Otherwise print x.
Pop: If the stack has at least one element, print and pop the top element of the stack. Otherwise do nothing.
After the m operations, you should print all elements in the stack from the top.
Please write a program to print the elements in the order problem described.