Magnets

아직 제출이 없습니다시간 제한3초메모리 제한512 MB

문제

You have a 109×10910^9 \times 10^9 square magnetic board with the origin of the coordinate system in the lower-left corner. There are nn magnets on the board, numbered from 11 to nn. Each magnet is an 1×11 \times 1 square. Initially, the magnets are positioned in such way that the lower right corner of the ii-th magnet has the coordinates (i,0)(i, 0).

Example of the initial state for n=5n=5

You are receiving qq queries of two types:

  • a query of type 11 is characterized by two integers ll and rr (1lrn1 \leq l \leq r \leq n): take magnets with numbers from ll to rr inclusive, and rotate them by 9090^{\circ}. If the selected magnets formed a horizontal segment, then the rotation should be performed counterclockwise by 9090^{\circ}, so they will turn into a vertical segment. If the selected magnets formed a vertical segment, then the rotation should be performed clockwise 9090^{\circ}, so they will turn into a horizontal segment. All turns are relative to magnet with the smallest number. In this query, it is guaranteed that magnets with numbers from ll to rr form a continuous horizontal or vertical segment at the time of query processing.
  • a query of type 22 is characterized by one integer jj (1jn1 \leq j \leq n): output the coordinates (x,y)(x, y) of the lower right corner of the magnet with the number jj.

Below are the board states for n=6n=6 and the series of first type queries (l_1=2,r_1=5)(l\_1=2,r\_1=5), (l_2=3,r_2=4)(l\_2=3,r\_2=4), (l_3=2,r_3=3)(l\_3=2,r\_3=3), (l_4=6,r_4=6)(l\_4=6,r\_4=6).

Initial state for n=6n=6.

After processing a query of the first type (l_1=2,r_1=5)(l\_1=2,r\_1=5).

After processing a query of the first type (l_2=3,r_2=4)(l\_2=3,r\_2=4).

After processing a query of the first type (l_3=2,r_3=3)(l\_3=2,r\_3=3).

After processing a query of the first type (l_4=6,r_4=6)(l\_4=6,r\_4=6).

For each query of type 22 you should output the coordinates of the lower right corner of the magnet with the corresponding number.

입력

The first line contains two integers nn and qq (1n,q21051 \le n, q \le 2 \cdot 10^5) --- the number of magnets on the board and the number of queries, respectively.

Each of the following qq lines contains one query of either type 11 or type 22. A type 11 query consists of 33 integers 11 ll rr (1lrn)(1 \le l \le r \le n), a type 22 query consists of 22 integers 22 jj (1jn)(1 \le j \le n).

출력

For each query of the type 22 output xx and yy --- coordinates of the lower right corner of the magnet with the number jj at the moment of processing the corresponding query.