#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t, n, k, m;
  cin >> t;
  while (t--) {
    k = 2;
    cin >> n;
    while (1) {
      m = pow(2, k) - 1;
      if (n % m == 0) {
        cout << n / m << endl;
        break;
      } else
        k++;
    }
  }
}
