#include <bits/stdc++.h>
using namespace std;
long long arr[33];
void solve() {
  long long n;
  cin >> n;
  for (int i = 2; i < 33; i++) {
    if (n % (arr[i] - 1) == 0) {
      cout << n / (arr[i] - 1);
      return;
    }
  }
}
int main() {
  arr[0] = 1;
  for (int i = 1; i < 33; i++) {
    arr[i] = 2 * arr[i - 1];
  }
  int t;
  cin >> t;
  while (t--) {
    solve();
    cout << endl;
  }
}
