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