XOR Necklace

아직 제출이 없습니다시간 제한3초메모리 제한1024 MB

문제

Frograms, Inc. has been busy developing necklaces with brand-new design and feature. Every programmer working at Frograms now wears this necklace. A necklace consists of multiple beads stringed by a thread, as seen below. Each bead is given a number between 00 to 10910^9 (inclusive).

Most of the programmers have left for their summer vacation, and there is only a few programmers in the office today. So they decided to play a game using their own necklace to decide who will buy lunch for everyone. The rule is simple: for each pair of consecutive beads in the necklace, we take sum of their numbers. A programmer’s score is defined as the XOR(denoted as \oplus) of all those sums. The programmer with the lowest score loses! More formally, if there are NN beads and their value is denoted by A_1A\_1, A_2A\_2, \cdots, A_NA\_N in the order they are stringed together, then the score is:

(A_1A_2)+(A_2A_3)++(A_N1A_N)+(A_NA_1)(A\_1 \oplus A\_2) + (A\_2 \oplus A\_3) + \dots + (A\_{N-1} \oplus A\_N) +(A\_N \oplus A\_1)

However, you, the most talented programmer in Frograms, Inc., is going to cheat the game by removing zero or more beads to maximize the score. What is the maximum score if you are allowed to remove some of the beads in a given necklace? Note that you cannot reorder the beads, nor leave one or less beads in a necklace.

입력

The input consists of TT test cases. The first line of the input contains TT.

Each test case starts with a line containing a single integer NN (2N5002 ≤ N ≤ 500), the number of beads on your necklace. The next line contains NN integers A_1A\_1, A_2A\_2, \cdots, A_NA\_N, separated by a single space.

출력

For each test case, print the maximum score possible you can get in a single line.