#include <bits/stdc++.h>
using namespace std;
bool Fr = 0;
template <class T>
inline void Read(T &x) {
  x = Fr = 0;
  T f = 1;
  char p = getchar();
  for (; !isdigit(p); p = getchar()) {
    if (p == EOF) return;
    if (p == '-') f = -1;
  }
  for (; isdigit(p); p = getchar()) x = x * 10 + (p - 48);
  x *= f, Fr = 1;
}
inline void Ask(long long x) {
  printf("? %lld\n", x);
  fflush(stdout);
}
inline void Ans(long long x) {
  printf("= %lld\n", x);
  fflush(stdout);
}
inline int Diff(int x = 0) {
  scanf("%d", &x);
  return x;
}
int T;
long long n, pre, tmp;
vector<long long> op;
inline int Check(long long l) {
  long long now = pre + tmp * l;
  Ask(pre = now), tmp = -tmp;
  return Diff();
}
inline long long Prework() {
  long long l = 0, r = n, now = 1;
  op.clear(), tmp = 1;
  while (l + 1 < r) {
    long long mid = (l + r) >> 1;
    op.push_back(l = mid);
  }
  while (op.size()) {
    long long x = op.back();
    now += tmp * x, tmp = -tmp, op.pop_back();
  }
  return now;
}
int main() {
  for (Read(T); T--;) {
    Read(n);
    long long l = 0, r = n;
    Ask(pre = Prework()), Diff();
    while (l + 1 < r) {
      long long mid = (l + r) >> 1;
      if (Check(mid))
        r = mid;
      else
        l = mid;
    }
    Ans(r);
  }
}
