#include <bits/stdc++.h>
using namespace std;
long int my_next(long int);
void init() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
int main() {
  int test;
  int k, sum, n;
  cin >> test;
  for (int t = 0; t < test; t++) {
    cin >> n;
    k = 1;
    sum = 1;
    while (1) {
      sum += pow(2, k);
      if (n % sum == 0) {
        cout << n / sum << "\n";
        break;
      }
      k++;
    }
  }
  return 0;
}
