Problem: 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

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define eps 1e-8
#define pb push_back
#define fi first
#define se second
#define SZ(x) (int)x.size()
#define ALL(x) x.begin(), x.end()
#define db1(x) cout << #x << " = " << x << endl
#define db2(x, y) cout << #x << " = " << x << " " << #y << " = " << y << endl
#define gg cout << "---------QAQ--------\n"
#define MEM(a, b) memset(a, b, sizeof(a))

using namespace std;
typedef unsigned long long ull;
typedef long double ld;
typedef long long ll;
const int N = 1e7 + 10, M = 5100;
const int mod = 1e9 + 7;

int n, l, r, s;
int g[N], f[N], v[N], p[N];
int mi[N];
void pre() {
    int tot = 0;
  g[1] = f[1] = 1;
  n = N-2;
  for (int i = 2; i <= n; ++i) {
    if (!v[i]) v[i] = 1, p[++tot] = i, g[i] = i + 1, f[i] = i + 1;
    for (int j = 1; j <= tot && i <= n / p[j]; ++j) {
      v[p[j] * i] = 1;
      if (i % p[j] == 0) {
        g[i * p[j]] = g[i] * p[j] + 1;
        f[i * p[j]] = f[i] / g[i] * g[i * p[j]];
        break;
      } else {
        f[i * p[j]] = f[i] * f[p[j]];
        g[i * p[j]] = 1 + p[j];
      }
    }
  }
  //for (int i = 1; i <= n; ++i) f[i] = (f[i - 1] + f[i]);
  MEM(mi, 0x3f);
  for(int i = 1; i <= n; ++i)
  {
      if(f[i] > 10000000) continue;
        mi[f[i]] = min(mi[f[i]], i);
  }
}

void sol()
{
    scanf("%d", &n);
    if(mi[n] == INF) puts("-1");
    else printf("%d\n", mi[n]);
}
int main()
{
    pre();
    int _; scanf("%d", &_);  while (_--)
    sol();
    return 0;
}
/*

*/