#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10, mod = 1e9 + 7, inf = 1e9 + 10;
bool ask(long long x) {
  cout << "? " << x + 1 << endl;
  bool ans;
  cin >> ans;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie();
  int q;
  cin >> q;
  while (q--) {
    long long n;
    cin >> n;
    long long l = 0, r = n, pos = 0;
    bool o = 0;
    long long ln = 0;
    while (r - l > 1) {
      long long mid = (l + r) >> 1;
      if (o) pos += mid - ln;
      ln = mid;
      l = mid;
      o ^= 1;
    }
    l = 0, r = n, o = 0;
    ask(pos);
    while (r - l > 1) {
      long long mid = (l + r) >> 1;
      bool chk = 0;
      if (o)
        chk = ask(pos - mid), pos -= mid;
      else
        chk = ask(pos + mid), pos += mid;
      o ^= 1;
      if (chk)
        r = mid;
      else
        l = mid;
    }
    cout << "= " << r << endl;
  }
  return 0;
}
