#include <bits/stdc++.h>
using namespace std;
long long n;
long long cur;
int ask(long long x) {
  cout << "? " << x + 1 << endl;
  int res;
  cin >> res;
  cur = x;
  return res;
}
void answer(long long x) { cout << "= " << x << endl; }
void solve() {
  cin >> n;
  long long l = 0;
  long long r = n;
  vector<long long> seq;
  while (r - l > 1) {
    l = (l + r) / 2;
    seq.push_back(l);
  }
  reverse(seq.begin(), seq.end());
  long long dir = 1;
  long long t = 0;
  for (long long l : seq) {
    t += dir * l;
    dir = -dir;
  }
  l = 0;
  r = n;
  ask(t);
  while (r - l > 1) {
    long long h = (l + r) / 2;
    long long to = t + dir * h;
    dir = -dir;
    if (ask(to))
      r = h;
    else
      l = h;
    t = to;
  }
  answer(r);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
