#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    long long int n, k = 2, f = 1, s, ans;
    cin >> n;
    while (f > 0) {
      s = pow(2, k) - 1;
      if (n % s == 0) {
        f = 0;
        ans = n / s;
      } else
        k++;
    }
    cout << ans << endl;
  }
}
