#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    for (long long k = 2; k <= 40; ++k) {
      long long pw = pow(2, k);
      if (n % (pw - 1))
        continue;
      else {
        cout << n / (pw - 1) << '\n';
        break;
      }
    }
  }
  return 0;
}
