Simple Stack#6122

Simple Stack

2 seconds
128 megabytes
Very easy

Design and implement the data structure stack. Write a program that describes the stack and simulates stack operations, implementing all the methods specified below. The program reads a sequence of commands and, depending on the command, performs the corresponding operation. After executing each command, the program must print one line of output. The possible commands are:

It is guaranteed that the sequence of input commands satisfies the following requirements: the maximum number of elements in the stack at any time does not exceed , and all pop and back commands are correct, that is, at the moment they are performed, the stack contains at least one element.

Input

Each line contains a single command.

Output

For each command, output the corresponding result on a separate line.

Examples

Example 1

Loading
Loading