#include <bits/stdc++.h>
using namespace std;
long long t, n, x, i, j;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  cin >> t;
  for (int jh = 0; jh < t; jh++) {
    cin >> n;
    for (i = 3, j = 1; i <= n, j++; i += pow(2, j))
      if (n % i == 0) {
        cout << n / i << endl;
        break;
      }
  }
}
