#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long t, n;
long long quickpower(int a, int b) {
  long long res = 1;
  while (b) {
    if (b % 2 == 1) res *= a;
    a *= a;
    b >>= 1;
  }
  return res;
}
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    long long r = 0;
    for (int i = 2;; i++) {
      r = quickpower(2, i) - 1;
      if (n % r == 0) {
        cout << n / r << endl;
        break;
      }
    }
  }
  return 0;
}
