#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int MAX = 1e6;
long long int two[300], cumu[300];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  two[0] = 1;
  cumu[0] = 1;
  for (int i = 1; i <= 40; i++) {
    two[i] = two[i - 1] * 2ll;
    cumu[i] = cumu[i - 1] + two[i];
  }
  int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    for (int i = 1; i <= 40; i++) {
      if (n % cumu[i] == 0) {
        cout << n / cumu[i] << endl;
        break;
      }
    }
  }
  return 0;
}
