eolymp
bolt
Try our new interface for solving problems
Problems

Stack push / pop

Stack push / pop

Simulate the operations with the stack: \begin{itemize} \item \textbf{push x} --- insert value $x$ into the stack; \item \textbf{pop} --- delete the top element; \item \textbf{top} --- print the top element (without deleting it); \end{itemize} All \textbf{pop} commands are correct. If stack is empty and \textbf{top} command arrives, print nothing. \InputFile Each line contains a single command. \OutputFile For each \textbf{top} command print on a separate line the corresponding result.
Time limit 1 second
Memory limit 128 MiB
Input example #1
push 5
push 2
top
pop
top
pop
top
push 7
top
Output example #1
2
5
7
Author Michael Medvediev