#include <bits/stdc++.h>
using namespace std;
int main() {
  int test;
  cin >> test;
  for (int t = 0; t < test; t++) {
    int n;
    cin >> n;
    int k = 2;
    while (n % (int)(pow(2, k) - 1) != 0) {
      k++;
    }
    int ans = n / (pow(2, k) - 1);
    cout << ans << endl;
  }
  return 0;
}
