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