#include <bits/stdc++.h>
using namespace std;
struct Pair {
  int min;
  int max;
  Pair(int min, int max) : min(min), max(max) {}
};
char request(int i, int j) {
  cout << "? " << i << " " << j << endl;
  cout.flush();
  char c;
  cin >> c;
  return c;
}
Pair *bs(int l, int r, int n) {
  if (l > n) {
    return NULL;
  }
  if (l == r) {
    return new Pair(l, r);
  }
  if (r - l == 1) {
    if (r > n) {
      return new Pair(l, l);
    }
    char response = request(l, r);
    if (response == '>')
      return new Pair(r, l);
    else
      return new Pair(l, r);
  }
  Pair *left = bs(l, l + (r - l) / 2, n);
  Pair *right = bs(l + (r - l) / 2 + 1, r, n);
  int min = left->min;
  int max = left->max;
  if (right != NULL) {
    if (request(left->min, right->min) == '>') {
      min = right->min;
    }
    if (request(left->max, right->max) == '<') {
      max = right->max;
    }
  }
  return new Pair(min, max);
}
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; ++i) {
    int n;
    cin >> n;
    int m = 2 << (int)(log(n) / log(2));
    Pair *p = bs(1, m, n);
    cout << "! " << p->min << " " << p->max << endl;
  }
  return 0;
}
