#include <bits/stdc++.h>
using namespace std;
long long ans = 0, temp, min1 = 10000, r, x, l = 0, pos1 = 0, d, a = 0, pos = 0,
          b = 0, i, n, k = 0, m = 0, t, tot = 0, c = 0, s = 0, t1, c1 = 0,
          k4 = 0, c2 = 0, j = 0, k1 = 0, k2, k3 = 0;
char ch, ch1[2000];
string s1;
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> t;
  while (t--) {
    cin >> n;
    s = 1;
    for (i = 1;; i++) {
      s += (long long)(pow(2, i));
      if (n % s == 0) {
        cout << (n / s) << "\n";
        break;
      }
    }
  }
}
