#include <bits/stdc++.h>
using namespace std;
int main() {
  int t = 0;
  cin >> t;
  for (int i = 0; i < t; ++i) {
    int n = 0;
    cin >> n;
    int k = 2;
    while (true) {
      if (n % ((int)pow(2, k) - 1) == 0) {
        cout << n / ((int)pow(2, k) - 1) << "\n";
        break;
      } else {
        ++k;
      }
    }
  }
  return 0;
}
