Nitika recently read about XOR operation and she got obssessed with it. She has an array containing N Positive integers.

She wants to perform Q queries on the array.

In a query She gives two integers L and R.(1 based indexing).

Now, she asks what is the xor of all the elements of the array after not including the subarray ranging from L to R (both inclusive).

Nitika guarantees that in each query, The resulting array is non empty.

**Input:**

The First line contains an integer T, the number oftestcases.

The first line of eachtestcase contains Two integers N ,Q -the Size of the array and the number of queries respectively.

The next Line contains N integers denoting the array.

Each of the next Q lines contains two integers L and R.

**Output:**

For each query Print the required answer.

**Constraints:**

1<=T<=10

1<= N,Q <=1e5

0<=Ai<=1e9

1<=L,R<=N

**Example:
Input:**

1

10 3

4 7 8 5 9 6 1 0 20 10

3 8

1 6

2 3

29

31

17

**Explanation:**

For the first query: The resulting array is: (4 ,7 ,20, 10)

Their Xor will be: 29

For the Second query: The resulting array is: (1, 0, 20, 10)

Their Xor will be: 31

For the Third query: The resulting array is: (4, 5, 9, 6, 1,0 ,20, 10)

Their Xor will be: 17

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

msriramvarma01 | 25 |

AbhilashKumar2 | 24 |

monusinghal | 24 |

tripurari_IT | 24 |

Abreez Das | 23 |

ARUN_PUNDIR | 609 |

manishgupta8497 | 607 |

KhyatiSoneji | 501 |

Abhimanyu_kumar | 487 |

vvggfggcg | 453 |

blackshadows | 5333 |

Ibrahim Nash | 5221 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4567 |

Login to report an issue on this page.