{"raw_statement":[{"iden":"problem statement","content":"There are $N$ pieces on a two-dimensional plane. The coordinates of Piece $i$ are $(X_i,Y_i)$. There may be multiple pieces at the same coordinates.\nWe will do $M$ operations $\\mathrm{op}_1, \\ldots, \\mathrm{op}_M$, one by one. There are four kinds of operations, described below along with their formats in input.\n\n*   `1`：Rotate every piece $90$ degrees clockwise about the origin;\n*   `2`：Rotate every piece $90$ degrees counterclockwise about the origin;\n*   `3 p`：Move each piece to the point symmetric to it about the line $x=p$;\n*   `4 p`：Move each piece to the point symmetric to it about the line $y=p$.\n\nYou are given $Q$ queries. In the $i$\\-th query, given two integers $A_i$ and $B_i$, print the coordinates of Piece $B_i$ just after the $A_i$\\-th operation. Here, the moment just before the $1$\\-st operation is considered to be the moment just after \"the $0$\\-th operation\"."},{"iden":"constraints","content":"*   All values in input are integers.\n*   $1 \\leq N \\leq 2\\times 10^5$\n*   $1 \\leq M \\leq 2\\times 10^5$\n*   $1 \\leq Q \\leq 2\\times 10^5$\n*   $-10^9 \\leq X_i,Y_i \\leq 10^9$\n*   $\\mathrm{op}_i$ is in the format of one of the four kinds of operations.\n*   In an operation with the form `3 p` or `4 p`, $-10^9 \\leq p \\leq 10^9$.\n*   $0 \\leq A_i \\leq M$\n*   $1 \\leq B_i \\leq N$"},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$X_1$ $Y_1$\n$\\vdots$\n$X_N$ $Y_N$\n$M$\n$\\mathrm{op}_1$\n$\\vdots$\n$\\mathrm{op}_M$\n$Q$\n$A_1$ $B_1$\n$\\vdots$\n$A_Q$ $B_Q$"},{"iden":"sample input 1","content":"1\n1 2\n4\n1\n3 3\n2\n4 2\n5\n0 1\n1 1\n2 1\n3 1\n4 1"},{"iden":"sample output 1","content":"1 2\n2 -1\n4 -1\n1 4\n1 0\n\nInitially, the only piece - Piece $1$ - is at $(1, 2)$. Each operation moves the piece as follows: $(1,2)\\to(2,-1)\\to(4,-1)\\to(1,4)\\to(1,0)$."},{"iden":"sample input 2","content":"2\n1000000000 0\n0 1000000000\n4\n3 -1000000000\n4 -1000000000\n3 1000000000\n4 1000000000\n2\n4 1\n4 2"},{"iden":"sample output 2","content":"5000000000 4000000000\n4000000000 5000000000"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}