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;
template <class T>
istream &operator>>(istream &is, vector<T> &a) {
  for (size_t i = 0; i < a.size(); ++i) is >> a[i];
  return is;
}
int binpow(int a, int n) {
  if (n == 0) return 1;
  if (n % 2 == 0) {
    int b = binpow(a, n / 2);
    return b * b;
  }
  return a * binpow(a, n - 1);
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int end = 1e7 / 3.0 * 2.0;
  vector<bool> prime(end + 1, true);
  vector<int> leftovers(end + 1);
  iota(leftovers.begin(), leftovers.end(), 0);
  prime[0] = prime[1] = false;
  vector<long long> o(end, 1);
  for (int i = 2; i <= end; ++i)
    if (prime[i])
      if (i * 1LL * i <= end)
        for (int j = i * i; j <= end; j += i) {
          int tmp = 0;
          while (leftovers[j] % i == 0) {
            leftovers[j] /= i;
            ++tmp;
          }
          long long cur = 0;
          for (int k = 0; k <= tmp; ++k) cur += binpow(i, k);
          o[j - 1] *= cur;
          prime[j] = false;
        }
  for (int i = 1; i <= end; ++i) {
    if (leftovers[i] > 1) {
      long long cur = 0;
      for (int k = 0; k <= 1; ++k) cur += binpow(leftovers[i], k);
      o[i - 1] *= cur;
    }
  }
  vector<pair<long long, int>> oo;
  for (int i = 0; i < end; ++i) oo.push_back({o[i], i + 1});
  sort(oo.begin(), oo.end());
  int t;
  cin >> t;
  while (t--) {
    long long c;
    cin >> c;
    auto it = lower_bound(oo.begin(), oo.end(), make_pair(c, 0));
    if (it != oo.end() && it->first == c)
      cout << it->second << "\n";
    else
      cout << "-1\n";
  }
}
