#include <bits/stdc++.h>
using namespace std;
long long modpow(long long a, long long b, long long mod) {
  long long r = 1;
  while (b > 0) {
    if (b & 1) r = (r * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return r;
}
long long moduloMultiplication(long long a, long long b, long long mod) {
  long long res = 0;
  a %= mod;
  while (b) {
    if (b & 1) res = (res + a) % mod;
    a = (2 * a) % mod;
    b >>= 1;
  }
  return res;
}
int main() {
  long long i, j, k, l, m, n, t;
  cin >> t;
  while (t--) {
    cin >> n;
    int ans = 1 + 2;
    int s = 2;
    int f = 0;
    while (f == 0) {
      if (n % ans == 0) {
        f = 1;
        cout << n / ans << endl;
        break;
      } else {
        s = s * 2;
        ans += s;
      }
    }
  }
}
