#P7834. Bitwise Xor
Bitwise Xor
Bitwise Xor
Problem Description
Notice:Don't output extra spaces at the end of one line. Koishi loves bitwise xor! Satori knows that, so she decides to play a game with Koishi and her pets. There are pets standing in a row, and the -th of them has kinds of magic, the -th magic can be described as a pair of non-negative integers. If she use this magic to a non-negative integer , then she can turn into or as she wants. addtionally, the -th pet has her favorate integer . Satori's game consists of rounds. In each round, one of following two things may happan:
- Koishi closes her third eye, so Satori select one of her pets, and change its favorate integer.
- Koishi's third eye reopens, so Satori tells three non-negative integers . Then, pets with index from to will use the magic to the integer one by one(-th is the first and -th is the last), every pet \textbf{must} use \textbf{each} of her magic \textbf{exactly once}. After -th pet finishes her operation, integer will become at last. Every pet want the final to be her own favorate integer . so the -th pet will try her best to make as small as possible(notice is the final integer) . Every pet konws any other pets' magic details, favorate integer, and in the current round. Suppose they are all the cleverest, what's the final integer ? Koishi is NO.1 all over the world, so she computes the final easily. What about you?
Input
The first line contains one positive integer , representing test cases. In each test case, the first line contains two positive integer , number of pets and rounds. Following is information of pets. For -th pet, the first line contains two positive integers , the number of magic the -th pet owns and her initial favorate integer. Following are lines. -th of them contains two non-negative integers . Following lines is information of each round. The -th line has two possibilities. 1 x y :means is changed to 2 l r x: means a game with parameters begins.
Output
For each game, output a line with a non-negative integer representing the final at last of this game.
Sample Input
1
5 6
2 11
51 25
33 10
2 26
17 52
10 44
2 30
13 52
46 51
2 16
31 34
44 35
2 34
27 4
47 61
1 4 9
2 1 4 33
1 1 47
2 1 1 47
1 3 41
2 1 3 26
Sample Output
30
61
46
Source
2020 Multi-University Training Contest 7