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>
using namespace std;
#define int long long
#define F first
#define S second
#define pii pair<int, int>
#define vi vector<int>
#define vb vector<bool>
#define vii vector<pii>
#define vvi vector<vector<int>>
#define P_B push_back
#define M_P make_pair
#define endl "\n"

#define MOD 1000000007
#define pi 3.141592653589793238


// void file_io()
// {
//     freopen("input.txt","r",stdin);
//     freopen("output.txt","w",stdout);
// }


const int N = 1e7 + 5;

vi min_factor(N, -1);
vi answer(N, -1);
vi sum(N, -1);


void primeFactorize() {

	min_factor[1] = 1;
	sum[1] = 1;

	for (int i = 2; i*i < N; i++) {

		if(min_factor[i] != -1) continue;
		min_factor[i] = i;
		for (int j = i*i; j < N; j += i) {
			if(min_factor[j] != -1) continue;
			min_factor[j] = i;
		}
	}

	for (int i = 2; i < N; i++) {

		if(min_factor[i] == -1) {

			sum[i] = i+1;
			min_factor[i] = i;

		} else {

			int x = i;
			sum[i] = 1;
			while(x%min_factor[i] == 0) {

				sum[i] = sum[i]*min_factor[i] + 1;
				x /= min_factor[i]; 
			}

			sum[i] = sum[i]*sum[x];

		}
	}


	for (int i = N-1; i >= 1; i--) {

		if(sum[i] < N) answer[sum[i]] = i;
	}
		
}

int32_t main() {
    
    // file_io();
    
    primeFactorize();

    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);


    int T; cin>>T; while(T--) 
    {
        
    	int n;
    	cin >> n;

    	cout << answer[n] << endl;

    }    
    
    return 0;
}