The first line of the input contains a single integer $T$ ($1\le T\le 10$), denoting the number of test cases.
For each of the next $T$ cases, the first line contains three space-separated integers $n$, $m$, $q$ ($1\le n,m,q \le 3\cdot 10^5$), denoting the number of service spots, number of running trails in the initial plan, and the number of queries.
In the next $m$ lines, the $i$-th line contains two space-separated integers $u_i$, $v_i$ ($1\le u_i,v_i\le n$, $u_i\ne v_i$).
Each of the next $q$ lines contains two space-separated integers $l'$, $r'$ ($1\le l'\le r'\le m$). $l$ and $r$ can be calculated via the following procedure.
- Let $\text{lastans}$ denote the answer to the last query (if the answer is ''Yes'', $\text{lastans} = 1$, otherwise $\text{lastans}=0$) and is initially zero.
- $k_1=(l'\; \text{xor}\; \text{lastans})\; \text{mod}\; m + 1$.
- $k_2=(r'\; \text{xor}\; \text{lastans})\; \text{mod}\; m + 1$.
- $l = \min(k_1, k_2)$.
- $r = \max(k_1, k_2)$.
$l$ and $r$ means the edges in $[l, r]$ will be chosen. That means, for this query, only edges $(u_l, v_l), (u_{l+1}, v_{l+1}), \ldots, (u_r, v_r)$ are visible.
It is guaranteed that $\sum n,\sum m \le 1.5\cdot 10^6$.