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.
#include <bits/stdc++.h>
using namespace std;
long long modexp(long long x, long long n);
long long getFractionModulo(long long a, long long b);
long long power(long long x, long long y);
long long mpower(long long x, long long y, long long p);
bool isPrime(long long unsigned n);
long long const N = (long long)(1e5 + 1);
long long const mod = (long long)(1e9 + 7);
vector<long long> g[N];
long long visited[N] = {0};
long long parent[N] = {0};
long long a[N] = {0};
long long flag = 0;
vector<long long> no;
void dfs(long long v) {
  if (visited[v]) return;
  visited[v] = true;
  no.push_back(v);
  for (auto x : g[v]) {
    if (!visited[x]) {
      dfs(x);
    }
  }
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, b % a);
}
long long binomialCoeff(long long n, long long r) {
  if (r > n - r) r = n - r;
  long long C[r + 1];
  memset(C, 0, sizeof(C));
  C[0] = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = min(i, r); j > 0; j--) C[j] = (C[j] + C[j - 1]) % mod;
  }
  return C[r];
}
bool isPerfect(long long N) {
  if ((sqrt(N) - floor(sqrt(N))) != 0) return false;
  return true;
}
long long setBitNumber(long long n) {
  n |= n >> 1;
  n |= n >> 2;
  n |= n >> 4;
  n |= n >> 8;
  n |= n >> 16;
  n = n + 1;
  return (n >> 1);
}
long long myXOR(long long x, long long y) {
  long long res = 0;
  for (int i = 31; i >= 0; i--) {
    bool b1 = x & (1 << i);
    bool b2 = y & (1 << i);
    bool xoredBit = (b1 & b2) ? 0 : (b1 | b2);
    res <<= 1;
    res |= xoredBit;
  }
  return res;
}
long double squareRoot(long long number, long long precision) {
  long long start = 0, end = number;
  long long mid;
  long double ans;
  while (start <= end) {
    mid = (start + end) / 2;
    if (mid * mid == number) {
      ans = mid;
      break;
    }
    if (mid * mid < number) {
      start = mid + 1;
      ans = mid;
    } else {
      end = mid - 1;
    }
  }
  long double increment = 0.1;
  for (int i = 0; i < precision; i++) {
    while (ans * ans <= number) {
      ans += increment;
    }
    ans = ans - increment;
    increment = increment / 10;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t, i, l, h, r, x, y, z, d, f, s, k1, k2, c, a, w, b, m, n1,
      M = 1000000000;
  long long n, K;
  long long p, q, j, k;
  cin >> t;
  while (t--) {
    cin >> n;
    j = n;
    long long cnt = 0, ans = 1, f = 0;
    k = n;
    while (k > 0) {
      if (k % 2 == 0) {
        f = 1;
        break;
      }
      k = k / 2;
    }
    while (j > 0) {
      j /= 2;
      cnt++;
    }
    if (!f) {
      for (i = 2; i * i <= n; i++) {
        if (n % i == 0) {
          ans = max(ans, n / i);
          ans = max(ans, i);
        }
      }
      cout << ans << endl;
    } else {
      cout << (1 << cnt) - 1 << endl;
    }
  }
}
long long mpower(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long getFractionModulo(long long a, long long b) {
  long long c = gcd(a, b);
  a = a / c;
  b = b / c;
  long long d = modexp(b, mod - 2);
  long long ans = ((a % mod) * (d % mod)) % mod;
  return ans;
}
long long modexp(long long x, long long n) {
  if (n == 0) {
    return 1;
  } else if (n % 2 == 0) {
    return modexp((x * x) % mod, n / 2);
  } else {
    return (x * modexp((x * x) % mod, (n - 1) / 2) % mod);
  }
}
long long power(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = res * x;
    y = y >> 1;
    x = x * x;
  }
  return res;
}
bool isPrime(long long unsigned n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  long long unsigned p = sqrt(n);
  for (long long unsigned i = 5; i <= p; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
