#include <bits/stdc++.h>
using namespace std;
long long query(long long i, long long j) {
  cout << "? " << i << " " << j << endl;
  string s;
  cin >> s;
  if (s[0] == '>') return i;
  return j;
}
int main() {
  long long T;
  cin >> T;
  while (T--) {
    long long n;
    cin >> n;
    long long currmax = n;
    long long currmin = n;
    if (n % 2 == 0) {
      currmax = query(n, n - 1);
      currmin = 2 * n - 1 - currmax;
    }
    for (long long i = 1; i + 1 <= n - 1; i += 2) {
      long long newmax = query(i, i + 1);
      long long newmin = 2 * i + 1 - newmax;
      currmax = query(currmax, newmax);
      long long temp = query(currmin, newmin);
      currmin = newmin + currmin - temp;
    }
    cout << "! " << currmin << " " << currmax << endl;
  }
}
