#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")
using namespace std;
const int mod = (int)1e9 + 7;
const int N = (int)2e5 + 123;
const long long inf = (long long)3e18 + 1;
const double pi = acos(-1.0);
const double eps = 1e-7;
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};
int n;
inline char get(int x, int y) {
  cout << "? " << x << ' ' << y << '\n';
  char p;
  cin >> p;
  return p;
}
inline void boost() {
  ios_base ::sync_with_stdio(NULL);
  cin.tie(NULL), cout.tie(NULL);
}
inline void Solve() {
  cin >> n;
  if (n == 1) {
    cout << "! " << 1 << ' ' << 1 << '\n';
    return;
  }
  vector<int> mx, mn;
  for (int i = 1; i < n; i += 2) {
    int a = i, b = i + 1;
    if (get(a, b) == '<') swap(a, b);
    mx.push_back(a);
    mn.push_back(b);
  }
  if (n & 1) mx.push_back(n), mn.push_back(n);
  int maxi = mx[0], mini = mn[0];
  for (int i = 1; i < (int)mx.size(); i++)
    if (get(maxi, mx[i]) == '<') maxi = mx[i];
  for (int i = 1; i < (int)mn.size(); i++)
    if (get(mini, mn[i]) == '>') mini = mn[i];
  cout << "! " << mini << ' ' << maxi << '\n';
}
int main() {
  int tt = 1;
  cin >> tt;
  while (tt--) {
    Solve();
  }
  return 0;
}
