#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const long long mod = 1e9 + 7;
const int N = 2e5 + 10, M = 1e6 + 10;
const long long INF = 1e18;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    long long sum = 3;
    long long cnt = 2;
    while (1) {
      if (n % sum == 0) {
        cout << n / sum << endl;
        break;
      }
      cnt *= 2;
      sum += cnt;
    }
  }
  return 0;
}
