{"raw_statement":[{"iden":"problem statement","content":"We have an empty sequence $A$. You will be given $Q$ queries, which should be processed in the order they are given. Each query is of one of the three kinds below:\n\n*   `1 x` : Append $x$ to the end of $A$.\n*   `2` : Print the element at the beginning of $A$. Then, delete that element. It is guaranteed that $A$ will not empty when this query is given.\n*   `3` : Sort $A$ in ascending order."},{"iden":"constraints","content":"*   $1 \\leq Q \\leq 2 \\times 10^5$\n*   $0 \\leq x \\leq 10^9$\n*   $A$ will not be empty when a query `2` is given.\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$Q$\n$\\mathrm{query} 1$\n$\\mathrm{query} 2$\n$\\vdots$\n$\\mathrm{query} Q$\n\nThe $i$\\-th query, $\\mathrm{query} i$, begins with the kind of query $c_i$ ($1$, $2$, or $3$). If $c_i = 1$, the line additionally has an integer $x$.\nIn other words, each query is in one of the three formats below.\n\n$1$ $x$\n\n$2$\n\n$3$"},{"iden":"sample input 1","content":"8\n1 4\n1 3\n1 2\n1 1\n3\n2\n1 0\n2"},{"iden":"sample output 1","content":"1\n2\n\nThe $i$\\-th line below shows the contents of $A$ after the $i$\\-th query is processed in Sample Input $1$.\n\n*   $(4)$\n*   $(4, 3)$\n*   $(4, 3, 2)$\n*   $(4, 3, 2, 1)$\n*   $(1, 2, 3, 4)$\n*   $(2, 3, 4)$\n*   $(2, 3, 4, 0)$\n*   $(3, 4, 0)$"},{"iden":"sample input 2","content":"9\n1 5\n1 5\n1 3\n2\n3\n2\n1 6\n3\n2"},{"iden":"sample output 2","content":"5\n3\n5\n\nThe $i$\\-th line below shows the contents of $A$ after the $i$\\-th query is processed in Sample Input $2$.\n\n*   $(5)$\n*   $(5, 5)$\n*   $(5, 5, 3)$\n*   $(5, 3)$\n*   $(3, 5)$\n*   $(5)$\n*   $(5, 6)$\n*   $(5, 6)$\n*   $(6)$"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}