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