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