#include <bits/stdc++.h>
using namespace std;
int main() {
  int tc;
  cin >> tc;
  while (tc--) {
    long long n;
    cin >> n;
    for (int i = 2; i <= 30; i++) {
      long long res = (long long)pow(2, i) - 1;
      if ((n % res) == 0) {
        cout << n / res << "\n";
        break;
      }
    }
  }
  return 0;
}
