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.math.*;
  import java.util.* ;
  import java.io.* ;
  @SuppressWarnings("unused")
  public class cf
  {
  	static final int mod = (int)1e9+7 ;
  	static final double pi = 3.1415926536 ;
  	static boolean not_prime[] = new boolean[1000001] ;
  	static void sieve() {
  		for(int i=2 ; i*i<1000001 ; i++) {
  			if(not_prime[i]==false) {
  				for(int j=2*i ; j<1000001 ; j+=i) {
  					not_prime[j]=true ;
  				}
  			}
  		}not_prime[0]=true ; not_prime[1]=true ;
  	}	
  	public static long bexp(long base , long power)
  	{
  		long res=1L ;
  		
  		base = base%mod ;
  		
  		while(power>0) {
  			if((power&1)==1) {
  				res=(res*base)%mod ;
  				power-- ;
  			}
  			else {
  				base=(base*base)%mod ;
  				power>>=1 ;
  			}
  		}
  		
  		return res ;
  	} 
  	static long modInverse(long n, long p){return power(n, p - 2, p); }
  	static long power(long x, long y, long p)
  	{
  	  
  	    // Initialize result
  	    long res = 1;
  	    x = x % p;
  	  
  	    while (y > 0) {
  	  
  	        if (y % 2 == 1)
  	            res = (res * x) % p;
  	        
  	        y = y >> 1;
  	        x = (x * x) % p;
  	    }
  	  
  	    return res;
  	}
  	static long nCrModPFermat(int n, int r, long p){if(n<r) return 0 ;if (r == 0)return 1; long[] fac = new long[n + 1];fac[0] = 1;for (int i = 1; i <= n; i++)fac[i] = fac[i - 1] * i % p;return (fac[n] * modInverse(fac[r], p) % p* modInverse(fac[n - r], p) % p) % p;}
  	static long modular_add(long a, long b){ return ((a % mod) + (b % mod)) % mod; }
  	static long modular_sub(long a, long b){ return ((a % mod) - (b % mod) + mod) % mod; }
  	static long modular_mult(long a, long b){ return ((a % mod) * (b % mod)) % mod; }
  	static long lcm(int a, int b){ return (a / gcd(a, b)) * b; }
  	static long gcd(long a, long b){if (b == 0) {return a;}return gcd(b, a % b);}
  	
  	public static void main(String[] args)throws Exception
      {
  		FastReader in = new FastReader() ;
  //		FastIO in = new FastIO(System.in) ;
  		StringBuilder op = new StringBuilder() ;
  		int T = in.nextInt() ;
  //		int T=1 ;
  		for(int tt=0 ; tt<T ; tt++)
  		{
  			
  			String f1 = in.next();
  			String z1 = in.next() ;
  			String f2 = in.next() ;
  			String z2 = in.next() ;
  			
  			int l1 = f1.length()+Integer.parseInt(z1) ;
  			int l2 = f2.length()+Integer.parseInt(z2) ;
  			
  			if(l1>l2){
  				op.append(">\n") ;
  			}
  			else if(l1<l2) {
  				op.append("<\n") ;
  			}
  			else {
  				
  				int printed=0 ;
  				for(int i=0 ; i<Math.max(f1.length(), f2.length()) ; i++) {
  					int c1 , c2 ;
  					if(i>f1.length()-1)
  						c1=0 ;
  					else c1=f1.charAt(i)-'0' ;
  					if(i>f2.length()-1)
  						c2=0 ;
  					else
  						c2=f2.charAt(i)-'0' ;
  					if(c1>c2) {
  						op.append(">") ;printed=1 ;break ;
  					}
  					else if(c2>c1) {
  						op.append("<") ; printed=1 ; break ;
  					}
  				}
  				if(printed==0) {
  					op.append("=") ;
  				}op.append("\n") ;
  			}
  			
  		}
  		System.out.println(op.toString());
      }
  	static class pair implements Comparable<pair>
  	{
  		int first , second ;
  		pair(int first , int second){
  			this.first=first ;
  			this.second=second; 
  		}
  		@Override
  		public int compareTo(pair other) {
  			//this.first - other.first ;
  			return other.second-this.second ;
  		}
  		
  	}
  	
  	static void sort(int[] a) {
  		ArrayList<Integer> l=new ArrayList<>();
  		for (int i:a) l.add(i);
  		Collections.sort(l);
  		for (int i=0; i<a.length; i++) a[i]=l.get(i);
  	}
  	static class FastIO {
  
  		BufferedReader br= new BufferedReader(
                  new InputStreamReader(System.in));
  		
  		InputStream dis;
  		byte[] buffer = new byte[1 << 17];
  		int pointer = 0;
  
  		public FastIO(String fileName) throws Exception {
  			dis = new FileInputStream(fileName);
  		}
  
  		public FastIO(InputStream is) throws Exception {
  			dis = is;
  		}
  
  		int nextInt() throws Exception {
  			int ret = 0;
  
  			byte b;
  			do {
  				b = nextByte();
  			} while (b <= ' ');
  			boolean negative = false;
  			if (b == '-') {
  				negative = true;
  				b = nextByte();
  			}
  			while (b >= '0' && b <= '9') {
  				ret = 10 * ret + b - '0';
  				b = nextByte();
  			}
  
  			return (negative) ? -ret : ret;
  		}
  
  		long nextLong() throws Exception {
  			long ret = 0;
  
  			byte b;
  			do {
  				b = nextByte();
  			} while (b <= ' ');
  			boolean negative = false;
  			if (b == '-') {
  				negative = true;
  				b = nextByte();
  			}
  			while (b >= '0' && b <= '9') {
  				ret = 10 * ret + b - '0';
  				b = nextByte();
  			}
  
  			return (negative) ? -ret : ret;
  		}
  
  		byte nextByte() throws Exception {
  			if (pointer == buffer.length) {
  				dis.read(buffer, 0, buffer.length);
  				pointer = 0;
  			}
  			return buffer[pointer++];
  		}
  
  		String next() throws Exception {
  			StringBuffer ret = new StringBuffer();
  
  			byte b;
  			do {
  				b = nextByte();
  			} while (b <= ' ');
  			while (b > ' ') {
  				ret.appendCodePoint(b);
  				b = nextByte();
  			}
  
  			return ret.toString();
  		}
  
  		String nextLine() {
              String str = "";
              try {
                  str = br.readLine();
              }
              catch (IOException e) {
                  e.printStackTrace();
              }
              return str;
          }
  		
  		 int[] readArray(int n) throws Exception {
  				int[] a=new int[n];
  				for (int i=0; i<n; i++) a[i]=nextInt();
  				return a;
  			}
  	}
  	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;
          }
          
          int[] readArray(int n) {
  			int[] a=new int[n];
  			for (int i=0; i<n; i++) a[i]=nextInt();
  			return a;
  		}
      }
  
  }