#include <bits/stdc++.h>
using namespace std;
int Q;
int n;
pair<int, int> maxmin(int i, int j) {
  if (j == i + 1) return pair<int, int>(i, i);
  if (j == i + 2) {
    cout << '?' << ' ' << i << ' ' << i + 1 << endl;
    char c;
    cin >> c;
    if (c == '>')
      return pair<int, int>(i, i + 1);
    else
      return pair<int, int>(i + 1, i);
  }
  int ampl = j - i;
  int pot = 1;
  while (pot < ampl) pot = pot * 2;
  pot = pot / 2;
  pair<int, int> m1 = maxmin(i, i + pot);
  pair<int, int> m2 = maxmin(i + pot, j);
  pair<int, int> res;
  cout << '?' << ' ' << m1.first << ' ' << m2.first << endl;
  char c;
  cin >> c;
  if (c == '>')
    res.first = m1.first;
  else
    res.first = m2.first;
  cout << '?' << ' ' << m1.second << ' ' << m2.second << endl;
  cin >> c;
  if (c == '>')
    res.second = m2.second;
  else
    res.second = m1.second;
  return res;
}
int main() {
  cin >> Q;
  for (int cas = 0; cas < Q; cas++) {
    cin >> n;
    pair<int, int> r = maxmin(1, n + 1);
    cout << '!' << ' ' << r.second << ' ' << r.first << endl;
  }
}
