#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  long long divisor = 3;
  int k = 2;
  while (true) {
    if (n % divisor == 0) {
      cout << n / divisor << endl;
      break;
    }
    divisor = divisor + static_cast<long long>(pow(2, k++));
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int test;
  cin >> test;
  while (test--) {
    solve();
  }
  return 0;
}
