#include <bits/stdc++.h>
using namespace std;
void sampleCase() {
  long long int i, j, k, d, limit, temp, loop, sum;
  cin >> limit;
  d = 0;
  sum = 0;
  for (i = 1; i < 100; i++) {
    loop = pow(2, (i - 1));
    sum = sum + (loop);
    if (d) {
      if (limit % sum == 0) {
        cout << limit / sum;
        goto z;
      }
    }
    d = 1;
  }
z:
  cout << "";
}
int main() {
  int i, testcase;
  cin >> testcase;
  for (i = 0; i < testcase; i++) {
    sampleCase();
    cout << endl;
  }
  return 0;
}
