#include <bits/stdc++.h>
using namespace std;
int t, n, x, k, p = 1;
int main() {
  cin >> t;
  for (int i = 1; i <= t; i++) {
    k = 1;
    p = 1;
    cin >> n;
    while (1) {
      p = 1;
      k++;
      for (int j = 1; j <= k; j++) p = 2 * p;
      if (n % (p - 1) == 0) {
        cout << n / (p - 1) << endl;
        break;
      }
    }
  }
  return 0;
}
