#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, t;
  cin >> n;
  for (long long k = 2; k <= 32; k++) {
    if (n % ((1 << k) - 1) == 0) {
      t = n / ((1 << k) - 1);
      break;
    }
  }
  cout << t << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long t;
  cin >> t;
  while (t--) solve();
  return 0;
}
