#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[100000], devise[100000];
  arr[0] = 1;
  for (int i = 1; i < 100000; i++) arr[i] = arr[i - 1] * 2;
  devise[0] = 3;
  for (int i = 1; i < 100000; i++) devise[i] = devise[i - 1] + arr[i + 1];
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 0;; i++) {
      if (n % devise[i] == 0) {
        cout << n / devise[i] << endl;
        break;
      }
    }
  }
  return 0;
}
