Rectangle Painting

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

문제

There is an cell grid infinite in left, right, and upwards directions (all the cells with coordinates (x,y)(x, y) with xZx \in \mathbb{Z}, y0y \ge 0 exist). Initially all the cells are white. You have to process qq queries of two types:

  1. y_iy\_{i} l_il\_{i} r_ir\_{i}: paint all cells (x,y_i)(x, y\_{i}) for l_ixr_il\_{i} \le x \le r\_{i} black. If the cell is already black, its color doesn't change.
  2. l_il\_{i} r_ir\_{i}: consider all cells with xx coordinate on the segment \[l_i;r_i]\[l\_{i}; r\_{i}]. Find the highest cell such that all cells exactly under it are black. Formally, you have to find maximal hh such that :x\[l_i;r_i]::y\[0;h)\exists \\: x \in \[l\_{i}; r\_{i}] \\: \forall \\: y \in \[0;h) cell (x,y)(x, y) is black.

To enforce processing the queries online they are encrypted using previous answers.

입력

The first line contains one integer qq (1q1051 \le q \le 10^{5}) --- the number of queries to process.

The next qq lines will contain encrypted descriptions of queries. Let SS be the sum of answers to all queries of second type processed so far.

Each description has form either 11 (y_iS)(y\_{i} \oplus S) (l_iS)(l\_{i} \oplus S) (r_iS)(r\_{i} \oplus S) or 22 (l_iS)(l\_{i} \oplus S) (r_iS)(r\_{i} \oplus S). It is guaranteed that 0y_i21050 \le y\_{i} \le 2 \cdot 10^{5}, 0l_ir_i21050 \le l\_{i} \le r\_{i} \le 2 \cdot 10^{5}. Note that the guarantees are given on parameters after decryption, the numbers in input might not fit in 32-bit integers.

Don't forget to add the new answer to SS after each query of the second type.

출력

Print the answers to all queries of the second type on separate lines.

힌트

SEncryptedQueryAns
01 0 1 11 0 1 1-
02 0 102 0 101
11 1 9 91 0 8 8-
11 0 0 61 1 1 7-
11 0 3 91 1 2 8-
12 5 52 4 40
11 1 5 51 0 4 4-
12 5 52 4 42
32 0 52 3 62
51 7 6 31 2 3 6-