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.util.*;
import java.io.*;

public class _713 {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        int t = sc.nextInt();
        int MAX = (int) 1e7 + 2;
        int [] min = new int[MAX];
        long [] sum = new long[MAX];
        linearSieve(MAX);
        min[1] = 1;
        sum[1] = 1;
        for (int i = 2; i < MAX; i++) {
            int cur = i;
            int prime = lp[i];
            long s = 1;
            long p = prime;
            while (cur % prime == 0) {
                s += p;
                cur /= prime;
                p *= prime;
            }
            sum[i] = (s) * (sum[cur]);
            if (sum[i] < MAX && min[(int) sum[i]] == 0) min[(int) sum[i]] = i;
        }
        while (t-- > 0) {
            int look = sc.nextInt();
            out.println(min[look] == 0 ? -1 : min[look]);
        }
        out.close();
    }

    static int [] lp;
    static ArrayList<Integer> primes;

    static void linearSieve(int sz) {
        lp = new int[sz + 1]; primes = new ArrayList<>();
        for (int i = 2; i <= sz; i++) {
            if (lp[i] == 0) {
                primes.add(i);
                lp[i] = i;
            }
            for (int j = 0; j < primes.size() && j < lp[i] && i * primes.get(j) <= sz; j++) {
                lp[primes.get(j) * i] = primes.get(j);
            }
        }
    }




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

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


    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }


    }

}