#include <bits/stdc++.h>
using namespace std;
int main() {
  int kase;
  cin >> kase;
  while (kase--) {
    int n, score[55] = {0};
    char str[5] = {0};
    cin >> n;
    if (n == 1) {
      printf("! 1 1\n"), fflush(stdout);
      continue;
    }
    int sz = ceil(3.0 * n / 2) - 2;
    for (int i = 1; i * 2 <= n; i++) {
      printf("? %d %d\n", i * 2 - 1, i * 2), fflush(stdout);
      scanf("%s", str);
      if (str[0] == '>')
        score[i * 2 - 1] = 2, score[i * 2] = 0;
      else if (str[0] == '<')
        score[i * 2 - 1] = 0, score[i * 2] = 2;
      else
        score[i * 2 - 1] = score[i * 2] = 1;
    }
    int mx = 0, mi = 0;
    if (score[1] > score[2])
      mx = 1, mi = 2;
    else if (score[1] < score[2])
      mx = 2, mi = 1;
    else
      mx = 1, mi = 1;
    for (int i = 2; i * 2 <= n; i++)
      if (score[i * 2 - 1] >= score[i * 2]) {
        printf("? %d %d\n", mx, i * 2 - 1), fflush(stdout);
        scanf("%s", str);
        if (str[0] == '<') mx = i * 2 - 1;
        printf("? %d %d\n", mi, i * 2), fflush(stdout);
        scanf("%s", str);
        if (str[0] == '>') mi = i * 2;
      } else if (score[i * 2 - 1] < score[i * 2]) {
        printf("? %d %d\n", mx, i * 2), fflush(stdout);
        scanf("%s", str);
        if (str[0] == '<') mx = i * 2;
        printf("? %d %d\n", mi, i * 2 - 1), fflush(stdout);
        scanf("%s", str);
        if (str[0] == '>') mi = i * 2 - 1;
      }
    if (n & 1) {
      printf("? %d %d\n", mx, n), fflush(stdout);
      scanf("%s", str);
      if (str[0] == '<') mx = n;
      printf("? %d %d\n", mi, n), fflush(stdout);
      scanf("%s", str);
      if (str[0] == '>') mi = n;
    }
    printf("! %d %d\n", mi, mx), fflush(stdout);
  }
  return 0;
}
