#K82402. Unique Integer Finder

    ID: 35967 Type: Default 1000ms 256MiB

Unique Integer Finder

Unique Integer Finder

Given an integer array of length \(3n+1\) where every element appears exactly three times except for one element which appears exactly once, your task is to find that unique element.

The input consists of \(T\) test cases. Each test case starts with an integer \(n\), followed by \(3n+1\) space-separated integers. In each test case, it is guaranteed that exactly one integer appears once while all others appear three times.

You need to process the input from stdin and output the answer for each test case on a new line in stdout.

inputFormat

The first line contains a single integer \(T\) representing the number of test cases. Each test case is described in two lines:

  • The first line contains an integer \(n\).
  • The second line contains \(3n+1\) space-separated integers. In these, every integer appears exactly three times except for one unique integer which appears once.

All input should be read from stdin.

outputFormat

For each test case, output the unique integer on a new line. The output should be written to stdout.

## sample
1
3
5 5 5 7 7 7 4 4 4 3
3

</p>