#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
long long n;
vector<long long> v;
set<long long> s;
bool querying;
long long hi, lo;
long long offset;
void query(long long number) {
  s.insert(number);
  if (querying) cout << "? " << number << endl;
  v.push_back(number);
  bool b = false;
  if (querying)
    cin >> b;
  else if (abs(v[(long long)v.size() - 2] - v.back()) >= n)
    b = 1;
  if (v.size() >= 2) {
    long long diff = abs(v[(long long)v.size() - 2] - v.back());
    if (b) {
      hi = min(hi, diff);
    } else
      lo = max(lo, diff + 1);
  }
}
pair<long long, long long> work() {
  v = {}, s = {};
  lo = 1, hi = n;
  query(offset);
  while (lo < hi) {
    long long mid = (lo + hi) >> 1;
    if ((lo & 1) == (hi & 1)) --mid;
    if (v.size() & 1)
      query(v.back() - mid);
    else
      query(v.back() + mid);
  }
  if (querying) cout << "= " << lo << endl;
  return {*s.begin(), *s.rbegin()};
}
void solve() {
  cin >> n;
  offset = 0;
  querying = false;
  pair<long long, long long> p = work();
  offset = 1 - p.first;
  querying = true;
  work();
  return;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  cin >> t;
  for (long long _t = 1; _t <= t; _t++) {
    solve();
  }
  return 0;
}
