#include <bits/stdc++.h>
using namespace std;
int n;
int ansa, ansb;
pair<int, int> cmp(int a, int b) {
  printf("? %d %d\n", a, b);
  fflush(stdout);
  char c[10];
  scanf("%s", c);
  if (c[0] == '>')
    return make_pair(b, a);
  else
    return make_pair(a, b);
}
void cmpa(int a) {
  printf("? %d %d\n", ansa, a);
  fflush(stdout);
  char c[10];
  scanf("%s", c);
  if (c[0] == '>') {
    ansa = a;
  }
}
void cmpb(int a) {
  printf("? %d %d\n", ansb, a);
  fflush(stdout);
  char c[10];
  scanf("%s", c);
  if (c[0] == '<') {
    ansb = a;
  }
}
int main() {
  int T;
  cin >> T;
  while (T--) {
    cin >> n;
    int st;
    if (0 == n % 2) {
      pair<int, int> tmp = cmp(1, 2);
      ansa = tmp.first;
      ansb = tmp.second;
      st = 3;
    } else {
      st = 2;
      ansa = 1;
      ansb = 1;
    }
    while (st <= n) {
      pair<int, int> tmp = cmp(st, st + 1);
      cmpa(tmp.first);
      cmpb(tmp.second);
      st += 2;
    }
    printf("! %d %d\n", ansa, ansb);
  }
}
