#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int p = 3;
    while (n % p != 0) {
      p = (p + 1) * 2;
      p--;
    }
    cout << n / p << endl;
  }
}
