Can the greatest common divisor and bitwise operations have anything in common? It is time to answer this question.

Suppose you are given a positive integer a. You want to choose some integer b from 1 to a - 1 inclusive in such a way that the [greatest common divisor (GCD)](https://en.wikipedia.org/wiki/Greatest_common_divisor) of integers a ⊕ b and a \> \& \> b is as large as possible. In other words, you'd like to compute the following function:

$$$f(a) = max_{0 < b < a}{gcd(a ⊕ b, a \> \& \> b)}.$$$

Here ⊕ denotes the [bitwise XOR operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR), and \& denotes the [bitwise AND operation](https://en.wikipedia.org/wiki/Bitwise_operation#AND).

The greatest common divisor of two integers x and y is the largest integer g such that both x and y are divided by g without remainder.

You are given q integers a_1, a_2, …, a_q. For each of these integers compute the largest possible value of the greatest common divisor (when b is chosen optimally). 

Input

The first line contains an integer q (1 ≤ q ≤ 10^3) — the number of integers you need to compute the answer for.

After that q integers are given, one per line: a_1, a_2, …, a_q (2 ≤ a_i ≤ 2^{25} - 1) — the integers you need to compute the answer for. 

Output

For each integer, print the answer in the same order as the integers are given in input.

Example

Input


3
2
3
5


Output


3
1
7

Note

For the first integer the optimal choice is b = 1, then a ⊕ b = 3, a \> \& \> b = 0, and the greatest common divisor of 3 and 0 is 3.

For the second integer one optimal choice is b = 2, then a ⊕ b = 1, a \> \& \> b = 2, and the greatest common divisor of 1 and 2 is 1.

For the third integer the optimal choice is b = 2, then a ⊕ b = 7, a \> \& \> b = 0, and the greatest common divisor of 7 and 0 is 7.
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;
import static java.lang.Math.abs;
import static java.lang.Math.min;
import static java.lang.Math.max;
import static java.lang.Math.sqrt;
import static java.lang.Integer.signum;

@SuppressWarnings("unchecked")
public class P1110C {

  public void run() throws Exception {
    Map<Integer, Integer> m = new HashMap(24);
    m.put(3, 1); m.put(7, 1); m.put(15, 5); m.put(31, 1); m.put(63, 21); m.put(127, 1); m.put(255, 85); m.put(511, 73);
    m.put(1023, 341); m.put(2047, 89); m.put(4095, 1365); m.put(8191, 1); m.put(16383, 5461); m.put(32767, 4681);
    m.put(65535, 21845); m.put(131071, 1); m.put(262143, 87381); m.put(524287, 1); m.put(1048575, 349525);
    m.put(2097151, 299593); m.put(4194303, 1398101); m.put(8388607, 178481);
    m.put(16777215, 5592405); m.put(33554431, 1082401);

    for (int q = nextInt(); q > 0; q--) {
      int a = nextInt();
      println(m.containsKey(a) ? (int)m.get(a) : ((Integer.highestOneBit(a) << 1) - 1));
    }
  }

  public static void main(String... args) throws Exception {
    br = new BufferedReader(new InputStreamReader(System.in));
    pw = new PrintWriter(new BufferedOutputStream(System.out));
    new P1110C().run();
    br.close();
    pw.close();
    System.err.println("\n[Time : " + (System.currentTimeMillis() - startTime) + " ms]");
  }

  static long startTime = System.currentTimeMillis();
  static BufferedReader br;
  static PrintWriter pw;
  StringTokenizer stok;

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

  void print(byte b) { print("" + b); }
  void print(int i) { print("" + i); }
  void print(long l) { print("" + l); }
  void print(double d) { print("" + d); }
  void print(char c) { print("" + c); }
  void print(Object o) {
    if (o instanceof int[]) { print(Arrays.toString((int [])o));
    } else if (o instanceof long[]) { print(Arrays.toString((long [])o));
    } else if (o instanceof char[]) { print(Arrays.toString((char [])o));
    } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));
    } else if (o instanceof short[]) { print(Arrays.toString((short [])o));
    } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));
    } else if (o instanceof float[]) { print(Arrays.toString((float [])o));
    } else if (o instanceof double[]) { print(Arrays.toString((double [])o));
    } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));
    } else { print("" + o); }
  }
  void print(String s) { pw.print(s); }
  void println() { println(""); }
  void println(byte b) { println("" + b); }
  void println(int i) { println("" + i); }
  void println(long l) { println("" + l); }
  void println(double d) { println("" + d); }
  void println(char c) { println("" + c); }
  void println(Object o) { print(o); println(); }
  void println(String s) { pw.println(s); }
  int nextInt() throws IOException { return Integer.parseInt(nextToken()); }
  long nextLong() throws IOException { return Long.parseLong(nextToken()); }
  double nextDouble() throws IOException { return Double.parseDouble(nextToken()); }
  char nextChar() throws IOException { return (char) (br.read()); }
  String next() throws IOException { return nextToken(); }
  String nextLine() throws IOException { return br.readLine(); }
  int [] readInt(int size) throws IOException {
    int [] array = new int [size];
    for (int i = 0; i < size; i++) { array[i] = nextInt(); }
    return array;
  }
  long [] readLong(int size) throws IOException {
    long [] array = new long [size];
    for (int i = 0; i < size; i++) { array[i] = nextLong(); }
    return array;
  }
  double [] readDouble(int size) throws IOException {
    double [] array = new double [size];
    for (int i = 0; i < size; i++) { array[i] = nextDouble(); }
    return array;
  }
  String [] readLines(int size) throws IOException {
    String [] array = new String [size];
    for (int i = 0; i < size; i++) { array[i] = nextLine(); }
    return array;
  }

  int gcd(int a, int b) {
    if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);
    a = Math.abs(a); b = Math.abs(b);
    int az = Integer.numberOfTrailingZeros(a), bz = Integer.numberOfTrailingZeros(b);
    a >>>= az; b >>>= bz;
    while (a != b) {
      if (a > b) { a -= b; a >>>= Integer.numberOfTrailingZeros(a); }
            else { b -= a; b >>>= Integer.numberOfTrailingZeros(b); }
    }
    return (a << Math.min(az, bz));
  }

  long gcd(long a, long b) {
    if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);
    a = Math.abs(a); b = Math.abs(b);
    int az = Long.numberOfTrailingZeros(a), bz = Long.numberOfTrailingZeros(b);
    a >>>= az; b >>>= bz;
    while (a != b) {
      if (a > b) { a -= b; a >>>= Long.numberOfTrailingZeros(a); }
            else { b -= a; b >>>= Long.numberOfTrailingZeros(b); }
    }
    return (a << Math.min(az, bz));
  }

  void shuffle(int [] a) {
    Random r = new Random();
    for (int i = a.length - 1; i >= 0; i--) {
      int j = r.nextInt(a.length);
      int t = a[i]; a[i] = a[j]; a[j] = t;
    }
  }

  void shuffle(long [] a) {
    Random r = new Random();
    for (int i = a.length - 1; i >= 0; i--) {
      int j = r.nextInt(a.length);
      long t = a[i]; a[i] = a[j]; a[j] = t;
    }
  }

  void shuffle(Object [] a) {
    Random r = new Random();
    for (int i = a.length - 1; i >= 0; i--) {
      int j = r.nextInt(a.length);
      Object t = a[i]; a[i] = a[j]; a[j] = t;
    }
  }

  void flush() {
    pw.flush();
  }

  void pause() {
    flush();
    System.console().readLine();
  }
}