#K42127. Unique Element Finder

    ID: 27019 Type: Default 1000ms 256MiB

Unique Element Finder

Unique Element Finder

Given an array of integers in which every element appears exactly twice except for one that appears only once, your task is to identify the unique element. The intended solution exploits the xor property:

\( a \oplus a = 0 \quad \text{and} \quad a \oplus 0 = a \)

You must read the input from stdin and write the output to stdout. Each test case starts with an integer \(N\) representing the size of the array, followed by a line containing \(N\) space-separated integers. For each test case, output the unique element on a separate line.

inputFormat

The first line contains an integer \(T\), the number of test cases. For each test case, the first line contains an integer \(N\), the size of the array, and the second line contains \(N\) space-separated integers.

outputFormat

For each test case, output a single line containing the unique element.

## sample
2
3
1 2 1
5
4 4 2 3 3
2

2

</p>