#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (long long i = 2; ((1 << i) - 1) <= n; i++) {
      int temp = ((1 << i) - 1);
      if (n % temp == 0) {
        {
          cout << (n / temp) << "\n";
          break;
        }
      } else
        continue;
    }
  }
}
