#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  long long n, f, c;
  for (int i = 1; i <= t; i++) {
    cin >> n;
    f = 0;
    c = 2;
    for (int j = 3; j < n; j += c) {
      c *= 2;
      if (n % j == 0) {
        cout << n / j << endl;
        f = 1;
        break;
      }
    }
    if (f == 0) cout << "1" << endl;
  }
}
