{"raw_statement":[{"iden":"problem statement","content":"There are $N$ sequences of integers.  \nThe $i$\\-th $(1 \\leq i \\leq N)$ sequence has $L_i$ terms; the $j$\\-th $(1 \\leq j \\leq L_i)$ term of the $i$\\-th sequence is $a_{i, j}$.\nYou are given $Q$ queries. For the $k$\\-th $(1 \\leq k \\leq Q)$ query, given integers $s_k$ and $t_k$, find the $t_k$\\-th term of the $s_k$\\-th sequence."},{"iden":"constraints","content":"*   $1 \\leq N, Q \\leq 2 \\times 10^5$\n*   $L_i \\geq 1 \\, (1 \\leq i \\leq N)$\n*   $\\sum_{i=1}^N L_i \\leq 2 \\times 10^5$\n*   $1 \\leq a_{i, j} \\leq 10^9 \\, (1 \\leq i \\leq N, 1 \\leq j \\leq L_i)$\n*   $1 \\leq s_k \\leq N, 1 \\leq t_k \\leq L_{s_k} \\, (1 \\leq k \\leq Q)$\n*   All values in the input are integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ $Q$\n$L_1$ $a_{1, 1}$ $\\ldots$ $a_{1, L_1}$\n$\\vdots$\n$L_N$ $a_{N, 1}$ $\\ldots$ $a_{N, L_N}$\n$s_1$ $t_1$\n$\\vdots$ \n$s_Q$ $t_Q$"},{"iden":"sample input 1","content":"2 2\n3 1 4 7\n2 5 9\n1 3\n2 1"},{"iden":"sample output 1","content":"7\n5\n\nThe $1$\\-st sequence is $(1, 4, 7)$ and the $2$\\-nd is $(5, 9)$.  \nThe answer to each query is as follows:\n\n*   The $3$\\-rd term of the $1$\\-st sequence is $7$.\n*   The $1$\\-st term of the $2$\\-nd sequence is $5$."},{"iden":"sample input 2","content":"3 4\n4 128 741 239 901\n2 1 1\n3 314 159 26535\n1 1\n2 2\n3 3\n1 4"},{"iden":"sample output 2","content":"128\n1\n26535\n901"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}