#include <bits/stdc++.h>
using namespace std;
int n;
int p[64];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int T;
  cin >> T;
  srand(13);
  for (int test = 0; test < T; ++test) {
    cin >> n;
    iota(p, p + n, 0);
    auto mm = minmax_element(p, p + n, [](int a, int b) {
      cout << "? " << a + 1 << ' ' << b + 1 << endl;
      char r;
      cin >> r;
      return r == '<';
    });
    cout << "! " << *(mm.first) + 1 << ' ' << *(mm.second) + 1 << endl;
  }
  return 0;
}
