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;
void __print(long long first) { cerr << first; }
void __print(long first) { cerr << first; }
void __print(unsigned first) { cerr << first; }
void __print(unsigned long first) { cerr << first; }
void __print(unsigned long long first) { cerr << first; }
void __print(float first) { cerr << first; }
void __print(double first) { cerr << first; }
void __print(long double first) { cerr << first; }
void __print(char first) { cerr << '\'' << first << '\''; }
void __print(const char *first) { cerr << '\"' << first << '\"'; }
void __print(const string &first) { cerr << '\"' << first << '\"'; }
void __print(bool first) { cerr << (first ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &first) {
  cerr << '{';
  __print(first.first);
  cerr << ',';
  __print(first.second);
  cerr << '}';
}
template <typename T>
void __print(const T &first) {
  long long f = 0;
  cerr << '{';
  for (auto &i : first) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
unordered_map<long long, long long> val;
unordered_set<long long> s;
const long long nax = 1e5 + 1;
vector<long long> v(nax, 0);
const long long nax2 = 1e7 + 2;
vector<long long> prime(nax2);
void prime_s() {
  for (long long i = 1; i < nax; i++) {
    v[i] = i;
    if (i != 1) v[i] += 1;
  }
  for (long long i = 2; i < nax; i++) {
    for (long long j = i * 2; j < nax; j += i) {
      v[j] += i;
    }
  }
  for (long long i = 1; i < nax; i++) {
    if (s.find(v[i]) == s.end()) {
      val[v[i]] = i;
      s.insert(v[i]);
    }
  }
}
void check_prime() {
  for (long long i = 1; i < nax2; i++) {
    prime[i] = i;
  }
  for (long long i = 2; i < nax2; i++) {
    if (prime[i] != i) continue;
    for (long long j = i * i; j < nax2; j += i) {
      prime[j] = -1;
    }
  }
}
void solve() {
  long long n;
  cin >> n;
  if (n == 1) {
    cout << 1 << "\n";
    return;
  }
  if (s.find(n) == s.end()) {
    if (prime[n - 1] == n - 1) {
      cout << n - 1 << "\n";
    } else {
      cout << -1 << "\n";
    }
  } else {
    cout << val[n] << "\n";
  }
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  prime_s();
  check_prime();
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
