#include <bits/stdc++.h>
using namespace std;
int query(long long x) {
  cout << "? " << x << endl;
  int z;
  cin >> z;
  return z;
}
pair<long long, long long> comeco(long long x) {
  if (x == 3) return make_pair(2, 2);
  if (x == 4) return make_pair(2, 3);
  auto aux = comeco((x + 1LL) / 2LL);
  return make_pair(aux.second, aux.first + x / 2LL);
}
void rec(long long n, long long ant, long long toSum, bool gottaDown,
         long long &best) {
  if (n == 1) return;
  long long curr = ant + (gottaDown ? (-toSum - n / 2) : (toSum + n / 2));
  if (query(curr)) {
    best = abs(curr - ant);
    rec(n / 2, curr, toSum, !gottaDown, best);
  } else
    rec((n + 1) / 2, curr, toSum + n / 2, !gottaDown, best);
}
void solve() {
  long long N;
  cin >> N;
  if (N == 2) {
    query(1);
    if (query(2))
      cout << "= 1" << endl;
    else
      cout << "= 2" << endl;
    return;
  }
  long long curr = comeco(N).first;
  long long ans = N;
  query(curr);
  rec(N, curr, 0, 0, ans);
  cout << "= " << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T;
  cin >> T;
  while (T--) solve();
}
