#include <bits/stdc++.h>
using namespace std;
int findpre(int n) {
  int sum = 1;
  int s2 = 1;
  while (sum < n) {
    s2 *= 2;
    sum += s2;
    if (n % sum == 0 && sum <= n) return sum;
  }
  return n;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int sum = findpre(n);
    int x;
    if (n % sum == 0) x = n / sum;
    cout << x << endl;
  }
}
