description: Monocarp wrote down two numbers on a whiteboard. Both numbers follow a specific format: a positive integer x with p zeros appended to its end.
  
  Now Monocarp asks you to compare these two numbers. Can you help him?
  
  Input
  
  The first line contains a single integer t (1 ≤ t ≤ 10^4) — the number of testcases.
  
  The first line of each testcase contains two integers x_1 and p_1 (1 ≤ x_1 ≤ 10^6; 0 ≤ p_1 ≤ 10^6) — the description of the first number.
  
  The second line of each testcase contains two integers x_2 and p_2 (1 ≤ x_2 ≤ 10^6; 0 ≤ p_2 ≤ 10^6) — the description of the second number.
  
  Output
  
  For each testcase print the result of the comparison of the given two numbers. If the first number is smaller than the second one, print '<'. If the first number is greater than the second one, print '>'. If they are equal, print '='.
  
  Example
  
  Input
  
  
  5
  2 1
  19 0
  10 2
  100 1
  1999 0
  2 3
  1 0
  1 0
  99 0
  1 2
  
  
  Output
  
  
  &gt;
  =
  &lt;
  =
  &lt;
  
  Note
  
  The comparisons in the example are: 20 > 19, 1000 = 1000, 1999 < 2000, 1 = 1, 99 < 100.
solution: import java.io.BufferedReader;
  import java.io.DataInputStream;
  import java.io.FileInputStream;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.util.StringTokenizer;
  
  
  public class New {
  	static class FastReader {
          BufferedReader br;
          StringTokenizer st;
   
          public FastReader()
          {
              br = new BufferedReader(
                  new InputStreamReader(System.in));
          }
   
          String next()
          {
              while (st == null || !st.hasMoreElements()) {
                  try {
                      st = new StringTokenizer(br.readLine());
                  }
                  catch (IOException e) {
                      e.printStackTrace();
                  }
              }
              return st.nextToken();
          }
   
          int nextInt() { return Integer.parseInt(next()); }
   
          long nextLong() { return Long.parseLong(next()); }
   
          double nextDouble()
          {
              return Double.parseDouble(next());
          }
   
          String nextLine()
          {
              String str = "";
              try {
                  str = br.readLine();
              }
              catch (IOException e) {
                  e.printStackTrace();
              }
              return str;
          }
      }
  	
  	static class Reader {
          final private int BUFFER_SIZE = 1 << 16;
          private DataInputStream din;
          private byte[] buffer;
          private int bufferPointer, bytesRead;
   
          public Reader()
          {
              din = new DataInputStream(System.in);
              buffer = new byte[BUFFER_SIZE];
              bufferPointer = bytesRead = 0;
          }
   
          public Reader(String file_name) throws IOException
          {
              din = new DataInputStream(
                  new FileInputStream(file_name));
              buffer = new byte[BUFFER_SIZE];
              bufferPointer = bytesRead = 0;
          }
   
          public String readLine() throws IOException
          {
              byte[] buf = new byte[64]; // line length
              int cnt = 0, c;
              while ((c = read()) != -1) {
                  if (c == '\n') {
                      if (cnt != 0) {
                          break;
                      }
                      else {
                          continue;
                      }
                  }
                  buf[cnt++] = (byte)c;
              }
              return new String(buf, 0, cnt);
          }
   
          public int nextInt() throws IOException
          {
              int ret = 0;
              byte c = read();
              while (c <= ' ') {
                  c = read();
              }
              boolean neg = (c == '-');
              if (neg)
                  c = read();
              do {
                  ret = ret * 10 + c - '0';
              } while ((c = read()) >= '0' && c <= '9');
   
              if (neg)
                  return -ret;
              return ret;
          }
   
          public long nextLong() throws IOException
          {
              long ret = 0;
              byte c = read();
              while (c <= ' ')
                  c = read();
              boolean neg = (c == '-');
              if (neg)
                  c = read();
              do {
                  ret = ret * 10 + c - '0';
              } while ((c = read()) >= '0' && c <= '9');
              if (neg)
                  return -ret;
              return ret;
          }
   
          public double nextDouble() throws IOException
          {
              double ret = 0, div = 1;
              byte c = read();
              while (c <= ' ')
                  c = read();
              boolean neg = (c == '-');
              if (neg)
                  c = read();
   
              do {
                  ret = ret * 10 + c - '0';
              } while ((c = read()) >= '0' && c <= '9');
   
              if (c == '.') {
                  while ((c = read()) >= '0' && c <= '9') {
                      ret += (c - '0') / (div *= 10);
                  }
              }
   
              if (neg)
                  return -ret;
              return ret;
          }
   
          private void fillBuffer() throws IOException
          {
              bytesRead = din.read(buffer, bufferPointer = 0,
                                   BUFFER_SIZE);
              if (bytesRead == -1)
                  buffer[0] = -1;
          }
   
          private byte read() throws IOException
          {
              if (bufferPointer == bytesRead)
                  fillBuffer();
              return buffer[bufferPointer++];
          }
   
          public void close() throws IOException
          {
              if (din == null)
                  return;
              din.close();
          }
      }
  	public static int len(long n) {
  		int ans=0;
  		do {
  			n=n/10;
  			ans++;
  		}while(n!=0);
  		return ans;
  	}
  	public static String f(long p1,long x1,long p2,long x2) {
  		
  		while(p1%10==0) {
  			p1=p1/10;
  			x1++;
  		}
  		
  		while(p2%10==0) {
  			p2=p2/10;
  			x2++;
  		}
  		
  		if(p1==0) {
  			x1=0;
  		}
  		if(p2==0) {
  			x2=0;
  		}
  		if(p1==p2 && x1==x2) {
  			return "=";
  		}else {
  			if(len(p1)+x1!=len(p2)+x2) {
  				if(len(p1)+x1 > len(p2)+x2) {
  					return ">";
  				}else {
  					return "<";
  				}
  			}else {
  				int j=0;
  				int k=0;
  				
  				String a=p1+"";
  				String b=p2+"";
  				
  				while(j<a.length() && k<b.length()) {
  					int d1=a.charAt(j)-'0';
  					int d2=b.charAt(k)-'0';
  					if( d1!=d2 ) {
  						if(d1>d2) {
  							return ">";
  						}else {
  							return "<";
  						}
  					}
  					j++;
  					k++;
  				}
  				while(j<a.length()) {
  					int d1=a.charAt(j)-'0';
  					int d2=0;
  					if( d1!=d2 ) {
  						if(d1>d2) {
  							return ">";
  						}else {
  							return "<";
  						}
  					}
  					j++;
  				}
  				while(k<b.length()) {
  					int d1=0;
  					int d2=b.charAt(k)-'0';
  					if( d1!=d2 ) {
  						if(d1>d2) {
  							return ">";
  						}else {
  							return "<";
  						}
  					}
  					k++;
  				}
  				return "=";
  			}
  		}
  	}
  
  	public static void main(String[] args) throws Exception {
  		// TODO Auto-generated method stub
  		Reader s=new Reader();
  		int t=s.nextInt();
  		
  		for(int i=0;i<t;i++) {
  			long p1=s.nextLong();
  			long x1=s.nextLong();
  			
  			long p2=s.nextLong();
  			long x2=s.nextLong();
  			
  			System.out.println(f(p1,x1,p2,x2));
  		}
  		
  
  	}
  
  }