#include <bits/stdc++.h>
using namespace std;
int T, n;
char res[10];
int main() {
  memset(res, 0, sizeof(res));
  scanf("%d", &T);
  for (int tt = 0; tt < T; tt++) {
    scanf("%d", &n);
    bool odd = n % 2;
    int lim = odd ? (n - 1) : n;
    int mx = 1, mn = 1, tmp1, tmp2;
    if (n == 1) {
      printf("! 1 1\n");
      fflush(stdout);
      continue;
    }
    for (int i = 1; i < lim; i += 2) {
      printf("? %d %d\n", i, i + 1);
      fflush(stdout);
      scanf("%s", res);
      if (res[0] == '<') {
        tmp1 = i, tmp2 = i + 1;
      } else {
        tmp1 = i + 1, tmp2 = i;
      }
      if (i == 1) {
        mn = tmp1, mx = tmp2;
        continue;
      }
      printf("? %d %d\n", mn, tmp1);
      fflush(stdout);
      scanf("%s", res);
      if (res[0] == '>') mn = tmp1;
      printf("? %d %d\n", mx, tmp2);
      fflush(stdout);
      scanf("%s", res);
      if (res[0] == '<') mx = tmp2;
    }
    if (odd) {
      printf("? %d %d\n", mn, n);
      fflush(stdout);
      scanf("%s", res);
      if (res[0] == '>') mn = n;
      printf("? %d %d\n", mx, n);
      fflush(stdout);
      scanf("%s", res);
      if (res[0] == '<') mx = n;
    }
    printf("! %d %d\n", mn, mx);
    fflush(stdout);
  }
}
