#include <bits/stdc++.h>
using namespace std;
vector<long long> least_prime(1000001, 0);
void leastPrimeFactor(long long n) {
  least_prime[1] = 1;
  for (long long i = 2; i <= n; i++) {
    if (least_prime[i] == 0) {
      least_prime[i] = i;
      for (long long j = 2 * i; j <= n; j += i)
        if (least_prime[j] == 0) least_prime[j] = i;
    }
  }
}
long long mod = 1000000007;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  long long n = 0, k = 0;
  string s;
  map<char, long long> mc;
  map<long long, long long> ml;
  vector<long long> vl;
  vector<char> vc;
  while (t--) {
    cin >> n;
    long long ans = 1, i = 2;
    while (true) {
      long long num = pow(2, i) - 1;
      if (n % num == 0) {
        ans = n / num;
        break;
      }
      i++;
    }
    cout << ans << "\n";
  }
  return 0;
}
