#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int m = n + 1;
    if ((m & (m - 1)) == 0) {
      cout << 1 << endl;
      continue;
    }
    for (int i = 2; i <= sqrt(n); i++) {
      if (n % i == 0) {
        int k = i + 1;
        if ((k & (k - 1)) == 0) {
          cout << n / i << endl;
          break;
        }
        k = n / i + 1;
        if ((k & (k - 1)) == 0) {
          cout << i << endl;
          break;
        }
      }
    }
  }
}
