#include <bits/stdc++.h>
using namespace std;
const long long MXN = 2e5 + 10;
long long q, n;
void solve() {
  cin >> n;
  for (int k = 2; k < 55; k++) {
    long long now = (1LL << k) - 1;
    if (n % now == 0) {
      cout << n / now << '\n';
      return;
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> q;
  while (q--) solve();
  return 0;
}
