#include <bits/stdc++.h>
using namespace std;
struct num{
double j;
int z;
};
void solve(){
double x,a;
int y,b;
num n,m;
cin >>x >>y;
n.j=x;
n.z=y;
while(n.j>=10){
n.j/=10;
n.z++;
}
cin >>a >>b;
m.j=a;
m.z=b;
while(m.j>=10){
m.j/=10;
m.z++;
}
if(n.j==m.j){
if(n.z==m.z)cout <<"=\n";
else cout <<(n.z>m.z?">\n":"<\n");
}
else{
if(n.j==m.j)cout <<"=\n";
else cout <<(n.j>m.j?">\n":"<\n");
}
}
int main(){
int t;
cin >>t;
while(t--)solve();
return 0;
}