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