#include <bits/stdc++.h>
int main() {
  long long t;
  scanf("%lld", &t);
  long int n, x = 1;
  for (int i = 0; i < t; i++) {
    scanf("%ld", &n);
    int k = 1, p = 1, x;
    for (; p <= n;) {
      k++;
      p = p + pow(2, k - 1);
      if (n % p == 0) {
        x = n / p;
        break;
      }
    }
    printf("%ld\n", x);
  }
  return 0;
}
