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