#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
long long int pow1(long long int first, long long int n, long long int m) {
  long long int result = 1;
  while (n > 0) {
    first %= m;
    if (n % 2 == 1) result = (result * first) % m;
    first = (first * first) % m;
    n = n / 2;
  }
  return result;
}
long long int pow2(long long int first, long long int n) {
  long long int result = 1;
  while (n > 0) {
    if (n % 2 == 1) result = (result * first);
    first = (first * first);
    n = n / 2;
  }
  return result;
}
long long int modInverse(long long int A, long long int M) {
  return pow1(A, M - 2, M);
}
long long int f[1000001];
void fact() {
  f[0] = f[1] = 1;
  for (int i = 2; i <= 1e6; i++) f[i] = (f[i - 1] * i) % mod;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
const int size = 1e6 + 1;
int minPrime[size + 1];
void pre() {
  int n = size;
  for (int i = 2; i * i <= n; ++i) {
    if (minPrime[i] == 0) {
      for (int j = i * i; j <= n; j += i) {
        if (minPrime[j] == 0) {
          minPrime[j] = i;
        }
      }
    }
  }
  for (int i = 2; i <= n; ++i) {
    if (minPrime[i] == 0) {
      minPrime[i] = i;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int a[n];
    vector<long long int> ac;
    for (int i = int(0); i < int(n); i++) {
      cin >> a[i];
      ac.push_back(a[i]);
    }
    sort(a, a + n);
    long long int first = a[n - 1] * a[0];
    long long int ans = first;
    long long int d = 0;
    vector<long long int> dc;
    for (long long int i = 1; i * i <= first; i++) {
      if (first % i == 0) d += 2;
      if (i * i == first) d--;
      if (i == 1 or first % i != 0)
        continue;
      else if (i * i == first)
        dc.push_back(i);
      else {
        dc.push_back(i);
        dc.push_back(first / i);
      }
    }
    sort(ac.begin(), ac.end());
    sort(dc.begin(), dc.end());
    bool m = false;
    if (ac == dc) m = true;
    if (n != d - 2 or !m)
      cout << "-1";
    else
      cout << ans;
    cout << "\n";
  }
  return 0;
}

### Prompt

Your task is to create a CPP solution to the following problem:

We guessed some integer number x. You are given a list of almost all its divisors. Almost all means that there are all divisors except 1 and x in the list.

Your task is to find the minimum possible integer x that can be the guessed number, or say that the input data is contradictory and it is impossible to find such number.

You have to answer t independent queries.

Input

The first line of the input contains one integer t (1 ≤ t ≤ 25) — the number of queries. Then t queries follow.

The first line of the query contains one integer n (1 ≤ n ≤ 300) — the number of divisors in the list.

The second line of the query contains n integers d_1, d_2, ..., d_n (2 ≤ d_i ≤ 10^6), where d_i is the i-th divisor of the guessed number. It is guaranteed that all values d_i are distinct.

Output

For each query print the answer to it.

If the input data in the query is contradictory and it is impossible to find such number x that the given list of divisors is the list of almost all its divisors, print -1. Otherwise print the minimum possible x.

Example

Input


2
8
8 2 12 6 4 24 16 3
1
2


Output


48
4

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
long long int pow1(long long int first, long long int n, long long int m) {
  long long int result = 1;
  while (n > 0) {
    first %= m;
    if (n % 2 == 1) result = (result * first) % m;
    first = (first * first) % m;
    n = n / 2;
  }
  return result;
}
long long int pow2(long long int first, long long int n) {
  long long int result = 1;
  while (n > 0) {
    if (n % 2 == 1) result = (result * first);
    first = (first * first);
    n = n / 2;
  }
  return result;
}
long long int modInverse(long long int A, long long int M) {
  return pow1(A, M - 2, M);
}
long long int f[1000001];
void fact() {
  f[0] = f[1] = 1;
  for (int i = 2; i <= 1e6; i++) f[i] = (f[i - 1] * i) % mod;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
const int size = 1e6 + 1;
int minPrime[size + 1];
void pre() {
  int n = size;
  for (int i = 2; i * i <= n; ++i) {
    if (minPrime[i] == 0) {
      for (int j = i * i; j <= n; j += i) {
        if (minPrime[j] == 0) {
          minPrime[j] = i;
        }
      }
    }
  }
  for (int i = 2; i <= n; ++i) {
    if (minPrime[i] == 0) {
      minPrime[i] = i;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int a[n];
    vector<long long int> ac;
    for (int i = int(0); i < int(n); i++) {
      cin >> a[i];
      ac.push_back(a[i]);
    }
    sort(a, a + n);
    long long int first = a[n - 1] * a[0];
    long long int ans = first;
    long long int d = 0;
    vector<long long int> dc;
    for (long long int i = 1; i * i <= first; i++) {
      if (first % i == 0) d += 2;
      if (i * i == first) d--;
      if (i == 1 or first % i != 0)
        continue;
      else if (i * i == first)
        dc.push_back(i);
      else {
        dc.push_back(i);
        dc.push_back(first / i);
      }
    }
    sort(ac.begin(), ac.end());
    sort(dc.begin(), dc.end());
    bool m = false;
    if (ac == dc) m = true;
    if (n != d - 2 or !m)
      cout << "-1";
    else
      cout << ans;
    cout << "\n";
  }
  return 0;
}

```