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 JAVA):

Solution:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;



public class Codeforces {
	static int mod=1000_000_007;
	static int max=10000100;
	static int lpf[]=new int[max];
	static long sofd[]=new long[max];
	static long ans[]=new long[max];
	public static void main(String[] args) throws Exception {
		//PrintWriter out=new PrintWriter(System.out);
	    FastScanner fs=new FastScanner();
	    fill();
	    int t=fs.nextInt();
	    outer:while(t-->0) {
	    	int c=fs.nextInt();
	    	System.out.println(ans[c]);
	    }
	}
	static void fill() {
		lpf[1]=1;
		for(int i=2;i*i<max;i++) {
			if(lpf[i]==0) {
				lpf[i]=i;
				for(int j=i*i;j<max;j+=i) {
					if(lpf[j]==0)
					lpf[j]=i;
				}
			}
		}
		sofd[1]=1;
		for(int i=2;i<max;i++) {
			int j=i;
			if(lpf[j]==0) {
				lpf[i]=i;
				sofd[j]=j+1;
			}
			else {
				sofd[i]=1;
				while(j%lpf[i]==0) {
					j/=lpf[i];
					sofd[i]=sofd[i]*lpf[i]+1;
				}
				sofd[i]*=sofd[j];
			}
		}
		Arrays.fill(ans, -1);
		for(int i=max-1;i>0;i--) {
			if(sofd[i]<max) {
				ans[(int)sofd[i]]=i;
			}
		}
	}
	static void mysort(long[] a) {
		//suffle
		int n=a.length;
		Random r=new Random();
		for (int i=0; i<a.length; i++) {
			int oi=r.nextInt(n);
			long temp=a[i];
			a[i]=a[oi];
			a[oi]=temp;
		}
		
		//then sort
		Arrays.sort(a);
	}
	
	// Use this to input code since it is faster than a Scanner
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}
 
}