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.*;
 
public class Solution extends PrintWriter {

    private void solve(){
        pre();
        int T = sc.nextInt();
        for(int tc = 1; tc <= T; tc++){
            test_case();
        }
        
    }
    
    int MX = 10_000_000;
    boolean[] prime;
    int[] divisor;
    int[] sum_divisors;
    int[] ans;
    
    void pre() {
        prime = new boolean[MX+1];
        divisor = new int[MX+1];
        ans = new int[MX+1];
        sum_divisors = new int[MX+1];
        Arrays.fill(prime, true);
        for(int i = 2; i * i <= MX; i++) {
            if(prime[i]) {
                for(int j = 2 * i; j <= MX; j += i) {
                    prime[j] = false;
                    divisor[j] = i;
                }
            }
        }
        for(int i = 2; i <= MX; i++) {
            if(prime[i]) divisor[i] = i;
        }
        
        sum_divisors[1] = 1;
        for(int i = 2; i <= MX; i++) {
            int div = divisor[i];
            int ii = i;
            int pow = 1;
            int prod = pow;
            while(ii % div == 0) {
                ii /= div;
                pow *= div;
                prod += pow;
            }
            sum_divisors[i] = sum_divisors[ii] * prod;            
        }
        Arrays.fill(ans, -1);
        for(int i = MX; i >= 1; i--) {
            if(sum_divisors[i] > MX) continue;
            ans[sum_divisors[i]] = i;
        }
    }
    
    void test_case(){
        int c = sc.nextInt();
        println(ans[c]);
    }
    
    
//  Solution() throws FileNotFoundException { super(new File("test_output.txt")); }
//  InputReader sc = new InputReader(new FileInputStream("ts3_input.txt"));
  Solution() { super(System.out); }
  InputReader sc = new InputReader(System.in);
  static class InputReader {
      InputReader(InputStream in) { this.in = in; } InputStream in;
      
      private byte[] buf = new byte[16384];
      private int    curChar;
      private int    numChars;
      
 
      public int read() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = in.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }
 
      public String nextLine() {
          int c = read();
          while (isSpaceChar(c))
              c = read();
          StringBuilder res = new StringBuilder();
          do {
              res.appendCodePoint(c);
              c = read();
          } while (!isEndOfLine(c));
          return res.toString();
      }
 
      public String nextString() {
          int c = read();
          while (isSpaceChar(c))
              c = read();
          StringBuilder res = new StringBuilder();
          do {
              res.appendCodePoint(c);
              c = read();
          } while (!isSpaceChar(c));
          return res.toString();
      }
 
      public long nextLong() {
          int c = read();
          while (isSpaceChar(c))
              c = read();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = read();
          }
          long res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = read();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
 
      public int nextInt() {
          int c = read();
          while (isSpaceChar(c))
              c = read();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = read();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = read();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
 
      private boolean isSpaceChar(int c) {
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
 
      private boolean isEndOfLine(int c) {
          return c == '\n' || c == '\r' || c == -1;
      }
  }
 
    public static void main(String[] $) {
        new Thread(null, new Runnable() {
            public void run() {
                long start = System.nanoTime();
                try {Solution solution = new Solution(); solution.solve(); solution.flush();} 
                catch (Exception e) {e.printStackTrace(); System.exit(1);}
                System.err.println((System.nanoTime()-start)/1E9);
            }
        }, "1", 1 << 27).start();
 
    }
}