#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long a = 2;
    while (n % ((1 << a) - 1) != 0) a++;
    cout << n / ((1 << a) - 1) << endl;
  }
  return 0;
}
