Score : $400$ points
Takahashi has many balls, on which nothing is written, and one bag. Initially, the bag is empty. Takahashi will do $Q$ operations, each of which is of one of the following three types.
For each $1\leq i\leq Q$, you are given the type $P_i$ of the $i$-th operation and the value of $X_i$ if the operation is of Type $1$ or $2$. Print the integers recorded in the operations of Type $3$ in order.
Input is given from Standard Input in the following format:
$Q$ $query_1$ $query_2$ $:$ $query_Q$
Each $query_i$ in the $2$-nd through $(Q+1)$-th lines is in the following format:
$1$ $X_i$
$2$ $X_i$
$3$
The first number in each line is $1\leq P_i\leq 3$, representing the type of the operation. If $P_i=1$ or $P_i=2$, it is followed by a space, and then by $X_i$.
For each operation with $P_i=3$ among the $Q$ operations, print the recorded integer in its own line.
5 1 3 1 5 3 2 2 3
3 7
Takahashi will do the following operations.
Therefore, we should print $3$ and $7$, in the order they are recorded.
6 1 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 3
5000000000
Note that the outputs may not fit into a $32$-bit integer.