#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%d", &n);
    int x = 3;
    while (n % x > 0) {
      x = 1 + 2 * x;
    }
    printf("%d\n", n / x);
  }
  return 0;
}
