#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  while (T-- > 0) {
    int N;
    cin >> N;
    struct MM {
      int min, max;
    };
    MM data[129];
    for (int i = 0; i <= 128; ++i) {
      if (i >= 63 && i < 63 + N)
        data[i] = {i - 62, i - 62};
      else
        data[i] = {0, 0};
    }
    for (int i = 62; i >= 0; --i) {
      MM& fi = data[2 * i + 1];
      MM& se = data[2 * i + 2];
      if (se.min == 0) {
        data[i] = fi;
      } else {
        string res;
        if (fi.min == fi.max && se.min == se.max) {
          cout << "? " << fi.min << " " << se.min << endl;
          cout.flush();
          cin >> res;
          if (res == "<")
            data[i] = {fi.min, se.max};
          else
            data[i] = {se.min, fi.max};
        } else {
          cout << "? " << fi.min << " " << se.min << endl;
          cout.flush();
          cin >> res;
          if (res == "<")
            data[i].min = fi.min;
          else
            data[i].min = se.min;
          cout << "? " << fi.max << " " << se.max << endl;
          cout.flush();
          cin >> res;
          if (res == ">")
            data[i].max = fi.max;
          else
            data[i].max = se.max;
        }
      }
    }
    cout << "! " << data[0].min << " " << data[0].max << endl;
    cout.flush();
  }
}
