#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int z = 1;
    if (log2(n + 1) - (int)(log2(n + 1)) == 0) {
      cout << 1 << endl;
      continue;
    }
    for (int i = 2; i <= log2(n); i++) {
      double d = n / (pow(2, i) - 1);
      if (d - (int)d == 0) {
        cout << (int)d << endl;
        break;
      }
    }
  }
}
