#include <bits/stdc++.h>
using namespace std;
char c;
int bi, sm;
int f2(vector<int> &a, int t) {
  int l = a.size();
  if (l == 1) {
    return a[0];
  }
  vector<int> vb, vm;
  for (int i = 0; i <= l - 2; i += 2) {
    cout << "? " << a[i] << " " << a[i + 1] << endl;
    fflush(stdout);
    cin >> c;
    if (c == '>') {
      vb.push_back(a[i]);
      vm.push_back(a[i + 1]);
    }
    if (c == '<') {
      vb.push_back(a[i + 1]);
      vm.push_back(a[i]);
    }
    if (c == '=') {
      vb.push_back(a[i]);
      vm.push_back(a[i + 1]);
    }
  }
  if (l % 2 != 0) {
    vm.push_back(a[l - 1]);
    vb.push_back(a[l - 1]);
  }
  if (t == 0) {
    return f2(vb, 0);
  }
  if (t == 1) {
    return f2(vm, 1);
  }
}
void f1(int l) {
  if (l == 1) {
    bi = sm = 1;
    return;
  }
  vector<int> vb, vm;
  for (int i = 1; i <= l - 1; i += 2) {
    cout << "? " << i << " " << i + 1 << endl;
    fflush(stdout);
    cin >> c;
    if (c == '>') {
      vb.push_back(i);
      vm.push_back(i + 1);
    }
    if (c == '<') {
      vb.push_back(i + 1);
      vm.push_back(i);
    }
    if (c == '=') {
      vb.push_back(i);
      vm.push_back(i + 1);
    }
  }
  if (l % 2 != 0) {
    vm.push_back(l);
    vb.push_back(l);
  }
  bi = f2(vb, 0);
  sm = f2(vm, 1);
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    cin >> n;
    f1(n);
    cout << "! " << sm << " " << bi << endl;
    fflush(stdout);
  }
  return 0;
}
