#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXL = 7;
int n;
char ret[MAXL];
void init();
void input();
int query(int x, int y);
void work();
int main() {
  init();
  int T;
  scanf("%d", &T);
  while (T--) {
    input();
    work();
  }
}
void init() { ios::sync_with_stdio(false); }
void input() { scanf("%d", &n); }
void work() {
  if (n == 1) {
    printf("! 1 1\n");
    fflush(stdout);
    return;
  }
  int size = n >> 1;
  int x1, x2, mini, maxi, tmin, tmax;
  if (query(1, 2) == 1)
    maxi = 2, mini = 1;
  else
    maxi = 1, mini = 2;
  for (int i = 1; i < size; ++i) {
    x1 = (i << 1) + 1, x2 = (i << 1) + 2;
    if (query(x1, x2) == 1)
      tmin = x1, tmax = x2;
    else
      tmin = x2, tmax = x1;
    if (query(tmin, mini) == 1) mini = tmin;
    if (query(tmax, maxi) == -1) maxi = tmax;
  }
  if (n & 1) {
    if (query(n, mini) == 1) mini = n;
    if (query(n, maxi) == -1) maxi = n;
  }
  printf("! %d %d\n", mini, maxi);
  fflush(stdout);
}
int query(int x, int y) {
  printf("? %d %d\n", x, y);
  fflush(stdout);
  scanf("%s", ret);
  if (ret[0] == '<')
    return 1;
  else if (ret[0] == '=')
    return 0;
  else if (ret[0] == '>')
    return -1;
}
