A reactor console maintains a vertical stack of control-rod readings. It processes a stream of q operations, each one of:
PUSH v— place a readingv(an integer) on top of the stack.POP— remove the reading currently on top. It is guaranteed the stack is non-empty.MIN— report the smallest reading currently anywhere in the stack. It is guaranteed the stack is non-empty.
Process the operations in order.
Input format
Line 1: an integer q, the number of operations.
Next q lines: one operation each, in the forms above.
Output format
For every MIN operation, in order, print one line containing the current minimum reading.
Constraints
- 1 <= q <= 40
- -1000000 <= v <= 1000000
- Every
POPandMINacts on a non-empty stack.