#include <bits/stdc++.h>
using namespace std;
int read() {
  int res = 0, c;
  while (c = getchar(), c < '0' || c > '9')
    ;
  do {
    res = (res << 3) + (res << 1) + (c ^ 48);
  } while (c = getchar(), c >= '0' && c <= '9');
  return res;
}
int query(long long x) {
  cout << "? " << x << endl;
  cin >> x;
  return x;
}
long long begin(long long x) {
  if (x == 2) return 1;
  return (x + 3) / 2 - begin((x + 1) / 2);
}
long long solve(long long x, long long pre, long long off, bool dir) {
  if (x == 1) return 1 + off;
  long long now = pre + (dir ? -1 : 1) * (off + x / 2);
  return query(now) ? solve(x / 2, now, off, !dir)
                    : solve(x - x / 2, now, off + x / 2, !dir);
}
int main() {
  int T = read();
  while (T--) {
    long long n;
    cin >> n;
    long long now = begin(n);
    query(now);
    long long res = solve(n, now, 0, 0);
    cout << "= " << res << endl;
  }
  return 0;
}
