#include <bits/stdc++.h>
using namespace std;
int n, t, mx, mn, mx1, mn1;
char a;
int main() {
  cin >> t;
  for (int i = 0; i < t; ++i) {
    cin >> n;
    if (n == 1) {
      cout << "! " << 1 << " " << 1 << endl;
      continue;
    }
    cout << "? " << 1 << " " << 2 << endl;
    fflush(stdout);
    cin >> a;
    if (a == '>') {
      mx = 1;
      mn = 2;
    } else {
      mx = 2;
      mn = 1;
    }
    for (int i = 4; i <= n; i += 2) {
      cout << "? " << i - 1 << " " << i << endl;
      fflush(stdout);
      cin >> a;
      if (a == '>') {
        mx1 = i - 1;
        mn1 = i;
      } else {
        mx1 = i;
        mn1 = i - 1;
      }
      cout << "? " << mx << " " << mx1 << endl;
      fflush(stdout);
      cin >> a;
      if (a == '<') {
        mx = mx1;
      }
      cout << "? " << mn << " " << mn1 << endl;
      fflush(stdout);
      cin >> a;
      if (a == '>') {
        mn = mn1;
      }
    }
    if (n % 2) {
      mx1 = n;
      mn1 = n;
      cout << "? " << mx << " " << mx1 << endl;
      fflush(stdout);
      cin >> a;
      if (a == '<') {
        mx = mx1;
      }
      cout << "? " << mn << " " << mn1 << endl;
      fflush(stdout);
      cin >> a;
      if (a == '>') {
        mn = mn1;
      }
    }
    cout << "! " << mn << " " << mx << endl;
    fflush(stdout);
  }
  return 0;
}
