#include <iostream>
#include <cstdio>
using namespace std;
int t,n;
void solve()
{
scanf("%d",&n);
int realn = 0;
for (int i = 1;i < n;i ++)
{
printf("? %d %d %d %d\n",realn,realn,i,i);
fflush(stdout);
char ch = getchar();
while (ch != '<' && ch != '>' && ch != '=') ch = getchar();
if (ch == '<') realn = i;
}
int res = realn;
for (int i = 0;i < n;i ++)
{
if (i == realn) continue;
printf("? %d %d %d %d\n",realn,res,realn,i);
fflush(stdout);
char ch = getchar();
while (ch != '<' && ch != '>' && ch != '=') ch = getchar();
if (ch == '<') res = i;
else if (ch == '=')
{
printf("? %d %d %d %d\n",res,res,i,i);
fflush(stdout);
char ch = getchar();
while (ch != '<' && ch != '>' && ch != '=') ch = getchar();
if (ch == '>') res = i;
}
}
printf("! %d %d\n",realn,res);
fflush(stdout);
}
int main()
{
scanf("%d",&t);
while (t --) solve();
}
Cutting a material | Bubble Sort |
Number of triangles | AND path in a binary tree |
Factorial equations | Removal of vertices |
Happy segments | Cyclic shifts |
Zoos | Build a graph |
Almost correct bracket sequence | Count of integers |
Differences of the permutations | Doctor's Secret |
Back to School | I am Easy |
Teddy and Tweety | Partitioning binary strings |
Special sets | Smallest chosen word |
Going to office | Color the boxes |
Missing numbers | Maximum sum |
13 Reasons Why | Friend's Relationship |
Health of a person | Divisibility |
A. Movement | Numbers in a matrix |