시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB71413665.455%

문제

You had an array $a$. After that, you calculated bitwise ANDs of all subarrays of the original array. Formally, you calculated all numbers of the form $a_i$ AND $a_{i + 1}$ AND $\ldots$ AND $a_j$ for $1 \le i \le j \le \mathrm{length}(a)$.

You remember the resulting set of all these numbers: a number lies in this set if and only if it can be represented as bitwise AND of at least one subarray. Sadly, you forgot the original array.

Find any array $a$ which would produce the given set of ANDs on subarrays, or determine that there is no such array.

입력

The first line contains a single integer $t$ ($1 \le t \le 10^5$), the number of test cases.

The first line of each test case contains a single integer $n$ ($1 \le n \le 10^5$), the size of the given set.

The second line of each test case contains $n$ integers $b_1, b_2, \ldots, b_n$ ($0 \le b_i \le 2^{20} - 1$), the elements of the set. It is guaranteed that all elements are distinct.

It is guaranteed that the sum of $n$ over all test cases does not exceed $10^5$.

출력

For each test case, if there is no such array, output $-1$.

Otherwise, on the first line, output the size of the original array $k$ ($1 \le k \le 5n$).

On the next line, output $k$ integers $a_1, a_2, \ldots, a_k$ ($0 \le a_i \le 2^{20} - 1$), the elements of the array.

If there are several possible answers, print any one of them.

It can be shown that, if there is at least one array, then there is an array which satisfies these conditions.

예제 입력 1

3
1
5
3
0 1 2
2
1 2

예제 출력 1

3
5 5 5
3
1 0 2
-1

힌트

Note that the elements of the array that you output don't have to be distinct.