#P7184. Link is as bear

    ID: 6041 远端评测题 2000ms 128MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>2022“杭电杯”中国大学生算法设计超级联赛(4)

Link is as bear

Problem Description

Link, a famous bear magician in Bear Institute of Talented(BIT), has recently learned new magic.

That is, given a array $a$ containing $n$ elements $a_{1},...,a_{n}$, and Link can cast the following magic:

Link can choose two integers $l,r$ such that $1\leq l \leq r \leq n$, making all $a_{i}=xor(l,r)$ where $l\leq i\leq r$ and $xor(l,r)$ denotes the bitwise-xor($\oplus$) of all elements in $[l,r]$. More formally, $xor(l,r)=a_l\oplus a_{l+1}\oplus ... \oplus a_r$.

Link can cast this magic any time(possibly, zero) and can choose $l,r$ arbitrarily. However, since Link has a sort of Obsessive-Compulsive Disorder(OCD), he wants all elements to become the same after his operation. Now, he wonders about the maximum of this same value.

What's more, Link finds that the given array has a weird property: there always exists at least one pair of $x,y(x\neq y)$ such that $a_x= a_y$.

Input

The first line contains an integer $T(1\leq T \leq 3*10^4)$, the number of the test cases.

The first line of each test case is an interger $n(1\leq n\leq 10^5)$, the length of the array $a$.

The second line of each test case containing $n$ integers, while the $i$-th denoting $a_i(0\leq a_i \leq 10^{15})$. It's guaranteed that there always exists at least one pair of $x,y(x\neq y)$ such that $a_x= a_y$.

It's also guaranteed that $\Sigma n \leq 10^6$.

Output

For each test case, output a single intergers indicating the maximum of the same value after Link's operations.

2 5 10 10 10 10 10 4 1 1 2 1
10 3