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 ll = long long;
using ld = long double;
using namespace std;
void debugi(vector<int>& vec) {
  int n = (int)vec.size();
  for (int i = 0; i < n; i++) {
    cout << vec[i] << " ";
  }
  cout << endl;
}
void debugd(vector<long double>& vec) {
  int n = (int)vec.size();
  for (int i = 0; i < n; i++) {
    cout << vec[i] << " ";
  }
  cout << endl;
}
void debugl(vector<ll>& vec) {
  int n = (int)vec.size();
  for (int i = 0; i < n; i++) {
    cout << vec[i] << " ";
  }
  cout << endl;
}
void debugmap(map<int, int>& mp) {
  for (auto x : mp) {
    cout << x.first << " " << x.second << " , ";
  }
  cout << endl;
}
void debugset(set<int>& st) {
  for (auto x : st) {
    cout << x << " ";
  }
  cout << endl;
}
void debugparri(vector<pair<int, int>>& arr) {
  for (int i = 0; i < (int)arr.size(); i++) {
    cout << "[" << arr[i].first << " : " << arr[i].second << "]"
         << " ";
  }
  cout << endl;
}
void debugpi(pair<int, int>& pi) {
  cout << pi.first << " " << pi.second << endl;
}
void debugq(queue<int> q) {
  while (!q.empty()) {
    cout << q.front() << " ";
    q.pop();
  }
  cout << endl;
}
bool check(int n, int i, int j) {
  if ((0 <= i & i < n) && (0 <= j & j < n)) {
    return true;
  }
  return false;
}
ll MOD = 1e9 + 7;
ll powab(ll a, ll b, ll mod) {
  if (b == 0) {
    return 1;
  }
  ll z = powab(a, b / 2, mod);
  ll res = (z * z * 1LL) % mod;
  if (b & 1) {
    res = (res * 1LL * a) % mod;
  }
  return res;
}
ll modinv(ll a, ll mod) {
  ll ans = powab(a, mod - 2, mod);
  return ans;
}
ll gcd(ll a, ll b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
void upd(int k, int x, vector<ll>& tree, int n) {
  if (k == 0) {
    return;
  }
  while (k <= n) {
    tree[k] += x;
    k += (k & -k);
  }
}
ll sum(int k, vector<ll>& tree, int n) {
  ll s = 0;
  while (k >= 1) {
    s += tree[k];
    k -= (k & -k);
  }
  return s;
}
ll mod = 1e9 + 7;
int lim = 200005;
int NAX = 10000007;
vector<int> res(NAX, -1);
vector<int> sp(10000007);
void fill() {
  int lim = 10000007;
  sp[0] = 1;
  sp[1] = 1;
  for (int i = 0; i < lim; i++) {
    sp[i] = i;
  }
  for (int i = 2; i < lim; i++) {
    if (sp[i] == i) {
      ll j = i * 1LL * i;
      while (j < lim) {
        if (sp[j] == j) {
          sp[j] = i;
        }
        j += i;
      }
    }
  }
}
void fill2() {
  for (int i = 1; i < lim; i++) {
    ll up = 1;
    int num = i;
    vector<int> cnts;
    while (num != 1) {
      ll mul = 1;
      int cnt = 0, div = sp[num];
      while (num % div == 0) {
        num /= div;
        cnt += 1;
      }
      for (int j = 0; j < cnt; j++) {
        mul = mul * 1LL * div;
      }
      cnts.push_back(div);
      mul = mul * 1LL * div;
      up = up * 1LL * (mul - 1);
    }
    for (auto x : cnts) {
      up /= (x - 1);
    }
    if (up >= NAX) {
      continue;
    }
    if (res[up] == -1) {
      res[up] = i;
    }
  }
}
void solve(int tt) {
  int c;
  cin >> c;
  cout << res[c] << endl;
  return;
}
int main(int argc, const char* argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  fill();
  fill2();
  cin >> t;
  for (int tt = 0; tt < t; tt++) {
    solve(tt);
  }
  return 0;
}
