#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> minValues, maxValues;
string ask(int x, int y) {
  cout << "? " << x + 1 << " " << y + 1 << endl;
  string ans;
  cin >> ans;
  return ans;
}
int minim(int x, int y) { return (x < y ? x : y); }
int maxim(int x, int y) { return (x > y ? x : y); }
int getMinValue(vector<int> arr) {
  int returnedIndex = arr[0];
  for (int i = 1; i < arr.size(); ++i) {
    string ans = ask(returnedIndex, arr[i]);
    if (ans == ">") {
      returnedIndex = arr[i];
    }
  }
  return returnedIndex;
}
int getMaxValue(vector<int> arr) {
  int returnedIndex = arr[0];
  for (int i = 1; i < arr.size(); ++i) {
    string ans = ask(returnedIndex, arr[i]);
    if (ans == "<") {
      returnedIndex = arr[i];
    }
  }
  return returnedIndex;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    cin >> n;
    if (n == 1) {
      cout << "! 1 1" << endl;
      continue;
    }
    for (int i = 0; i + 1 < n; i += 2) {
      string ans = ask(i, i + 1);
      if (ans == ">") {
        minValues.push_back(i + 1);
        maxValues.push_back(i);
      } else {
        minValues.push_back(i);
        maxValues.push_back(i + 1);
      }
    }
    int minValue = getMinValue(minValues);
    int maxValue = getMaxValue(maxValues);
    if (n % 2 == 1) {
      string ans = ask(n - 1, minValue);
      if (ans == "<") {
        minValue = n - 1;
      }
      ans = ask(n - 1, maxValue);
      if (ans == ">") {
        maxValue = n - 1;
      }
    }
    cout << "! " << minValue + 1 << " " << maxValue + 1 << endl;
    minValues.clear();
    maxValues.clear();
  }
  return 0;
}
