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


public class Main {
    static StringBuffer str = new StringBuffer("");
    //    static Integer[][] tokens;
//    static HashMap<String , Integer> hashMap;
    static boolean[][] visited;
    public static void main(String[] args) throws IOException {
//        InputReader sc = new InputReader(System.in);
//        PrintWriter out = new PrintWriter(System.out);
        int C = 10000000;
        FastReader reader = new FastReader();
        int[] dp = new int[C + 1];
        int[] aa = new int[C + 1]; Arrays.fill(aa, -1);
        for (int a = 1; a < C + 1; a++){
            for (int b = a; b < C + 1; b+= a){
                dp[b] += a;
            }
            int c = dp[a];
            if (c <= C && aa[c] == -1){
                aa[c] = a;
            }
        }

        int test= reader.nextInt();
        for (int o = 1; o <= test; o++) {
            int c = reader.nextInt();
            System.out.println(aa[c]);

        }
        System.out.close();
    }

    static int func(int i)
    {
        if(i%2 == 0) return (i++);
        else return func(func(i-1));
    }
    public static boolean BiPartite(ArrayList<Node>[] adj, int n, int i, boolean[] visited, int[] colors){
        Queue<Integer> queue = new LinkedList<>();
        queue.add(i);
        int x = 1;
        colors[i] = 1;visited[i] = true;
        while (!queue.isEmpty()){
            Integer k = queue.poll();
            x= colors[k];
            for (Node l: adj[k]){
                if (!visited[l.v]){
                    visited[l.v] = true;
                    queue.add(l.u);
                    l.color = 3 - x;
                    colors[l.v] = 3 - x;
                }
                else if (visited[l.v]&& colors[l.v] == x) return false;
            }

        }
        return true;
    }
}
class Node{
    int u; int v; int w; int color;
    public Node(int u, int v, int w){
        this.u = u; this.v = v; this.w = w;
    }
}
class DSU{
    int[] rank;
    int[] parent;
    int[] arr;
    StringBuffer str = new StringBuffer();
    public DSU(int[] array){
        int n = array.length;
        this.arr = new int[n];
        rank = new int[n];
        parent = new int[n];
        for (int i = 0; i < n; i++){arr[i] = array[i];rank[i] = arr[i]; parent[i] = i;}
    }
    public int find(int x){
        if (parent[x] == x) return x;
        return find(parent[x]);
    }
    public void union(int x, int y){
        link(find(x), find(y));
    }
    public void link(int x, int y){
        if (x == y){
            str.append("Invalid query!");
            return ;
        }
        if (rank[x] > rank[y]){
            rank[x] = Math.max(rank[y], rank[x]);
            parent[y] = x;

        }
        else if (rank[y] > rank[x]){
            rank[y] = Math.max(rank[x], rank[y]);
            parent[x] = y;
        }
    }

}

class FastReader
{
    BufferedReader br;
    StringTokenizer st;

    public FastReader()
    {
        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;
    }
}

/** Class for buffered reading int and double values */
class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                    reader.readLine() );
        }
        return tokenizer.nextToken();
    }

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

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

class InputReader {
    private final int BUFFER_SIZE = 32768;
    private InputStream stream;
    private byte[] buffer = new byte[BUFFER_SIZE + 1];
    private int pointer = 1;
    private int readLength = 0;
    private int lastWhiteSpace = '\n';

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    private void fillBuffer() {
        try {
            readLength = stream.read(buffer, 1, BUFFER_SIZE);
        }
        catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    private byte get() {
        if (pointer > readLength) {
            pointer = 1;
            fillBuffer();
            if (readLength <= 0) return -1;
        }
        return buffer[pointer++];
    }

    private byte peek() {
        if (pointer > readLength) {
            pointer = 1;
            fillBuffer();
            if (readLength <= 0) return -1;
        }
        return buffer[pointer];
    }

    public boolean hasNext() {
        int c;
        while (isWhiteSpace(c = peek()) && c != -1) {
            get();
        }
        return c != -1;
    }

    public char nextChar() {
        int c = get();

        while (isWhiteSpace(c)) {
            c = get();
        }

        return (char) c;
    }

    public int nextInt() {
        int c = nextChar();
        int sign = 1;

        if (c == '-') {
            sign = -1;
            c = get();
        }

        int abs = 0;

        do {
            if (c < '0' || c > '9') throw new InputMismatchException();
            abs *= 10;
            abs += c - '0';
            c = get();
        } while (!isWhiteSpace(c));

        lastWhiteSpace = c;

        return abs * sign;
    }

    public long nextLong() {
        int c = nextChar();
        long sign = 1;

        if (c == '-') {
            sign = -1;
            c = get();
        }

        long abs = 0;

        do {
            if (c < '0' || c > '9') throw new InputMismatchException();
            abs *= 10;
            abs += c - '0';
            c = get();
        } while (!isWhiteSpace(c));

        lastWhiteSpace = c;

        return abs * sign;
    }

    public double nextDouble() {
        int c = nextChar();
        int sign = 1;

        if (c == '-') {
            sign = -1;
            c = get();
        }

        double abs = 0;

        do {
            abs = (c - '0') + abs * 10;
        } while (!isWhiteSpace(c) && c != '.');

        if (c == '.') {
            int m = 1;

            do {
                abs = abs + (c - '0') * m;
                m /= 10;
            } while (!isWhiteSpace(c));
        }

        return abs * sign;
    }

    public String nextString() {
        int c = nextChar();

        if (c == -1) return null;

        StringBuilder builder = new StringBuilder();

        do {
            builder.append((char) c);
            c = get();
        } while (!isWhiteSpace(c));

        return builder.toString();
    }

    public String next() {
        return nextString();
    }

    public String nextLine() {
        if (lastWhiteSpace != '\r' && lastWhiteSpace != '\n') throw new InputMismatchException();

        int c = get();

        if (lastWhiteSpace == '\r') {
            if (c == '\n') {
                lastWhiteSpace = '\n';
                c = get();
            }
            else {
                --pointer;
            }
        }

        if (c == -1 || c == '\r' || c == '\n') return null; // empty line

        StringBuilder builder = new StringBuilder();

        do {
            builder.append(c);
            c = get();
        } while (c != '\r' && c != '\n');

        return builder.toString();
    }

    public boolean isWhiteSpace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }
}