#include <bits/stdc++.h>
using namespace std;
template <typename tp>
inline void read(tp& x) {
  x = 0;
  char tmp;
  bool key = 0;
  for (tmp = getchar(); !isdigit(tmp); tmp = getchar()) key = (tmp == '-');
  for (; isdigit(tmp); tmp = getchar()) x = (x << 3) + (x << 1) + (tmp ^ '0');
  if (key) x = -x;
}
template <typename tp>
inline void ckmn(tp& x, tp y) {
  x = x < y ? x : y;
}
template <typename tp>
inline void ckmx(tp& x, tp y) {
  x = x < y ? y : x;
}
map<long long, long long> mp;
int query(long long p) {
  printf("? %lld\n", p);
  fflush(stdout);
  int ret = 0;
  read(ret);
  return ret;
}
void prework_stp(long long n) {
  if (mp.count(n)) return;
  prework_stp((n + 1) / 2);
  long long tmp = mp[(n + 1) / 2];
  if (tmp * 2 <= (n + 1) / 2)
    mp[n] = tmp + (n / 2);
  else
    mp[n] = tmp;
}
long long doit(long long n, long long val0, long long val1, int dep) {
  if (n == 1) return 1;
  if (n == 3) {
    long long p2 = 1, p3 = 3;
    int ret2 = 0, ret3 = 0;
    if (dep == 0)
      ret2 = query(p2 + val0);
    else
      ret2 = query(p2 + val1);
    if (dep == 1)
      ret3 = query(p3 + val0);
    else
      ret3 = query(p3 + val1);
    if (ret3 == 0)
      return 3;
    else if (ret2 == 0)
      return 2;
    else
      return 1;
  }
  long long stp = mp[n], nex = 0;
  if (stp * 2 <= n)
    nex = stp + (n / 2);
  else
    nex = stp - (n / 2);
  int ret = 0;
  if (dep == 0)
    ret = query(nex + val0);
  else
    ret = query(nex + val1);
  if (ret == 0) {
    if (((int)(stp * 2 <= n)) ^ dep)
      return doit((n + 1) / 2, val0 + n / 2, val1, dep ^ 1) + (n / 2);
    else
      return doit((n + 1) / 2, val0, val1 + n / 2, dep ^ 1) + (n / 2);
  } else {
    if (stp * 2 <= n)
      return doit((n + 1) / 2, val0 + n / 2, val1 + n / 2, dep ^ 1);
    else
      return doit((n + 1) / 2, val0, val1, dep ^ 1);
  }
}
void solve() {
  long long n;
  read(n);
  prework_stp(n);
  query(mp[n]);
  long long ans = doit(n, 0, 0, 0);
  printf("= %lld\n", ans);
  fflush(stdout);
}
int main() {
  int T;
  read(T);
  mp[1] = mp[2] = 1;
  while (T--) solve();
  return 0;
}
