CF2164B.Even Modulo Pair

传统题 时间 2000 ms 内存 256 MiB 5 尝试 1 已通过 1 标签

Even Modulo Pair

You are given a strictly increasing sequence of positive integers a1<a2<<ana_1 \lt a_2 \lt \ldots \lt a_n. Find two distinct elements xx and yy from the sequence such that x<yx \lt y and ymodxy \bmod x is even, or determine that no such pair exists.

pmodqp \bmod q denotes the remainder from dividing pp by qq.

Input

Each test contains multiple test cases. The first line contains the number of test cases tt (1t21041 \le t \le 2\cdot 10^4). The description of the test cases follows.

The first line of each test case contains one integer nn (2n1052 \le n \le 10^5) — the length of the sequence.

The second line of each test case contains nn integers a1,a2,,ana_1,a_2,\ldots,a_n (1a1<<an1091\le a_1 \lt \ldots \lt a_n\le 10^9) — the given sequence.

It is guaranteed that the sum of nn over all test cases does not exceed 10510^5.

Output

For each test case:

  • If no such pair exists, output -1.
  • Otherwise, output two integers xx and yy — the elements that satisfy the condition.

If there are multiple valid pairs, you may output any of them.

Note

Visualizer link

In the first test case, choosing x=3x = 3 and y=5y = 5 yields ymodx=5mod3=2y \bmod x = 5 \bmod 3 = 2, which is even.

In the third test case, it is clear that no valid pair exists.

Samples

4
5
1 3 4 5 6
6
2 3 5 7 11 13
4
2 3 13 37
3
17 117 1117
3 5
3 11
-1
17 1117

在线编程 IDE

建议全屏模式获得最佳体验