{"raw_statement":[{"iden":"problem statement","content":"We have an empty sequence $A$.  \nGiven $Q$ queries, process them in order.  \nEach query is of one of the following three types.\n\n*   `1 x` : Insert $x$ to $A$.\n    \n*   `2 x k` : Among the elements of $A$ that are less than or equal to $x$, print the $k$\\-th largest value. ($k$ is no more than $\\bf{5}$)  \n    If there are less than $k$ elements of $A$ that are less than or equal to $x$, then print `-1`.\n    \n*   `3 x k` : Among the elements of $A$ that are greater than or equal to $x$, print the $k$\\-th smallest value. ($k$ is no more than $\\bf{5}$)  \n    If there are less than $k$ elements of $A$ that are greater than or equal to $x$, then print `-1`."},{"iden":"constraints","content":"*   $1\\leq Q \\leq 2\\times 10^5$\n*   $1\\leq x\\leq 10^{18}$\n*   $1\\leq k\\leq 5$\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$Q$\n$\\text{query}_1$\n$\\text{query}_2$\n$\\vdots$\n$\\text{query}_Q$\n\nIn the $i$\\-th query $\\text{query}_i$, the type of query $c_i$ (which is either $1, 2$, or $3$) is given first.  \nIf $c_i=1$, then $x$ is additionally given; if $c_i=2, 3$, then $x$ and $k$ are additionally given.\nIn other words, each query is given in one of the following three formats:\n\n$1$ $x$\n\n$2$ $x$ $k$\n\n$3$ $x$ $k$"},{"iden":"sample input 1","content":"11\n1 20\n1 10\n1 30\n1 20\n3 15 1\n3 15 2\n3 15 3\n3 15 4\n2 100 5\n1 1\n2 100 5"},{"iden":"sample output 1","content":"20\n20\n30\n-1\n-1\n1\n\nAfter $\\text{query}_{1,2,3,4}$ have been processed, we have $A=(20,10,30,20)$.\nFor $\\text{query}_{5,6,7}$, the elements of $A$ greater than or equal to $15$ are $(20,30,20)$.  \nThe $1$\\-st smallest value of them is $20$; the $2$\\-nd is $20$; the $3$\\-rd is $30$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}