#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed;
  cout.precision(10);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, i, s = 3;
    cin >> n;
    i = 2;
    while (1) {
      if (n % s == 0) {
        cout << n / s << "\n";
        break;
      }
      s = s + pow(2, i);
      i++;
    }
  }
  return 0;
}
