#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n, i = 1, sum = 1;
    cin >> n;
    while (1) {
      sum += pow(2, i);
      if (n % sum == 0) break;
      i++;
    }
    cout << n / sum << endl;
  }
}
