#include <bits/stdc++.h>
using namespace std;
long long work(long long n) {
  if (n <= 2) return 1;
  return n - work(n + 1 >> 1);
}
int Query(long long x) {
  printf("? %lld\n", x);
  fflush(stdout);
  int opt;
  scanf("%d", &opt);
  return opt;
}
void Guess(long long n) {
  if (n == 1) {
    printf("= %lld\n", n);
    fflush(stdout);
    return;
  }
  vector<long long> po;
  long long l = 1, r = n - 1, ans = n;
  while (l <= r) {
    long long mid = l + r >> 1;
    po.push_back(mid), l = mid + 1;
  }
  reverse(po.begin(), po.end());
  long long pos = n, flag = -1;
  for (auto v : po) pos += flag * v, flag *= -1;
  Query(pos);
  l = 1, r = n - 1, flag = (po.size() & 1) ? 1 : -1;
  while (l <= r) {
    long long mid = l + r >> 1;
    pos += mid * flag, flag *= -1;
    bool sta = Query(pos);
    if (sta == 1)
      r = mid - 1, ans = mid;
    else
      l = mid + 1;
  }
  printf("= %lld\n", ans);
  fflush(stdout);
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    long long n;
    scanf("%lld", &n);
    Guess(n);
  }
  return 0;
}
