We all know what Ashwin did, so in order to pay for his mistake Ashwin is asked to solve the following programming question.Given an array A of size N with elements A1,A2,A3,...,AN. You have to make all the elements of the array equal and lets call that value as magic number.
You are given the following spell -
Choose an index of the array and multiply the value at that index with any prime number.
This spell can be performed any number of times but you can only perform it once on a particular index.
After you have made all elements equal, output that magic number. If there are multiple magic numbers possible, print the smallest one.
If you cant find such a number, print −1.
You being Ashwin's friend is asked to solve the question for him.
Constraints -
1≤T≤101≤N≤2000001≤Ai≤109
Input Format -
First line contains a single T denoting the number of test cases. Then T test cases follow.
First line of each test case contains a single integer N denoting the number of elements in the array.
Second line of each test case contains N space separated integers A1,A2,A3,...,AN denoting the elements of the array.
Output Format -
Print the required answer of each test case in a new line.
For 1st test case :
2 can be multiplied by 3 (a prime number) and 3 can be multiplied by 2, hence the required magic number is 6.
For 2nd test case :
No such magic number could be found.