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