#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long int n, k = 4, flag = 0;
    ;
    cin >> n;
    while (k < n) {
      if (n % (k - 1) == 0) {
        cout << n / (k - 1) << endl;
        flag = 1;
        break;
      }
      k = k * 2;
    }
    if (flag == 0) cout << 1 << endl;
  }
  return 0;
}
