#include <bits/stdc++.h>
using namespace std;
long long _, n, ans;
void solve() {
  scanf("%lld", &n);
  ans = 4;
  while (1) {
    if (n % (ans - 1) == 0) break;
    ans <<= 1;
  }
  printf("%lld\n", n / (ans - 1));
}
signed main() {
  for (scanf("%lld", &_); _; --_) solve();
}
