#abc185f. [abc185_f]Range Xor Query

[abc185_f]Range Xor Query

Problem Statement

We have an integer sequence AA of length NN.
You will process QQ queries on this sequence. In the ii-th query, given values TiT_i, XiX_i, and YiY_i, do the following:

  • If Ti=1T_i = 1, replace AXiA_{X_i} with AXioplusYiA_{X_i} \\oplus Y_i.
  • If Ti=2T_i = 2, print $A_{X_i} \\oplus A_{X_i + 1} \\oplus A_{X_i + 2} \\oplus \\dots \\oplus A_{Y_i}$.

Here, aoplusba \\oplus b denotes the bitwise XOR of aa and bb.

What is bitwise XOR?

The bitwise XOR of integers AA and BB, AoplusBA \\oplus B, is defined as follows:

  • When AoplusBA \\oplus B is written in base two, the digit in the 2k2^k's place (kgeq0k \\geq 0) is 11 if either AA or BB, but not both, has 11 in the 2k2^k's place, and 00 otherwise.

For example, 3oplus5=63 \\oplus 5 = 6. (In base two: 011oplus101=110011 \\oplus 101 = 110.)

Constraints

  • 1leNle3000001 \\le N \\le 300000
  • 1leQle3000001 \\le Q \\le 300000
  • 0leAilt2300 \\le A_i \\lt 2^{30}
  • TiT_i is 11 or 22.
  • If Ti=1T_i = 1, then 1leXileN1 \\le X_i \\le N and 0leYilt2300 \\le Y_i \\lt 2^{30}.
  • If Ti=2T_i = 2, then 1leXileYileN1 \\le X_i \\le Y_i \\le N.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN QQ $A_1 \\hspace{7pt} A_2 \\hspace{7pt} A_3 \\hspace{5pt} \\dots \\hspace{5pt} A_N$ T1T_1 X1X_1 Y1Y_1 T2T_2 X2X_2 Y2Y_2 T3T_3 X3X_3 Y3Y_3 hspace22ptvdots\\hspace{22pt} \\vdots TQT_Q XQX_Q YQY_Q

Output

For each query with Ti=2T_i = 2 in the order received, print the response in its own line.


Sample Input 1

3 4
1 2 3
2 1 3
2 2 3
1 2 3
2 2 3

Sample Output 1

0
1
2

In the first query, we print 1oplus2oplus3=01 \\oplus 2 \\oplus 3 = 0.
In the second query, we print 2oplus3=12 \\oplus 3 = 1.
In the third query, we replace A2A_2 with 2oplus3=12 \\oplus 3 = 1.
In the fourth query, we print 1oplus3=21 \\oplus 3 = 2.


Sample Input 2

10 10
0 5 3 4 7 0 0 0 1 0
1 10 7
2 8 9
2 3 6
2 1 6
2 1 10
1 9 4
1 6 1
1 6 3
1 1 7
2 3 5

Sample Output 2

1
0
5
3
0