직각삼각형 방 안의 먼지에 H와 V 청소가 일어나고, 중간에 먼지가 추가될 때 각 질의 먼지의 좌표를 구한다.
어려움8시뮬레이션스택이분 탐색아직 제출이 없습니다시간 제한11초메모리 제한2048 MBBitaro’s room is an isosceles right-angled triangle whose leg has length N. A point in Bitaro’s room is represented as the coordinate (x, y) with 0 ≤ x ≤ N, 0 ≤ y ≤ N, x + y ≤ N. The vertex of the right angle is the origin. The two legs of the triangle are the x-axis and the y-axis.

One day, Bitaro noticed that his room is full of dust. In the beginning, there are M dusts in the room. The i-th dust (1 ≤ i ≤ M) lies in the point (Xi, Yi). More than one dust may lie at the same point.
Now, Bitaro is planning to sweep the room using brooms. We consider a broom as a segment in the room and we call the length of the segment its width. Since Bitaro is well-organized, he can use a broom only in the following two ways.
In Bitaro’s room, Q events will happen sequentially. The event j (1 ≤ j ≤ Q) is one of the following.
Write a program which, given the length of the legs of the room, the coordinates of the dusts in the room, and the details of the events, calculates the coordinates of the dusts.
Read the following data from the standard input. All the values in the input are integers.
N M Q
X1 Y1
.
.
.
XM YM
(Query 1)
.
.
.
(Query Q)
Two or three space separated integers are written in each (Query j) (1 ≤ j ≤ Q). Let Tj be the first integer. Then the meaning of this line is as follows.
For each event with Tj = 1, write one line to the standard output. Output the x-coordinate and the y-coordinate of the dust Pj when the event j happens.