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: //package com.company;
  
  import java.util.*;
  import java.lang.*;
  import java.io.*;
  
  public class Main {
  
      public static FastScanner fs = new FastScanner();
      public static Scanner sc = new Scanner(System.in);
      public static PrintWriter out = new PrintWriter(System.out);
      public static int inf = 1000000007;
      public static boolean flag=true;
      public static StringBuilder sb=new StringBuilder();
  
  
      /////// For printing elements in array
  
      public static void print(long[] arr) {
          for (long x : arr) {
              out.print(x + " ");
          }
          out.println();
      }
  
      /////// For freq of elements in array
  
      public static long[] freq(long[] freq_arr, long[] arr) {
          for (long j : arr) {
              freq_arr[(int) j]++;
          }
  
          return freq_arr;
      }
  
      /////// For sum elements in array
  
      public static int sum(int[] arr) {
  
          int sum = 0;
  
          for (int j : arr) {
              sum += j;
          }
          return sum;
      }
  
      /////// For storing elements in array 1D
  
      public static long[] scan1d(long[] arr) {
          for (int i = 0; i < arr.length; i++) {
              arr[i] = sc.nextLong();
          }
  
          return arr;
      }
  
      /////// For storing elements in array 2D
  
      public static long[][] scan2d(long[][] arr) {
          for (int i = 0; i < arr.length; i++) {
              arr[i][0] = sc.nextLong();
              arr[i][1] = sc.nextLong();
          }
  
          return arr;
      }
  
      /////// For copying elements in array
  
      public static long[] copy_arr(long[] arr, long[] arr1) {
          for (int i = 0; i < arr.length; i++) {
              arr1[i] = arr[i];
          }
  
          return arr;
      }
  
      /////// For GCD
  
      public static int gcd(int a, int b) {
          if (b == 0)
              return a;
          return gcd(b, a % b);
      }
      /// gcd of array
  
      static int findGCD(int arr[], int n)
      {
          int result = 0;
          for (int element: arr){
              result = gcd(result, element);
  
              if(result == 1)
              {
                  return 1;
              }
          }
  
          return result;
      }
  
      //////// Forprime
  
      public static boolean isPrime(long n) {
          if (n < 2)
              return false;
          if (n == 2 || n == 3)
              return true;
          if (n % 2 == 0 || n % 3 == 0)
              return false;
          long sqrtN = (long) Math.sqrt(n) + 1;
          for (long i = 6L; i <= sqrtN; i += 6) {
              if (n % (i - 1) == 0 || n % (i + 1) == 0)
                  return false;
          }
          return true;
      }
  
      //////Using array as Set
      public static boolean[] arr_set(boolean[] arr, int n) {
          for (int i = 0; i < n; i++) {
              int x = sc.nextInt();
              arr[x] = true;
          }
  
          return arr;
      }
  
      static class FastScanner {
          BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
          StringTokenizer st = new StringTokenizer("");
  
          String next() {
              while (!st.hasMoreTokens())
                  try {
                      st = new StringTokenizer(br.readLine());
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
              return st.nextToken();
          }
  
          int nextInt() {
              return Integer.parseInt(next());
          }
  
          int[] readArray(int n) {
              int[] a = new int[n];
              for (int i = 0; i < n; i++) a[i] = nextInt();
              return a;
          }
  
          long nextLong() {
              return Long.parseLong(next());
          }
      }
  
  
      public static long fact(long n) {
  
          long fact = 1;
          for (long i = 1; i <= n; i++) {
              fact *= i;
          }
          return fact;
      }
  
      public static long nCr(long n, long r) {
          long res = 1;
          for (long i = 0; i < r; i++) {
              res *= (n - i);
              res /= (i + 1);
          }
          return res;
  
      }
  
      public static long pCr(long n, long r)
      {
          return fact(n) / (fact(n-r));
      }
  
      static boolean isSubSequence(String str1, String strm,
                                   int m, int n)
      {
          int j = 0;
  
          for (int i = 0; i < n && j < m; i++)
              if (str1.charAt(j) == strm.charAt(i))
                  j++;
  
          return (j == m);
      }
  
      public class bp{
          int x;
          int y;
          int val;
  
          bp(int x,int y,int val){
              this.x=x;
              this.y=y;
              this.val=val;
          }
      }
  
      public class Tree{
          class Node{
              int val;
              Node lc;
              Node rc;
          }
  
  
      }
  
  
  
  //  Arrays.sort(freq, (a, b) -> a[0] - b[0]);
  //  (fact(n)/(fact(i)*fact(n-i)))
  
      public static void main(String[] args) {
  
          long t=sc.nextLong();
  
          while (t-->0){
  
              String x1=sc.next();
              int p1=sc.nextInt();
  
              String x2=sc.next();
              int p2=sc.nextInt();
  
              int abs=Math.abs(p1-p2);
  
              int l1=x1.length();
              int l2=x2.length();
  
              if(p1>p2){
                  l1+=abs;
              }else {
                  l2+=abs;
              }
  
              if(l1>l2){
                  out.println(">");
              }else if(l2>l1){
                  out.println("<");
              }else {
                  if(p1>p2){
                      while (abs>0){
                          x1+="0";
                          abs--;
                      }
                  }else if(p2>p1) {
                      while (abs>0){
                          x2+="0";
                          abs--;
                      }
                  }
  
                  if(x1.compareTo(x2)>0){
                      out.println(">");
                  }else if(x1.compareTo(x2)<0){
                      out.println("<");
                  }else {
                      out.println("=");
                  }
              }
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
          }
          out.flush();
  
      }
  }