Codeforces Global Round 30 (Div. 1 + Div. 2)
B
Even Modulo Pair
Codeforces
1000
原题
← AC →
翻译中…

You are given a strictly increasing sequence of positive integers $a_1 \lt a_2 \lt \ldots \lt a_n$. Find two distinct elements $x$ and $y$ from the sequence such that $x \lt y$ and $y \bmod x$ is even, or determine that no such pair exists.

翻译中…

$p \bmod q$ denotes the remainder from dividing $p$ by $q$.

翻译中…

Input

翻译中…

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

翻译中…

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

翻译中…

The second line of each test case contains $n$ integers $a_1,a_2,\ldots,a_n$ ($1\le a_1 \lt \ldots \lt a_n\le 10^9$) — the given sequence.

翻译中…

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

翻译中…

Output

翻译中…

For each test case:

翻译中…
  • If no such pair exists, output -1.
  • Otherwise, output two integers $x$ and $y$ — the elements that satisfy the condition.
翻译中…

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

翻译中…

Note

翻译中…
翻译中…

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

翻译中…

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

翻译中…

样例

Input #1
4
5
1 3 4 5 6
6
2 3 5 7 11 13
4
2 3 13 37
3
17 117 1117
Output #1
3 5
3 11
-1
17 1117
InputCopy OutputCopy
题目信息
题号
2164B
时间限制
1 s
内存限制
256 MB
标签
暴力
数学
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。