#include <bits/stdc++.h>
using namespace std;
long long nbTests, nbCouleurs;
pair<long long, long long> Deb[100];
long long Ask(long long q) {
  cout << "? " << q << endl;
  long long r = 1;
  cin >> r;
  return r;
}
void Ans(long long q) {
  cout << "= " << q << endl;
  return;
}
void SolveSmall(long long nb) {
  long long rep = 0;
  if (nb == 1) {
    Ans(1);
    return;
  }
  if (nb == 2) {
    rep = Ask(1);
    rep = Ask(2);
    if (rep == 1) {
      Ans(1);
      return;
    }
    Ans(2);
    return;
  }
  if (nb == 3) {
    rep = Ask(2);
    rep = Ask(3);
    if (rep == 1) {
      Ans(1);
      return;
    }
    rep = Ask(1);
    if (rep == 1) {
      Ans(2);
      return;
    }
    Ans(3);
    return;
  }
  if (nb == 4) {
    rep = Ask(2);
    rep = Ask(4);
    if (rep == 1) {
      rep = Ask(3);
      if (rep == 1) {
        Ans(1);
        return;
      }
      Ans(2);
      return;
    }
    rep = Ask(1);
    if (rep == 1) {
      Ans(3);
      return;
    }
    Ans(4);
    return;
  }
  return;
}
void SetUp(long long nb, long long rang) {
  long long d = nb / 2;
  if (nb == 3) {
    Deb[rang] = make_pair(2, 1);
    return;
  }
  if (nb == 4) {
    Deb[rang] = make_pair(2, 1);
    return;
  }
  SetUp((nb + 1) / 2, rang + 1);
  long long dir = Deb[rang + 1].second;
  if (dir == 1) {
    Deb[rang] = make_pair(Deb[rang + 1].first + d, -1);
  }
  if (dir == -1) {
    Deb[rang] = make_pair(Deb[rang + 1].first, 1);
  }
  return;
}
void SubSolve(long long nb, long long rang, long long deb, long long dec) {
  long long dir = Deb[rang].second;
  long long rep;
  if (nb == 3) {
    rep = Ask(deb + dec + 1);
    if (rep == 1) {
      Ans(dec + 1);
      return;
    }
    rep = Ask(deb - 1);
    if (rep == 1) {
      Ans(dec + 2);
      return;
    }
    Ans(dec + 3);
    return;
  }
  if (nb == 4) {
    rep = Ask(deb + dec + 2);
    if (rep == 1) {
      rep = Ask(deb + 1);
      if (rep == 1) {
        Ans(dec + 1);
        return;
      }
      Ans(dec + 2);
      return;
    }
    rep = Ask(deb - 1);
    if (rep == 1) {
      Ans(dec + 3);
      return;
    }
    Ans(dec + 4);
    return;
  }
  long long d = nb / 2;
  long long ndeb = deb + (d + dec) * dir;
  rep = Ask(ndeb);
  if (rep == 1) {
    SubSolve((nb + 1) / 2, rang + 1, ndeb, dec);
    return;
  }
  SubSolve((nb + 1) / 2, rang + 1, ndeb, dec + d);
  return;
}
void Solve(long long nb) {
  SetUp(nb, 0);
  long long deb = Deb[0].first;
  long long rep = Ask(deb);
  rep++;
  SubSolve(nb, 0, deb, 0);
  return;
}
void Print() {
  for (long long i = 0; i < 10; i++) {
    cout << Deb[i].first << " " << Deb[i].second << endl;
  }
  return;
}
void Read() {
  cin >> nbTests;
  for (long long i = 0; i < nbTests; i++) {
    cin >> nbCouleurs;
    if (nbCouleurs <= 4) {
      SolveSmall(nbCouleurs);
    } else {
      Solve(nbCouleurs);
    }
  }
  return;
}
signed main() {
  Read();
  return 0;
}
