#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int tc;
  cin >> tc;
  while (tc--) {
    int n;
    cin >> n;
    int sum = 1;
    for (int k = 1;; k++) {
      sum += 1 << k;
      if (n % sum == 0) {
        cout << n / sum << '\n';
        break;
      }
    }
  }
}
