| MITIT Winter 2025-26 Beginner Round |
|---|
| Finished |
Busy Beaver has just learned about divisors and multiples in elementary school. Now, Busy Beaver challenges you with the following problem.
You are given a sequence $$$a$$$ of length $$$N$$$. Find any positive integer $$$X$$$ such that:
or determine that no such integer exists.
The first line contains a single integer $$$T$$$ ($$$1\leq T\leq 10^4$$$) — the number of test cases.
The first line of each test case contains an integer $$$N$$$ ($$$2\le N\le 3 \cdot 10^5$$$) — the length of the sequence $$$a$$$.
The second line of each test case contains $$$N$$$ integers $$$a_1, a_2, \dots, a_N$$$ ($$$1 \le a_i \le 10^9$$$).
The sum of $$$N$$$ across all test cases does not exceed $$$3 \cdot 10^5$$$.
For each test case, output a single integer — the value of $$$X$$$, or $$$-1$$$ if no such $$$X$$$ exists.
If there are multiple valid values for $$$X$$$, you may output any of them.
There are two subtasks for this problem.
6336 2 12610 20 30 40 50 6078 7 6 5 4 3 2610 6 1 90 2 15310 2 521 1
6 10 -1 30 10 1
In the first test case, $$$6$$$ is a divisor of $$$36$$$ and $$$12$$$, and is a multiple of $$$2$$$.
In the second test case, $$$10$$$ is a divisor of all elements, and also a multiple of $$$10$$$.
In the third test case, there is no integer that satisfies the constraints.
| Name |
|---|


