#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vec;
const ll mod = 1000000007;
const ll mx = 1e6 + 2;
bool prime(ll x) {
  if (x < 2) return false;
  for (ll i = 2; i * i <= x; ++i) {
    if (x % i == 0) return false;
  }
  return true;
}
ll powerm(ll a, ll b, ll m = mod) {
  a %= m;
  ll res = 1 % m;
  while (b > 0) {
    if (b & 1) {
      res = (res * a) % m;
    }
    b >>= 1;
    a = (a * a) % m;
  }
  return res;
}
ll power(ll a, ll b) {
  ll res = 1;
  while (b > 0) {
    if (b & 1) {
      res = (res * a);
    }
    b >>= 1;
    a = (a * a);
  }
  return res;
}
ll mul(ll x, ll y) { return (x * 1ll * y); }
long double ncr(ll n, ll r) {
  if (n == 1 || r == 0) return 1;
  if (r > n / 2) r = n - r;
  long double ans = 1;
  for (ll i = 1; i <= r; i++) {
    ans *= ((long double)n / i);
    n--;
  }
  return ans;
}
int add(int a, int b) {
  a += b;
  if (a < 0) a += mod;
  if (a >= mod) a -= mod;
  return a;
}
int solve() {
  ll n;
  cin >> n;
  for (int i = 2; i <= 32; i++) {
    ll x = power(2, i) - 1;
    if (n % x == 0) {
      cout << n / x << endl;
      return 0;
    }
  }
  return 0;
}
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int q = 1;
  cin >> q;
  while (q--) solve();
}
