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