Let us denote by d(n) the sum of all divisors of the number n, i.e. d(n) = ∑_{k | n} k.

For example, d(1) = 1, d(4) = 1+2+4=7, d(6) = 1+2+3+6=12.

For a given number c, find the minimum n such that d(n) = c.

Input

The first line contains one integer t (1 ≤ t ≤ 10^4). Then t test cases follow.

Each test case is characterized by one integer c (1 ≤ c ≤ 10^7).

Output

For each test case, output: 

  * "-1" if there is no such n that d(n) = c; 
  * n, otherwise. 

Example

Input


12
1
2
3
4
5
6
7
8
9
10
39
691


Output


1
-1
2
3
-1
5
4
7
-1
-1
18
-1
#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000000;
long long mod = 1000000007LL;
long long mod2 = 998244353LL;
int t, n, c;
bool pm[7000002];
int sum[7000002];
int pm2[7000002];
int main() {
  memset(pm, false, sizeof(pm));
  for (int i = 2; i * i < 7000002; ++i) {
    if (!pm[i]) {
      pm2[i] = i;
      for (int j = i * i; j < 7000002; j += i) {
        pm[j] = true;
        pm2[j] = i;
      }
    }
  }
  memset(sum, 0, sizeof(sum));
  int mv = 0;
  vector<pair<long long, int>> rk;
  rk.clear();
  for (int i = 1; i < 7000002; ++i) {
    if (i == 1) {
      sum[1] = 1;
      rk.push_back(make_pair(1, i));
      continue;
    }
    if (!pm[i]) pm2[i] = i;
    int p = pm2[i];
    int sum2 = 0;
    int cur = 1;
    sum2 += cur;
    int x = i;
    while (x % p == 0) {
      cur *= p;
      sum2 += cur;
      x /= p;
    }
    sum[i] = sum[x] * sum2;
    rk.push_back(make_pair(sum[i], i));
  }
  sort(rk.begin(), rk.end());
  cin >> t;
  for (int cas = 1; cas <= t; ++cas) {
    scanf("%d", &c);
    int l = 0, r = rk.size();
    while (l < r) {
      int mid = (l + r) / 2;
      if (rk[mid].first >= c) {
        r = mid;
      } else {
        l = mid + 1;
      }
    }
    if (r == rk.size()) {
      puts("-1");
    } else {
      if (rk[r].first == c) {
        printf("%d\n", rk[r].second);
      } else {
        puts("-1");
      }
    }
  }
  return 0;
}
