#include <bits/stdc++.h>
const long long mod = 1e9 + 7;
using namespace std;
void solve() {
  long long n;
  cin >> n;
  long long x;
  for (long long k = 2; k <= 35; ++k) {
    long long d = pow(2, k) - 1;
    if (n % d) continue;
    x = n / d;
    break;
  }
  cout << x << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
