#include <bits/stdc++.h>
int pri[50010], be_pri[50010], pri_cnt;
int T;
long long ans;
struct nb {
  int pri, pow, num;
  bool operator<(const nb &x) const {
    return (x.pow > pow) || (x.pow == pow && x.num < num);
  }
};
std ::vector<nb> v;
std ::priority_queue<nb> q;
int main() {
  scanf("%d", &T);
  for (int i = 2; i <= 31622; ++i) {
    if (!be_pri[i]) pri[++pri_cnt] = i;
    for (int j = 1; j <= pri_cnt; ++j) {
      if (i * pri[j] > 31622) break;
      be_pri[i * pri[j]] = 1;
      if (!(i % pri[j])) break;
    }
  }
  while (T--) {
    ans = 1;
    while (!q.empty()) q.pop();
    for (int i = 1; i <= pri_cnt; ++i) q.push((nb){pri[i], 1, pri[i]});
    for (int i = 1; i <= 22; ++i) {
      long long x = 1;
      v.clear();
      while (!q.empty()) {
        nb f = q.top();
        q.pop();
        if (x > 1e18 / (double)f.num) {
          q.push(f);
          break;
        }
        x *= f.num;
        v.push_back(f);
      }
      printf("? %lld\n", x);
      fflush(stdout);
      int gcd;
      scanf("%d", &gcd);
      for (nb i : v)
        if (!(gcd % i.num)) {
          ans += ans / i.pow;
          ++i.pow, i.num *= i.pri;
          q.push(i);
        }
    }
    printf("! %lld\n", ans << 1);
  }
}
