{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eNoticeļ¼Don\u0027t output extra spaces at the end of one line.\u003cbr\u003e\u003cbr\u003eKoishi loves bitwise xor!\u003cbr\u003e\u003cbr\u003eSatori knows that, so she decides to play a game with Koishi and her $n$ pets. There are $n$ pets standing in a row, and the $i$-th of them has $m_i$ kinds of magic, the $j$-th magic can be described as a pair of non-negative integers$(x_{ij},y_{ij})$. If she use this magic to a non-negative integer $w$, then she can turn $w$ into $w\\oplus x_{ij}$ or $w\\oplus y_{ij}$ as she wants. addtionally, the $i$-th pet has her favorate integer $p_i$.\u003cbr\u003e\u003cbr\u003eSatori\u0027s game consists of $q$ rounds. In each round, one of following two things may happan:\u003cbr\u003e\u003cbr\u003e1. Koishi closes her third eye, so Satori select one of her pets, and change its favorate integer.\u003cbr\u003e\u003cbr\u003e2. Koishi\u0027s third eye reopens, so Satori tells three non-negative integers $l,r,x(1\\leq l\\leq r\\leq n)$. Then, pets with index from $l$ to $r$ will use the magic to the integer $x$ one by one($l$-th is the first and $r$-th is the last), every pet \\textbf{must} use \\textbf{each} of her magic \\textbf{exactly once}. After $r$-th pet finishes her operation, integer $x$ will become $y$ at last. Every pet want the final $y$ to be her own favorate integer $p$. so the $i$-th pet will try her best to make $y\\oplus p_i$ as small as possible(notice $y$ is the final integer) . Every pet konws any other pets\u0027 magic details, favorate integer, and $l,r,x$ in the current round. Suppose they are all the cleverest, what\u0027s the final integer $y$?\u003cbr\u003e\u003cbr\u003eKoishi is NO.1 all over the world, so she computes the final $y$ easily.\u003cbr\u003e\u003cbr\u003eWhat about you?\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line contains one positive integer $T(1\\leq T\\leq 15)$, representing $T$ test cases.\u003cbr\u003e\u003cbr\u003eIn each test case, the first line contains two positive integer $n,q(1\\leq n,q\\leq 10^5)$, number of pets and rounds.\u003cbr\u003e\u003cbr\u003eFollowing is information of pets. For $i$-th pet, the first line contains two positive integers $m_i,p_i$, the number of magic the $i$-th pet owns and her initial favorate integer. Following are $m_i$ lines. $j$-th of them contains two non-negative integers $x_{ij},y_{ij}$.$(1\\leq \\sum m_i\\leq 10^5,0\\leq p,x,y,w\u0026lt; 2^{30})$\u003cbr\u003e\u003cbr\u003eFollowing $q(1\\leq q\\leq 10^5)$ lines is information of each round. The $i$-th line has two possibilities.\u003cbr\u003e\u003cbr\u003e1 x y :means $p_x$ is changed to $y(0\\leq y\u0026lt;2^{30})$\u003cbr\u003e\u003cbr\u003e2 l r x: means a game with parameters $l,r,x(1\\leq l\\leq r\\leq n,0\\leq y\u0026lt;2^{30})$ begins. \u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each game, output a line with a non-negative integer representing the final $y$ at last of this game."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e1\r\n5 6\r\n2 11\r\n51 25\r\n33 10\r\n2 26\r\n17 52\r\n10 44\r\n2 30\r\n13 52\r\n46 51\r\n2 16\r\n31 34\r\n44 35\r\n2 34\r\n27 4\r\n47 61\r\n1 4 9\r\n2 1 4 33\r\n1 1 47\r\n2 1 1 47\r\n1 3 41\r\n2 1 3 26\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e30\r\n61\r\n46\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}