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