#include <bits/stdc++.h>
int T, N, x[25], y[25], L;
char qre[3];
char query(int x, int y) {
  printf("? %d %d\n", x, y);
  fflush(stdout);
  scanf("%s", qre);
  return *qre;
}
void answer(int x, int y) {
  printf("! %d %d\n", x, y);
  fflush(stdout);
}
int main() {
  for (scanf("%d", &T); T--;) {
    scanf("%d", &N);
    L = 0;
    for (int i = 1; i < N; i += 2)
      if (query(i, i + 1) == '>')
        x[L] = i + 1, y[L++] = i;
      else
        x[L] = i, y[L++] = i + 1;
    if (N & 1) x[L] = N, y[L++] = N;
    int MIN = 0, MAX = 0;
    for (int i = 1; i < L; i++) {
      if (query(x[i], x[MIN]) == '<') MIN = i;
      if (query(y[i], y[MAX]) == '>') MAX = i;
    }
    answer(x[MIN], y[MAX]);
  }
  return 0;
}
