#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> solve(long long l, long long r) {
  if (r == l) {
    return {l, l};
  }
  if (r - l == 1) {
    cout << "? " << l << " " << r << "\n";
    fflush(stdout);
    char c;
    cin >> c;
    if (c == '<') {
      return {l, r};
    } else {
      return {r, l};
    }
  }
  long long mid = l + 1, mini, maxi;
  pair<long long, long long> ans1, ans2;
  ans1 = solve(l, mid);
  ans2 = solve(mid + 1, r);
  cout << "? " << ans1.first << " " << ans2.first << "\n";
  fflush(stdout);
  char c;
  cin >> c;
  if (c == '<') {
    mini = ans1.first;
  } else {
    mini = ans2.first;
  }
  cout << "? " << ans1.second << " " << ans2.second << "\n";
  fflush(stdout);
  cin >> c;
  if (c == '<') {
    maxi = ans2.second;
  } else {
    maxi = ans1.second;
  }
  return {mini, maxi};
}
int main() {
  ios_base ::sync_with_stdio(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n, i, j, k;
    cin >> n;
    pair<long long, long long> ans = solve(1, n);
    cout << "! " << ans.first << " " << ans.second << "\n";
    fflush(stdout);
  }
  return 0;
}
