#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  char ch = getchar();
  long long nega = 1;
  while (!isdigit(ch)) {
    if (ch == '-') nega = -1;
    ch = getchar();
  }
  long long ans = 0;
  while (isdigit(ch)) {
    ans = ans * 10 + ch - 48;
    ch = getchar();
  }
  if (nega == -1) return -ans;
  return ans;
}
long long n, las = 0;
long long Query(long long x) {
  cout << "? " << x << endl;
  return read();
}
void Guess() {
  n = read(), las = 0;
  vector<long long> v;
  long long l = 1, r = n - 1;
  while (l <= r) {
    long long mid = (l + r) / 2;
    v.push_back(mid);
    l = mid + 1;
  }
  long long cur = n, d = -1;
  for (long long i = v.size() - 1; i >= 0; i--, d *= -1) cur += d * v[i];
  l = 1, r = n - 1;
  long long ans = n;
  Query(cur);
  while (l <= r) {
    long long mid = (l + r) / 2;
    cur += d * mid;
    if (Query(cur))
      ans = mid, r = mid - 1;
    else
      l = mid + 1;
    d = -d;
  }
  cout << "= " << ans << endl;
}
signed main() {
  long long T = read();
  while (T--) Guess();
}
