#include <bits/stdc++.h>
using namespace std;
int main() {
  int tc;
  cin >> tc;
  while (tc--) {
    int n;
    cin >> n;
    long long int sum = 1;
    for (int i = 1;; i++) {
      sum += pow(2, i);
      if (n % sum == 0) {
        cout << n / sum << endl;
        break;
      }
    }
  }
  return 0;
}
