Operation
You need to perform n operations. Each operation is either Type 1: obtain a number, or Type 2: take out and output the smallest number among all currently obtained numbers, then discard it. If all numbers have been discarded when performing Type 2 operation, output "NONONO".
Input format:
An integer n, followed by n lines each containing an integer a. If a is 1, it will be followed by another integer b.
Output format:
For each Type 2 operation, output the corresponding value, each value on a separate line.
Data range:
1 ≤ n ≤ 105, 1 ≤ a ≤ 2, 0 ≤ |b| ≤ 109
Input sample:
3
2
1 4
2
Output sample:
NONONO
4
Comments