#include <bits/stdc++.h>
using namespace std;
long long n, _C;
long long lo, hi;
set<long long> S;
vector<long long> vec;
int actual;
long long offset;
void ask(long long x) {
  S.insert(x);
  vec.emplace_back(x);
  if (actual) cout << "? " << x << "\n";
  if (actual)
    cin >> x;
  else
    x = abs(vec[(int)vec.size() - 2] - vec.back()) >= _C;
  if ((int)vec.size() > 1) {
    long long d = abs(vec[(int)vec.size() - 2] - vec.back());
    if (x)
      hi = min(hi, d);
    else
      lo = max(lo, d + 1);
  }
}
long long solve() {
  vec.clear();
  S.clear();
  lo = 1;
  hi = n;
  long long cur = offset;
  ask(cur);
  while (lo < hi) {
    long long mid = (lo + hi) / 2;
    int p1 = (lo & 1);
    int p2 = (hi & 1);
    if ((lo & 1) == (hi & 1)) mid--;
    if ((int)S.size() & 1)
      ask(vec.back() - mid);
    else
      ask(vec.back() + mid);
  }
  if (actual) cout << "= " << lo << "\n";
  return *S.begin();
}
int main() {
  ios_base::sync_with_stdio(0);
  int itest;
  cin >> itest;
  while (itest--) {
    cin >> n;
    offset = 0;
    _C = n;
    actual = 0;
    offset = 1 - solve();
    actual = 1;
    solve();
  }
}
