#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d, t, x;
  cin >> t;
  for (int i = 0; i < t; ++i) {
    cin >> n;
    d = 2;
    do {
      d = d * 2;
    } while (n % (d - 1) != 0);
    x = n / (d - 1);
    cout << x << '\n';
  }
  return 0;
}
