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.*;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;

@SuppressWarnings("DuplicatedCode")
public class Main {
    static PrintWriter pw;
    static _Scanner sc;

    public static void main(String[] args) throws Exception {
        sc = new _Scanner(System.in);
        pw = new PrintWriter(System.out);
        //long startTime = System.currentTimeMillis();

//        int tmp = 0;
//        for (int i = 1; i <= 3900; ++i) {
//            if (3900 % i == 0) {
//                tmp += i;
//            }
//        }
//        System.out.println(tmp);

        init();

        int t = sc.nextInt();
        while (t-- > 0) {
            solve();
        }
        pw.flush();
        //System.out.println("time: " + (System.currentTimeMillis() - startTime));
    }

    static int[] d;
    static int[] ans;
    static int MAX = 10_000_000;
    private static void init() {
        d = new int[MAX + 1];
        d[0] = 0;

        ans = new int[MAX + 1];

        for (int i = 1; i <= MAX; ++i) {
            for (int j = i; j < MAX; j += i) {
                if (d[j] < MAX) {
                    d[j] += i;
                }
            }
        }

        for (int i = 0; i < MAX; ++i) {
            int c = d[i];
            if (c <= MAX) {
                if (ans[c] == 0 || i < ans[c]) {
                    ans[c] = i;
                }
            }
        }
    }

    private static void solve() throws Exception {
        int c = sc.nextInt();
        int n = ans[c];
        if (n != 0) {
            pw.println(n);
        } else {
            pw.println(-1);
        }
    }

    static class Shuffle {
        static void run(int[] in) {
            for (int i = 0; i < in.length; i++) {
                int idx = (int) (Math.random() * in.length);
                int tmp = in[i];
                in[i] = in[idx];
                in[idx] = tmp;
            }
        }

        static void run(long[] in) {
            for (int i = 0; i < in.length; i++) {
                int idx = (int) (Math.random() * in.length);
                long tmp = in[i];
                in[i] = in[idx];
                in[idx] = tmp;
            }
        }

        static <T> void run(List<T> in) {
            for (int i = 0; i < in.size(); i++) {
                int idx = (int) (Math.random() * in.size());
                T tmp = in.get(i);
                in.set(i, in.get(idx));
                in.set(idx, tmp);
            }
        }
    }

    static class _Scanner {
        StringTokenizer st;
        BufferedReader br;

        _Scanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }

        _Scanner(String file) throws Exception {
            br = new BufferedReader(new FileReader(file));
        }

        String nextToken() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        int[] intArr(int n) throws IOException {
            int[] in = new int[n];
            for (int i = 0; i < n; i++) in[i] = nextInt();
            return in;
        }

        long[] longArr(int n) throws IOException {
            long[] in = new long[n];
            for (int i = 0; i < n; i++) in[i] = nextLong();
            return in;
        }

        int[] intArrSorted(int n) throws IOException {
            int[] in = new int[n];
            for (int i = 0; i < n; i++) in[i] = nextInt();
            Shuffle.run(in);
            Arrays.sort(in);
            return in;
        }

        long[] longArrSorted(int n) throws IOException {
            long[] in = new long[n];
            for (int i = 0; i < n; i++) in[i] = nextLong();
            Shuffle.run(in);
            Arrays.sort(in);
            return in;
        }

        Integer[] IntegerArr(int n) throws IOException {
            Integer[] in = new Integer[n];
            for (int i = 0; i < n; i++) in[i] = nextInt();
            return in;
        }

        Long[] LongArr(int n) throws IOException {
            Long[] in = new Long[n];
            for (int i = 0; i < n; i++) in[i] = nextLong();
            return in;
        }

        String nextLine() throws IOException {
            return br.readLine();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(nextToken());
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(nextToken());
        }

        char nextChar() throws IOException {
            return nextToken().charAt(0);
        }

        long nextLong() throws IOException {
            return Long.parseLong(nextToken());
        }

        boolean ready() throws IOException {
            return br.ready();
        }
    }
}
