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
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class First {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.call(in,out);
        out.close();

    }

    static class TaskA {
        public void call(InputReader in, PrintWriter out) {
            int[] arr = new int[10000002];
            sieve(arr);
            long[] ans = new long[10000002];
            long[] ans1 = new long[10000002];

            ans[1] = 1;
            ans1[1] = 1;
            ans1[3] = 2;
            ans[2] = 3;
            ans1[4] =3;
            ans[3] = 4;
            int a;
            long b;
            int c, freq, d;
            for (int i = 4; i < ans.length; i++) {
                a = i;
                b = 1;
                c = 0;
                if(arr[a]==a){
                    ans[i] = i+1;
                    if(ans1[i+1]!=0){
                        ans1[i+1] = Math.min(i,ans1[i+1]);
                    }
                    else {
                        ans1[i + 1] = i;
                    }
                    continue;
                }

                while(a!=1){
                    d = arr[a];
                    freq = 0;
                    while(a%d==0){
                        c = d;
                        a/=d;
                        freq++;
                    }
                    b *= ans[c] + (power(c,2) *(power(c,freq-1) -1)) / (c-1);
                }
                ans[i] = b;
                if(b<10000002) {
                    if (ans1[(int) b]!=0) {
                        ans1[(int) b] = Math.min(ans1[(int) b], i);
                    }
                    else{
                        ans1[(int) b] = i;
                    }
                }

            }

            int t;
            t = in.nextInt();

            while (t > 0) {
                int n;
                n = in.nextInt();
                if(ans1[n]==0){
                    out.println(-1);
                }
                else{
                    out.println(ans1[n]);
                }
                t--;
            }
        }

        long power(int base , int pow){
            if(pow==0){
                return 1;
            }
            if(pow%2!=0){
                return base * power(base, pow - 1 );
            }
            else {
                return power(base*base , pow / 2 );
            }
        }

        public void sieve (int[] arr){
            Arrays.fill(arr,-1);

            for (int i = 2; i < arr.length; i++) {
                if(arr[i]==-1){

                    for (int j = i; j < arr.length; j+=i) {
                        if(arr[j]==-1){
                            arr[j] = i;
                        }
                    }
                }
            }

        }


    }

    static int gcd(int a, int b)
    {
        if (a == 0)
            return b;
        return gcd(b % a, a);
    }

    static int lcm(int a, int b)
    {
        return (a / gcd(a, b)) * b;
    }

    static class answer implements Comparable<answer>{
        int a;
        int b;

        public answer(int a, int b) {
            this.a = a;
            this.b = b;
        }

        @Override
        public int compareTo(answer o) {
            return o.a - this.a;
        }

        @Override
        public boolean equals(Object o){
            if(o instanceof answer){
                answer c = (answer)o;
                return a == c.a && b == c.b;
            }
            return false;
        }
    }

    static class answer1 implements Comparable<answer1>{
        int a, b, c;

        public answer1(int a, int b, int c) {
            this.a = a;
            this.b = b;
            this.c = c;

        }

        @Override
        public int compareTo(answer1 o) {
            if(o.c==this.c){
                return this.a - o.a;
            }
            return o.c - this.c;
        }
    }

    static long gcd(long a, long b)
    {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    static void sort(long[] a) {
        ArrayList<Long> l=new ArrayList<>();
        for (Long i:a) l.add(i);
        l.sort(Collections.reverseOrder());
        for (int i=0; i<a.length; i++) a[i]=l.get(i);
    }

    static final Random random=new Random();

    static void shuffleSort(int[] a) {
        int n=a.length;
        for (int i=0; i<n; i++) {
            int oi=random.nextInt(n), temp=a[oi];
            a[oi]=a[i]; a[i]=temp;
        }
        Arrays.sort(a);
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong(){
            return Long.parseLong(next());
        }
        public double nextDouble() {
            return Double.parseDouble(next());
        }

    }
}