#include <bits/stdc++.h>
int main() {
  int t;
  scanf("%d", &t);
  int n;
  int x;
  for (int i = 0; i < t; i++) {
    scanf("%d", &n);
    for (int power = 4; power < (1 << 30); power *= 2) {
      if (n % (power - 1) == 0) {
        x = n / (power - 1);
      }
    }
    printf("%d\n", x);
  }
  return 0;
}
