#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int i = 1;
    int x = 1;
    while (((1 << i) - 1) <= n) {
      if (n % ((1 << i) - 1) == 0) {
        x = n / ((1 << i) - 1);
      }
      i++;
    }
    cout << x << endl;
  }
  return 0;
}
