#include <bits/stdc++.h>
using namespace std;
int ask(long long x) {
  printf("? %lld\n", x);
  fflush(stdout);
  int y;
  scanf("%d", &y);
  return y;
}
long long calc(long long n) {
  if (n == 1) return 1;
  return (n + 1) / 2 + 1 - calc((n + 1) / 2);
}
void solve(long long n) {
  long long pos = calc(n);
  long long l = 1, r = n, u = 1;
  ask(pos);
  while (l < r) {
    long long mid = (l + r - 1) >> 1;
    pos += mid * u;
    if (ask(pos))
      r = mid;
    else
      l = mid + 1;
    u *= -1;
  }
  printf("= %lld\n", r);
  fflush(stdout);
}
inline void rd(int &x) {
  x = 0;
  char ch = getchar();
  int f = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
int main() {
  int T;
  scanf("%d", &T);
  long long n;
  while (T--) {
    scanf("%lld", &n);
    solve(n);
  }
  return 0;
}
