#include <bits/stdc++.h>
using namespace std;
int main() {
  int t = 0, n = 0;
  cin >> t;
  long long a = 0;
  for (int q = 0; q < t; q++) {
    cin >> n;
    a = 1;
    for (int i = 1; i <= n; i++) {
      a += (long long)pow(2, i);
      if (n % a == 0) {
        cout << n / a << endl;
        break;
      }
    }
  }
  return 0;
}
