#include <bits/stdc++.h>
using namespace std;
const int N = 1e2;
long long a[N], s[N];
int main() {
  a[0] = 1;
  s[0] = 1;
  for (int i = 1; i <= 30; i++) {
    a[i] = a[i - 1] * 2;
    s[i] = s[i - 1] + a[i];
  }
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 1; i <= 30; i++) {
      int ans = n / s[i];
      if (ans * s[i] == n) {
        cout << ans << endl;
        break;
      }
    }
  }
  return 0;
}
