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