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