#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  while (T--) {
    int t = 2, l = 32;
    long long N, z, x;
    cin >> N;
    while (l--) {
      z = int(pow(2, t) + 0.5);
      z = z - 1;
      t++;
      if (N % z == 0) {
        x = N / z;
        break;
      }
    }
    cout << x << endl;
  }
  return 0;
}
