#include <bits/stdc++.h>
using namespace std;
unsigned long long dp[100];
int main() {
  ios_base::sync_with_stdio();
  cin.tie(NULL);
  cout.tie(NULL);
  dp[0] = 1;
  dp[1] = 3;
  dp[2] = 7;
  for (int i = 3; i < 101; i++) {
    dp[i] = dp[i - 1] + pow(2, i);
  }
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 1; i < 101; i++) {
      if (n % dp[i] == 0) {
        cout << n / dp[i] << "\n";
        break;
      }
    }
  }
  return 0;
}
