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