3210. Maximum Element

单点时限: 2.0 sec

内存限制: 256 MB

You have an empty sequence, and you will be given queries. Each query is one of these three types:

1 x  -Push the element x into the stack.
2    -Delete the element present at the top of the stack.
3    -Print the maximum element in the stack.

输入格式

The first line of input contains an integer, . The next lines each contain an above mentioned query. (It is guaranteed that each query is valid.)


输出格式

For each type 3 query, print the maximum element in the stack on a new line.

样例

Input
10
1 97
2
1 20
2
1 26
1 20
2
3
1 91
3
Output
26
91

70 人解决,74 人已尝试。

91 份提交通过,共有 241 份提交。

3.0 EMB 奖励。

创建: 2 年,8 月前.

修改: 2 年,4 月前.

最后提交: 1 月前.

来源: HackerRank

题目标签
STL