Star Wars
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

The new round of Star Wars has begun.

In this round of Star Wars, our side has established n bases in the universe. At the beginning of the war, all bases had zero troops and there were no wormholes. A wormhole connects two different bases and can be bidirectional.

You need to help the commander-in-chief write a program to answer some questions based on the battlefield situation.

输入描述:

We use \text{last} to represent the answer of the last 4 operation and initialize \text{last}=0.

The first line contains two integers n (1\le n\le 3\times10^5) and q (1\le q\le 3\times10^5), which represent the number of bases and the number of instructions that the commander-in-chief will give you.

Next q lines, each line contains one instruction. There are four types of instructions:

- `1 x y` Our side added a wormhole connecting x and y.
- `2 x y` The enemy destroyed a wormhole connecting x and y. It is guaranteed that this wormhole existed before this operation.
- `3 x c` Base x increased c (0\le c\le 10^9) troops.
- `4 x` Find the sum of troops that can be reached from base x through at most one wormhole.

You need to transform the input x,y,c into x\oplus (\text{last}\ \text{mod}\ 2^{30}),y\oplus (\text{last}\ \text{mod}\ 2^{30}),c\oplus (\text{last}\ \text{mod}\ 2^{30}) to get the real data, where \oplus means binary XOR.

输出描述:

For each 4 operation, output a line representing the answer.
示例1

输入

复制
5 10
1 5 1
3 5 10
3 4 100
1 1 4
4 1
2 111 107
1 106 107
3 106 10
4 107
4 214

输出

复制
110
210
210

备注: