#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  int t;
  for (int queryid = 0; queryid < q; ++queryid) {
    cin >> t;
    for (int i = 4; true; i *= 2) {
      if (t % (i - 1) == 0) {
        cout << t / (i - 1) << endl;
        break;
      }
    }
  }
  return 0;
}
