Each test contains multiple test cases. The first line contains the number of test cases $(1 \le T \le 20)$. Description of the test cases follows.
The first line contains two integers $n$ and $q$ ($3\leq n\leq10^8$, $1\leq q\leq 10^5$) -- The number of Themis defending system blocks, and the number of attacks that Erichthonios will perform.
The following $q$ lines contains Erichthonios' attacks, (initially, $last = 0$):
- $1$ $x'$ $c'$: contains 3 integers, $1\leq x'\leq n$, $1 \leq c' \leq \lfloor\frac{n-1}{2}\rfloor$, actually, $x = \big((x' - 1) \oplus last\big) \mod n\ +\ 1$, $c = \big((c' - 1) \oplus last\big) \mod \lfloor\frac{n-1}{2}\rfloor\ +\ 1$.
- $2$ $x'$ $y'$: contains 3 integers, $1\leq x'\leq n$, $1 \leq y' \leq n$, actually, $x = \big((x' - 1) \oplus last\big) \mod n\ +\ 1$, $y = \big((y' - 1) \oplus last\big) \mod n\ +\ 1$.
- $3$ $x'$ $v$: contains 3 integers, $1\leq x'\leq n$, $1 \leq v \leq 10^9$, actually, $x = \big((x' - 1) \oplus last\big) \mod n\ +\ 1$, and there is no encode with $v$, $1 \leq v \leq 10^9$.
- $4$ $x'$: contains 2 integers, $1\leq x'\leq n$, actually, $x = \big((x' - 1) \oplus last\big) \mod n\ +\ 1$, after you get the $Answer$, don't forget to update, $last = Answer\ \text{and}\ 1\ 073\ 741\ 823$.
Where $\oplus$ means bitwise XOR operation, $\text{and}$ means bitwise AND operation.
It is guaranteed that the sum of $n$ does not exceed $2\cdot 10^9$ and the sum of $q$ does not exceed $10^6$