#include <bits/stdc++.h>
using namespace std;
void solve() {
  long int n, x, res = 1;
  cin >> n;
  if (n == 1) {
    cout << "1\n";
    return;
  }
  for (int k = 1; k <= 30; k++) {
    res += pow(2, k);
    if (n % res == 0) {
      cout << n / res << endl;
      return;
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int tc;
  cin >> tc;
  while (tc--) solve();
  return 0;
}
