A prime number is number x which has only divisors as 1 and x itself.
Harsh is playing a game with his friends, where his friends give him a few numbers claiming that they are divisors of some number x but divisor 1 and the number x itself are not being given as divisors.
You need to help harsh find which number's divisors are given here.
His friends can also give him wrong set of divisors as a trick question for which no number exists.
Simply, We are given the divisors of a number x ( divisors except 1 and x itself ) , you have to print the number if only it is possible.
You have to answer t queries.
(USE LONG LONG TO PREVENT OVERFLOW)

-----Input:-----
- First line is T queires.
- Next are T queries.
- First line is N ( No of divisors except 1 and the number itself )
- Next line has N integers or basically the divisors.

-----Output:-----
Print the minimum possible x which has such divisors and print -1 if not possible.

-----Constraints-----
- 1<= T <= 30
- 1<= N <= 350
- 2<= Di <=10^6

-----Sample Input:-----
3
2
2 3
2
4 2
3
12 3 2

-----Sample Output:-----
6
8
-1

-----EXPLANATION:-----
Query 1 : Divisors of 6 are ( 1,2,3,6) Therefore, Divisors except 1 and the number 6 itself are ( 2 , 3). Thus, ans = 6.
Query 2 : Divisors of 8 are ( 1,2,4,8) Therefore, Divisors except 1 and the number 8 itself are ( 2 , 4). Thus, ans = 8.
Query 3 : There is no such number x with only ( 1,2,3,12,x ) as the divisors.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = "# cook your dish here\nimport math\n \n \ndef findX(list, int):\n    # Sort the given array\n    list.sort()\n \n    # Get the possible X\n    x = list[0]*list[int-1]\n \n    # Container to store divisors\n    vec = []\n \n    # Find the divisors of x\n    i = 2\n    while(i * i <= x):\n        # Check if divisor\n        if(x % i == 0):\n            vec.append(i)\n            if ((x//i) != i):\n                vec.append(x//i)\n        i += 1\n \n    # sort the vec because a is sorted\n        # and we have to compare all the elements\n    vec.sort()\n    # if size of both vectors is not same\n    # then we are sure that both vectors\n    # can't be equal\n    if(len(vec) != int):\n        return -1\n    else:\n        # Check if a and vec have\n        # same elements in them\n        j = 0\n        for it in range(int):\n            if(list[j] != vec[it]):\n                return -1\n            else:\n                j += 1\n    return x\n \n \n# Driver code\ntry:\n    \n    m = int(input())\n    for i in range (m):\n        n = int(input())\n        x = list(map(int, input().split()))\n \n\n        print(findX(x, n))\nexcept EOFError as e: \n    print(e)\n"
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13207