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