Two T-shirt sizes are given: $a$ and $b$. The T-shirt size is either a string M or a string consisting of several (possibly zero) characters X and one of the characters S or L.

For example, strings M, XXL, S, XXXXXXXS could be the size of some T-shirts. And the strings XM, LL, SX are not sizes.

The letter M stands for medium, S for small, L for large. The letter X refers to the degree of size (from eXtra). For example, XXL is extra-extra-large (bigger than XL, and smaller than XXXL).

You need to compare two given sizes of T-shirts $a$ and $b$.

The T-shirts are compared as follows:

any small size (no matter how many letters X) is smaller than the medium size and any large size;

any large size (regardless of the number of letters X) is larger than the medium size and any small size;

the more letters X before S, the smaller the size;

the more letters X in front of L, the larger the size.

For example:

XXXS < XS

XXXL > XL

XL > M

XXL = XXL

XXXXXS < M

XL > XXXS


-----Input-----

The first line of the input contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases.

Each test case consists of one line, in which $a$ and $b$ T-shirt sizes are written. The lengths of the strings corresponding to the T-shirt sizes do not exceed $50$. It is guaranteed that all sizes are correct.


-----Output-----

For each test case, print on a separate line the result of comparing $a$ and $b$ T-shirt sizes (lines "<", ">" or "=" without quotes).


-----Examples-----

Input
6
XXXS XS
XXXL XL
XL M
XXL XXL
XXXXXS M
L M
Output
<
>
>
=
<
>


-----Note-----

None

Difficulty: EASY
Tags: String algorithms

Implementation

Starter code:

Solutions:
import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(str1, str2) = map(str, input().rstrip().split())
	if str1[-1] == 'S':
		l1 = -len(str1)
	elif str1[-1] == 'L':
		l1 = len(str1)
	else:
		l1 = 0
	if str2[-1] == 'S':
		l2 = -len(str2)
	elif str2[-1] == 'L':
		l2 = len(str2)
	else:
		l2 = 0
	if l1 > l2:
		print('>')
	elif l1 == l2:
		print('=')
	else:
		print('<')


import sys

def assign(a):
	if a[-1] == 'S':
		v = -1
	elif a[-1] == 'L':
		v = 1
	else:
		v = 0
	v *= len(a)
	return v
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s.strip())

def invr():
	return map(int, input().split())
for _ in range(inp()):
	(a, b) = input().split()
	if assign(a) > assign(b):
		print('>')
	elif assign(a) == assign(b):
		print('=')
	else:
		print('<')


import sys
from collections import *
sys.setrecursionlimit(10 ** 5)
itr = (line for line in sys.stdin.read().strip().split('\n'))
INP = lambda : next(itr)

def ni():
	return int(INP())

def nl():
	return [int(_) for _ in INP().split()]
i = ni()
for _ in range(i):
	(a, b) = INP().split(' ')
	if a[-1] == 'S':
		if b[-1] == 'L' or b[-1] == 'M':
			print('<')
		elif len(a) == len(b):
			print('=')
		elif len(a) > len(b):
			print('<')
		else:
			print('>')
	if a[-1] == 'M':
		if b == 'M':
			print('=')
		if b[-1] == 'L':
			print('<')
		if b[-1] == 'S':
			print('>')
	if a[-1] == 'L':
		if b[-1] == 'S' or b[-1] == 'M':
			print('>')
		else:
			if len(a) == len(b):
				print('=')
			if len(a) > len(b):
				print('>')
			if len(b) > len(a):
				print('<')


import sys
input = sys.stdin.readline
for tc in range(int(input())):
	(a, b) = input().split()
	if a[-1] != b[-1]:
		if a[-1] == 'S':
			print('<')
		elif a[-1] == 'M':
			print('<' if b[-1] == 'L' else '>')
		else:
			print('>')
	elif len(a) > len(b):
		if a[-1] == 'S':
			print('<')
		else:
			print('>')
	elif len(a) < len(b):
		if a[-1] == 'S':
			print('>')
		else:
			print('<')
	else:
		print('=')


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def solve():
	dic = {'S': 0, 'M': 1, 'L': 2}
	(a, b) = input().split()
	if dic[a[-1]] > dic[b[-1]]:
		print('>')
		return
	elif dic[a[-1]] < dic[b[-1]]:
		print('<')
		return
	elif a[-1] == 'L':
		if len(a) > len(b):
			print('>')
			return
		elif len(a) < len(b):
			print('<')
			return
		else:
			print('=')
			return
	elif len(a) > len(b):
		print('<')
		return
	elif len(a) < len(b):
		print('>')
		return
	else:
		print('=')
		return
t = inp()
for i in range(t):
	solve()


t = int(input())
answer = []
for _ in range(t):
	comp_str = input().split()
	T1 = comp_str[0]
	T2 = comp_str[1]
	if T1[-1] != T2[-1]:
		if T1[-1] == 'S' and T2[-1] == 'L':
			answer.append('<')
		elif T1[-1] == 'L' and T2[-1] == 'S':
			answer.append('>')
		elif T1[-1] == 'S' and T2[-1] == 'M':
			answer.append('<')
		elif T1[-1] == 'M' and T2[-1] == 'S':
			answer.append('>')
		elif T1[-1] == 'L' and T2[-1] == 'M':
			answer.append('>')
		elif T1[-1] == 'M' and T2[-1] == 'L':
			answer.append('<')
	else:
		T1_x = T1.count('X')
		T2_x = T2.count('X')
		if T1[-1] != 'S':
			if T1_x > T2_x:
				answer.append('>')
			elif T1_x < T2_x:
				answer.append('<')
			else:
				answer.append('=')
		elif T1_x > T2_x:
			answer.append('<')
		elif T1_x < T2_x:
			answer.append('>')
		else:
			answer.append('=')
for ans in answer:
	print(ans)


n = int(input())
lis = ['S', 'M', 'L']
x = [''] * n
y = [''] * n
for i in range(n):
	(x[i], y[i]) = input().split(' ')
for i in range(n):
	if x[i] == y[i]:
		print('=')
	elif x[i][-1] == y[i][-1]:
		if x[i][-1] == 'S':
			if len(x[i]) > len(y[i]):
				print('<')
			else:
				print('>')
		elif len(x[i]) > len(y[i]):
			print('>')
		else:
			print('<')
	elif lis.index(x[i][-1]) > lis.index(y[i][-1]):
		print('>')
	else:
		print('<')


import sys
n = int(sys.stdin.readline())
for i in range(n):
	(s1, s2) = list(sys.stdin.readline().split())
	a = ord(s1[-1])
	b = ord(s2[-1])
	if a > b:
		print('<')
	elif a < b:
		print('>')
	elif len(s1) > len(s2):
		if s1[-1] == 'S':
			print('<')
		else:
			print('>')
	elif len(s1) < len(s2):
		if s1[-1] == 'S':
			print('>')
		else:
			print('<')
	else:
		print('=')


shirts = []
for i in range(int(input())):
	(a, b) = input().split()
	n = a[-1]
	size = ['S', 'M', 'L']
	if a[-1] == b[-1]:
		if len(a) == len(b):
			shirts.append('=')
		elif n == 'S' and len(a) < len(b) or (n == 'L' and len(a) > len(b)):
			shirts.append('>')
		else:
			shirts.append('<')
	elif size.index(a[-1]) > size.index(b[-1]):
		shirts.append('>')
	else:
		shirts.append('<')
print('\n'.join(shirts))


def size(l, a):
	for i in l:
		if i in a:
			return i
x = int(input())
l = ['S', 'M', 'L']
printl = []
for i in range(x):
	(a, b) = input().split()
	size_a = size(l, a)
	size_b = size(l, b)
	a_x = a.count('X')
	a_b = b.count('X')
	if size_a == 'S' and size_b == 'S':
		if a_x > a_b:
			printl.append('<')
		elif a_x < a_b:
			printl.append('>')
		elif a_x == a_b:
			printl.append('=')
	elif size_a == size_b:
		if a_x > a_b:
			printl.append('>')
		elif a_x < a_b:
			printl.append('<')
		elif a_x == a_b:
			printl.append('=')
	elif size_a > size_b:
		printl.append('<')
	else:
		printl.append('>')
for i in printl:
	print(i)


t = int(input())
q = ''
for i in range(t):
	size = input().split()
	if size[0][len(size[0]) - 1] == 'S':
		if size[0][len(size[0]) - 1] == 'S' and size[1][len(size[1]) - 1] == 'S':
			if size[0].count('X') < size[1].count('X'):
				q += '>\n'
			elif size[0].count('X') == size[1].count('X'):
				q += '=\n'
			else:
				q += '<\n'
		else:
			q += '<\n'
	elif size[0][len(size[0]) - 1] == 'L':
		if size[0][len(size[0]) - 1] == 'L' and size[1][len(size[1]) - 1] == 'L':
			if size[0].count('X') < size[1].count('X'):
				q += '<\n'
			elif size[0].count('X') == size[1].count('X'):
				q += '=\n'
			else:
				q += '>\n'
		else:
			q += '>\n'
	elif size[0][len(size[0]) - 1] == 'M':
		if size[0][len(size[0]) - 1] == 'M' and size[1][len(size[1]) - 1] == 'M':
			if size[0].count('M') == size[1].count('M'):
				q += '=\n'
		elif size[1][len(size[1]) - 1] == 'S':
			q += '>\n'
		elif size[1][len(size[1]) - 1] == 'L':
			q += '<\n'
print(q)


f = lambda x: ((i := 'ML'.find(x.strip('X'))), i * len(x))
for s in [*open(0)][1:]:
	(x, y) = map(f, s.split())
	print('=<>'[(x < y) - (y < x)])


import sys
input = sys.stdin.readline
output = sys.stdout.write
t = int(input())
for i in range(t):
	S = input().split()
	f = [S[0][-1], S[1][-1]]
	if f[0] == f[1]:
		if len(S[0]) > len(S[1]):
			if f[0] == 'L':
				output('>\n')
				continue
			else:
				output('<\n')
				continue
		elif len(S[0]) < len(S[1]):
			if f[0] == 'L':
				output('<\n')
				continue
			else:
				output('>\n')
				continue
		else:
			output('=\n')
			continue
	if f[0] == 'L':
		output('>\n')
		continue
	elif f[0] == 'M':
		if f[1] == 'S':
			output('>\n')
			continue
		else:
			output('<\n')
			continue
	else:
		output('<\n')
		continue


for s in [*open(0)][1:]:
	(x, y) = ('ML'.find(x[-1]) * len(x) for x in s.split())
	print('=<>'[(x < y) - (y < x)])


input = __import__('sys').stdin.readline
for _ in range(int(input())):
	(a, b) = input().split()
	if a == 'M':
		a = 0
	elif a[-1] == 'S':
		a = -len(a)
	else:
		a = len(a)
	if b == 'M':
		b = 0
	elif b[-1] == 'S':
		b = -len(b)
	else:
		b = len(b)
	if a == b:
		print('=')
	elif a > b:
		print('>')
	else:
		print('<')


__author__ = 'vipli'
n = int(input())
out = []
size_num = {'S': 1, 'M': 2, 'L': 3}
for i in range(n):
	line = str(input())
	ary = line.strip().split(' ')
	a = ary[0]
	b = ary[1]
	a_size = a[-1]
	b_size = b[-1]
	this_rel = ''
	if a_size == b_size:
		if len(a) == len(b):
			this_rel = '='
		elif a_size == 'S':
			if len(a) > len(b):
				this_rel = '<'
			else:
				this_rel = '>'
		elif len(a) > len(b):
			this_rel = '>'
		else:
			this_rel = '<'
	else:
		a_num = size_num[a_size]
		b_num = size_num[b_size]
		if a_num > b_num:
			this_rel = '>'
		else:
			this_rel = '<'
	out.append(this_rel)
for data in out:
	print(data)


def test(a, b):
	if a == b:
		return '='
	if a.endswith('S') and b.endswith(('L', 'M')):
		return '<'
	elif a.endswith(('M', 'L')) and b.endswith('S'):
		return '>'
	elif a.endswith('M') and b.endswith('L'):
		return '<'
	elif a.endswith('L') and b.endswith('M'):
		return '>'
	elif a.endswith('S') and b.endswith('S'):
		if len(a) > len(b):
			return '<'
		else:
			return '>'
	elif a.endswith('L') and b.endswith('L'):
		if len(a) > len(b):
			return '>'
		else:
			return '<'
x = int(input())
results = []
for i in range(1, x + 1):
	string = input()
	list1 = string.split(' ')
	a = list1[0]
	b = list1[1]
	results.append(test(a, b))
for i in results:
	print(i)


import sys
n = int(sys.stdin.readline())
while n > 0:
	t = sys.stdin.readline().strip().split()
	x1 = len(t[0]) - 1
	s1 = t[0][x1]
	x2 = len(t[1]) - 1
	s2 = t[1][x2]
	if s1 != s2:
		if s1 > s2:
			print('<')
		else:
			print('>')
	elif x1 == x2:
		print('=')
	elif s1 == 'S':
		if x1 > x2:
			print('<')
		else:
			print('>')
	elif x1 > x2:
		print('>')
	else:
		print('<')
	n = n - 1


import sys
input = sys.stdin.readline

def solve():
	(a, b) = input().split()
	if a[-1] == b[-1]:
		if len(a) > len(b):
			return '<' if a[-1] == 'S' else '>'
		elif len(a) == len(b):
			return '='
		else:
			return '>' if a[-1] == 'S' else '<'
	else:
		v1 = v2 = 0
		if a[-1] == 'S':
			v1 += 1
		elif a[-1] == 'M':
			v1 += 2
		else:
			v1 += 3
		if b[-1] == 'S':
			v2 += 1
		elif b[-1] == 'M':
			v2 += 2
		else:
			v2 += 3
		return '>' if v1 > v2 else '<'
for _ in range(int(input())):
	print(solve())


from math import *
import sys

def input():
	return sys.stdin.readline().replace('\n', '').strip()
sys.setrecursionlimit(10 ** 9)
for _ in range(int(input())):
	(a, b) = input().split()
	if a == b:
		print('=')
	elif a == 'M':
		if 'L' in b:
			print('<')
		else:
			print('>')
	elif b == 'M':
		if 'L' in a:
			print('>')
		else:
			print('<')
	elif a[-1] == b[-1]:
		n1 = a.count('X')
		n2 = b.count('X')
		if a[-1] == 'L':
			if n1 > n2:
				print('>')
			else:
				print('<')
		elif n1 < n2:
			print('>')
		else:
			print('<')
	elif a[-1] == 'L':
		print('>')
	else:
		print('<')


t = int(input())
ans = []
for _ in range(t):
	(a, b) = input().split()
	if a[-1] == b[-1]:
		if a[-1] == 'S':
			if len(a) > len(b):
				ans.append('<')
			elif len(a) == len(b):
				ans.append('=')
			else:
				ans.append('>')
		if a[-1] == 'L':
			if len(a) > len(b):
				ans.append('>')
			elif len(a) == len(b):
				ans.append('=')
			else:
				ans.append('<')
		if a[-1] == 'M':
			ans.append('=')
	elif a[-1] == 'M':
		if b[-1] == 'L':
			ans.append('<')
		elif b[-1] == 'S':
			ans.append('>')
	elif a[-1] == 'S':
		ans.append('<')
	elif a[-1] == 'L':
		ans.append('>')
print(*ans, sep='\n')


s = int(input())
ans = []
for i in range(s):
	(a, b) = map(str, input().split())
	(ra, rb) = (a[-1], b[-1])
	if ra == 'M':
		a = 0
	elif ra == 'L':
		a = (a.count('X') + 1) * 1
	else:
		a = (a.count('X') + 1) * -1
	if rb == 'M':
		b = 0
	elif rb == 'L':
		b = (b.count('X') + 1) * 1
	else:
		b = (b.count('X') + 1) * -1
	if a > b:
		ans.append('>')
	elif a == b:
		ans.append('=')
	else:
		ans.append('<')
print(*ans, sep='\n')


from sys import stdin
t = int(stdin.readline().strip())
for i in range(t):
	(n, m) = map(str, stdin.readline().split())
	if n == m:
		print('=')
	elif n[len(n) - 1] == m[len(m) - 1]:
		if n[len(n) - 1] == 'L':
			if len(n) > len(m):
				print('>')
			else:
				print('<')
		elif len(n) < len(m):
			print('>')
		else:
			print('<')
	elif n[len(n) - 1] == 'S':
		print('<')
	elif n[len(n) - 1] == 'M':
		if m[len(m) - 1] == 'S':
			print('>')
		else:
			print('<')
	else:
		print('>')


def vl(s):
	return len(s) * 'ML'.find(s[-1])
for s in [*open(0)][1:]:
	(a, b) = s.split()
	print('=<>'[(vl(a) < vl(b)) - (vl(a) > vl(b))])


t = int(input())
outputs = []

def convert(size):
	sizeValue = 0
	if size.lower() == 'm':
		sizeValue = 0
	elif size.lower()[-1] == 's':
		sizeValue = -len(size)
	elif size.lower()[-1] == 'l':
		sizeValue = len(size)
	return sizeValue
for testCase in range(t):
	(a, b) = input().split()
	(a, b) = (convert(a), convert(b))
	if a > b:
		outputs.append('>')
	elif a == b:
		outputs.append('=')
	elif a < b:
		outputs.append('<')
for output in outputs:
	print(output)


li = []
test_case = int(input())
for i in range(test_case):
	(a, b) = input().split()
	if 'S' in a and 'S' in b:
		if len(a) > len(b):
			li.append('<')
		elif len(a) < len(b):
			li.append('>')
		elif len(a) == len(b):
			li.append('=')
	elif 'L' in a and 'L' in b:
		if len(a) > len(b):
			li.append('>')
		elif len(a) < len(b):
			li.append('<')
		elif len(a) == len(b):
			li.append('=')
	elif 'S' in a and 'M' in b:
		li.append('<')
	elif 'M' in a and 'S' in b:
		li.append('>')
	elif 'S' in a and 'L' in b:
		li.append('<')
	elif 'L' in a and 'S' in b:
		li.append('>')
	elif 'M' in a and 'L' in b:
		li.append('<')
	elif 'L' in a and 'M' in b:
		li.append('>')
	elif 'M' in a and 'M' in b:
		li.append('=')
for item in li:
	print(item)


from functools import lru_cache as cache
from collections import Counter, defaultdict, deque
import math
import bisect
import string
from heapq import *
import sys

def get_int():
	return int(input())

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_str():
	return sys.stdin.readline().strip()

def main():
	testcases = get_int()
	for _ in range(testcases):
		ss = get_str()
		(a, b) = ss.split()
		print(solve(a, b))

def solve(a, b):
	if a[-1] < b[-1]:
		return '>'
	if a[-1] > b[-1]:
		return '<'
	if a[-1] == 'S':
		if len(a) > len(b):
			return '<'
		if len(a) < len(b):
			return '>'
	if a[-1] == 'L':
		if len(a) > len(b):
			return '>'
		if len(a) < len(b):
			return '<'
	return '='
main()


n = int(input())
z = []
for i in range(n):
	s = input().split()
	if s[0] == s[1]:
		z.append('=')
	elif 'S' in s[0]:
		if 'S' in s[1]:
			if len(s[0]) > len(s[1]):
				z.append('<')
			else:
				z.append('>')
		else:
			z.append('<')
	elif 'M' in s[0]:
		if 'S' in s[1]:
			z.append('>')
		else:
			z.append('<')
	elif 'L' in s[1]:
		if len(s[0]) > len(s[1]):
			z.append('>')
		else:
			z.append('<')
	else:
		z.append('>')
for i in range(n):
	print(z[i])


out = []
for _ in range(int(input())):
	(s1, s2) = input().split()
	if s1 == s2:
		out.append('=')
		continue
	if s1 == 'M':
		if s2[-1] == 'L':
			out.append('<')
		else:
			out.append('>')
	elif s2 == 'M':
		if s1[-1] == 'L':
			out.append('>')
		else:
			out.append('<')
	elif s1[-1] == 'S':
		if s2[-1] == 'L' or len(s2) < len(s1):
			out.append('<')
		else:
			out.append('>')
	elif s2[-1] == 'S' or len(s2) < len(s1):
		out.append('>')
	else:
		out.append('<')
for i in out:
	print(i)


def test(tc):
	s1 = 0
	s2 = 0
	if tc[0][-1] == 'M':
		s1 = 0
	elif tc[0][-1] == 'L':
		s1 = len(tc[0])
	else:
		s1 = -len(tc[0])
	if tc[1][-1] == 'M':
		s2 = 0
	elif tc[1][-1] == 'L':
		s2 = len(tc[1])
	else:
		s2 = -len(tc[1])
	if s1 < s2:
		return '<'
	elif s1 > s2:
		return '>'
	else:
		return '='

def t_input():
	a = input()
	return a.split()
tcaseno = int(input())
tcases = []
for i in range(tcaseno):
	tcases.append(t_input())
results = []
for tcase in tcases:
	results.append(test(tcase))
for res in results:
	print(res)


t = int(input())
for i in range(t):
	(n, m) = input().split()
	if n == m:
		print('=')
	elif 'S' in n and 'S' not in m:
		print('<')
	elif 'M' in n and 'M' not in m and ('S' not in m):
		print('<')
	elif 'S' in m and 'S' not in n:
		print('>')
	elif 'M' in m and 'M' not in n and ('S' not in n):
		print('>')
	elif 'L' in n and 'L' not in m:
		print('>')
	elif 'L' in m and 'L' not in n:
		print('<')
	elif 'S' in n and 'S' in m:
		if len(n) > len(m):
			print('<')
		else:
			print('>')
	elif 'M' in n and 'M' in m:
		if len(n) > len(m):
			print('<')
		else:
			print('>')
	elif 'L' in n and 'L' in m:
		if len(n) > len(m):
			print('>')
		else:
			print('<')


d = {'S': 0, 'M': 1, 'L': 2}
T = int(input())
for _ in range(T):
	(a, b) = input().split()
	if d[a[-1]] > d[b[-1]]:
		print('>')
	elif d[a[-1]] < d[b[-1]]:
		print('<')
	elif len(a) == len(b):
		print('=')
	elif a[-1] == 'L':
		print('>' if len(a) > len(b) else '<')
	else:
		print('>' if len(a) < len(b) else '<')


import sys
from math import gcd

def inp():
	return sys.stdin.readline().strip()

def get_ints():
	return map(int, inp().split())

def get_arr():
	return list(map(int, inp().split()))

def get_int():
	return int(inp())
t = get_int()
for _ in range(t):
	s = inp().split()
	if s[0] == s[1]:
		print('=')
	elif s[0].find('S') != -1 and s[1].find('S') != -1:
		if s[0].count('X') > s[1].count('X'):
			print('<')
		elif s[0].count('X') < s[1].count('X'):
			print('>')
		else:
			print('=')
	elif s[0].find('L') != -1 and s[1].find('L') != -1:
		if s[0].count('X') > s[1].count('X'):
			print('>')
		elif s[0].count('X') < s[1].count('X'):
			print('<')
		else:
			print('=')
	elif s[0].find('L') != -1 and s[1].find('S') != -1:
		print('>')
	elif s[0].find('S') != -1 and s[1].find('L') != -1:
		print('<')
	elif s[0].find('M') != -1 and s[1].find('L') != -1:
		print('<')
	elif s[0].find('L') != -1 and s[1].find('M') != -1:
		print('>')
	elif s[0].find('M') != -1 and s[1].find('S') != -1:
		print('>')
	elif s[0].find('S') != -1 and s[1].find('M') != -1:
		print('<')


def check(a, b):
	len_a = len(a)
	len_b = len(b)
	if a[-1] == 'S':
		if b[-1] == 'M' or b[-1] == 'L':
			return '<'
		else:
			if len_a > len_b:
				return '<'
			return '>'
	if a[-1] == 'M':
		if b[-1] == 'S':
			return '>'
		elif b[-1] == 'L':
			return '<'
	if a[-1] == 'L':
		if b[-1] == 'S' or b[-1] == 'M':
			return '>'
		else:
			if len_a > len_b:
				return '>'
			return '<'
	return True
t = int(input())
for _ in range(t):
	(a, b) = input().split()
	if a == b:
		print('=')
		continue
	else:
		print(check(a, b))


a = int(input())
for x in range(a):
	(k, l) = input().split()
	if k[len(k) - 1] == l[len(l) - 1]:
		if len(k) > len(l) and k[len(k) - 1] == 'S':
			p = '<'
		elif len(k) < len(l) and k[len(k) - 1] == 'S':
			p = '>'
		elif len(k) < len(l) and k[len(k) - 1] == 'L':
			p = '<'
		elif len(k) > len(l) and k[len(k) - 1] == 'L':
			p = '>'
		elif len(k) == len(l):
			p = '='
	elif k[len(k) - 1] == 'M' and l[len(l) - 1] == 'S':
		p = '>'
	elif k[len(k) - 1] == 'M' and l[len(l) - 1] == 'L':
		p = '<'
	elif k[len(k) - 1] == 'S' and l[len(l) - 1] == 'M':
		p = '<'
	elif k[len(k) - 1] == 'L' and l[len(l) - 1] == 'M':
		p = '>'
	elif k[len(k) - 1] == 'S' and l[len(l) - 1] == 'L':
		p = '<'
	elif k[len(k) - 1] == 'L' and l[len(l) - 1] == 'S':
		p = '>'
	print(p)


num = int(input())
Array = [0] * num
for i in range(num):
	st = str(input())
	st1 = st[:st.find(' ')]
	st2 = st[st.find(' ') + 1:]
	if st1[-1] == 'M' and st2[-1] == 'S':
		Array[i] = '>'
	elif st1[-1] == 'S' and st2[-1] == 'M':
		Array[i] = '<'
	elif st1[-1] == 'M' and st2[-1] == 'L':
		Array[i] = '<'
	elif st1[-1] == 'L' and st2[-1] == 'M':
		Array[i] = '>'
	elif st1[-1] == 'M' and st2[-1] == 'M':
		Array[i] = '='
	elif st1[-1] == 'S' and st2[-1] == 'S':
		if len(st1) > len(st2):
			Array[i] = '<'
		elif len(st1) < len(st2):
			Array[i] = '>'
		elif len(st1) == len(st2):
			Array[i] = '='
	elif st1[-1] == 'L' and st2[-1] == 'L':
		if len(st1) > len(st2):
			Array[i] = '>'
		elif len(st1) < len(st2):
			Array[i] = '<'
		elif len(st1) == len(st2):
			Array[i] = '='
	elif st1[-1] == 'S' and st2[-1] == 'L':
		Array[i] = '<'
	elif st1[-1] == 'L' and st2[-1] == 'S':
		Array[i] = '>'
for i in range(num):
	print(Array[i])


r = {1: '>', 0: '<'}
for i in range(int(input())):
	(s1, s2) = input().split()
	if s1[-1] != s2[-1]:
		if s1[-1] > s2[-1]:
			print('<')
		else:
			print('>')
	else:
		x1 = s1.count('X')
		x2 = s2.count('X')
		if x1 - x2 == 0:
			print('=')
		elif s1[-1] == 'L':
			print(r[x1 > x2])
		else:
			print(r[not x1 > x2])


t = int(input())
size_str = [input().split(' ') for _ in range(t)]
for _ in size_str:
	if _[0][-1] > _[1][-1]:
		print('<')
	if _[0][-1] < _[1][-1]:
		print('>')
	if _[0][-1] == _[1][-1]:
		if _[0][-1] == 'M':
			print('=')
		if _[0][-1] == 'S':
			if _[0].count('X') > _[1].count('X'):
				print('<')
			if _[0].count('X') < _[1].count('X'):
				print('>')
			if _[0].count('X') == _[1].count('X'):
				print('=')
		if _[0][-1] == 'L':
			if _[0].count('X') > _[1].count('X'):
				print('>')
			if _[0].count('X') < _[1].count('X'):
				print('<')
			if _[0].count('X') == _[1].count('X'):
				print('=')


t = int(input())
for t1 in range(t):
	(a, b) = input().split()
	count1 = len(a) - 1
	count2 = len(b) - 1
	if a == b:
		print('=')
		continue
	if a[-1] == b[-1]:
		if a[-1] == 'S':
			if count1 < count2:
				print('>')
			else:
				print('<')
		elif count1 < count2:
			print('<')
		else:
			print('>')
	elif a[-1] == 'S':
		print('<')
	elif a[-1] == 'M':
		if b[-1] == 'S':
			print('>')
		else:
			print('<')
	else:
		print('>')


ans = []
for _ in range(int(input())):
	(a, b) = input().split()
	la = len(a)
	lb = len(b)
	if ascii(a[la - 1]) < ascii(b[lb - 1]):
		ans.append('>')
	elif ascii(a[la - 1]) > ascii(b[lb - 1]):
		ans.append('<')
	elif a[la - 1] == 'S':
		if la > lb:
			ans.append('<')
		elif la < lb:
			ans.append('>')
		else:
			ans.append('=')
	elif a[la - 1] == 'L':
		if la > lb:
			ans.append('>')
		elif la < lb:
			ans.append('<')
		else:
			ans.append('=')
	else:
		ans.append('=')
for e in ans:
	print(e)


def test(t):
	size = []
	t = t.split(' ')
	for i in range(2):
		if 'L' in t[i]:
			s = 3
		elif 'M' in t[i]:
			s = 2
		else:
			s = 1
		size.append((s, str(t[i]).count('X')))
	if size[0][0] == size[1][0]:
		if size[0][0] == 1:
			if size[0][1] == size[1][1]:
				print('=')
			elif size[0][1] > size[1][1]:
				print('<')
			else:
				print('>')
		elif size[0][1] == size[1][1]:
			print('=')
		elif size[0][1] > size[1][1]:
			print('>')
		else:
			print('<')
	elif size[0][0] > size[1][0]:
		print('>')
	else:
		print('<')
inp = []
for i in range(int(input())):
	t = input()
	inp.append(t)
for i in inp:
	test(i)


t = int(input())
a = [[0] * 2] * t
for j in range(t):
	(str1, str2) = map(str, input().split())
	a[j] = (str1, str2)
for i in range(t):
	str1 = a[i][0]
	str2 = a[i][1]
	if str1 == str2:
		print('=')
	else:
		if str1[-1] == 'S':
			mas1 = -1 - (len(str1) - 1)
		elif str1[-1] == 'L':
			mas1 = 1 + (len(str1) - 1)
		elif str1[-1] == 'M':
			mas1 = 0
		if str2[-1] == 'S':
			mas2 = -1 - (len(str2) - 1)
		elif str2[-1] == 'L':
			mas2 = 1 + (len(str2) - 1)
		elif str2[-1] == 'M':
			mas2 = 0
		if mas1 > mas2:
			print('>')
		else:
			print('<')


n = int(input())
ls = []
for i in range(n):
	ls.append(input().split())
ans = []
d = {'M': 2, 'S': 1, 'L': 3}

def getres(ls):
	for (x, y) in ls:
		if d[x[-1]] < d[y[-1]]:
			ans.append('<')
		elif d[x[-1]] > d[y[-1]]:
			ans.append('>')
		elif x == y:
			ans.append('=')
		elif x[-1] == 'S':
			if len(x) > len(y):
				ans.append('<')
			else:
				ans.append('>')
		elif len(x) > len(y):
			ans.append('>')
		else:
			ans.append('<')
getres(ls)
for i in ans:
	print(i)


n = int(input())
ans = []
for i in range(n):
	(m, n) = map(str, input().split())
	if m[-1] == n[-1]:
		if len(m) == len(n):
			ans.append('=')
		elif m[-1] == 'S' and len(m) > len(n) or (m[-1] == 'L' and len(m) < len(n)):
			ans.append('<')
		else:
			ans.append('>')
	elif m[-1] == 'S' and n[-1] == 'M' or (m[-1] == 'S' and n[-1] == 'L') or (m[-1] == 'M' and n[-1] == 'L'):
		ans.append('<')
	else:
		ans.append('>')
for s in ans:
	print(str(s))


from sys import stdin, maxsize
from collections import defaultdict
from math import ceil, factorial
from copy import deepcopy
import itertools
from queue import PriorityQueue
import heapq

def rei():
	return reis()[0]

def reis():
	return list(map(int, stdin.readline().strip().split(' ')))

def res():
	return stdin.readline().rstrip()
d = {'S': 0, 'M': 1, 'L': 2}

def solve():
	(a, b) = res().split(' ')
	aa = d[a[-1]]
	bb = d[b[-1]]
	if aa < bb:
		print('<')
		return
	if aa > bb:
		print('>')
		return
	elif a[-1] == 'S':
		if len(a) == len(b):
			print('=')
		elif len(a) > len(b):
			print('<')
		else:
			print('>')
	elif a[-1] == 'M':
		print('=')
	elif len(a) == len(b):
		print('=')
	elif len(a) > len(b):
		print('>')
	else:
		print('<')
t = rei()
for _ in range(t):
	solve()


t = int(input())
res = []

def mat(a, b):
	s = -1
	m = 0
	x = 1
	large = 2
	gen = 0
	a = a.upper()
	for i in a:
		if i == 'X':
			x += 2
		elif i != 'X':
			if i == 'L':
				gen = x * large
			elif i == 'S':
				gen = x * s
			elif i == 'M':
				gen = 0
	s1 = -1
	m1 = 0
	x1 = 1
	large1 = 2
	gen1 = 0
	b = b.upper()
	for i1 in b:
		if i1 == 'X':
			x1 += 2
		elif i1 != 'X':
			if i1 == 'L':
				gen1 = x1 * large1
			elif i1 == 'S':
				gen1 = x1 * s1
			elif i1 == 'M':
				gen1 = 0
	if gen > gen1:
		return '>'
	elif gen == gen1:
		return '='
	else:
		return '<'
for i in range(t):
	(one, two) = input().split()
	res.append(mat(one, two))
for i in res:
	print(i)


t = int(input())
for i in range(t):
	(a, b) = input().split()
	c = 0
	v = 0
	if a[-1] != b[-1]:
		if a[-1] == 'L':
			print('>')
		elif a[-1] == 'M' and b[-1] != 'L':
			print('>')
		else:
			print('<')
	else:
		from collections import Counter
		letter = 'X'
		counts = Counter(a)
		c = counts[letter]
		counts1 = Counter(b)
		v = counts1[letter]
		if a[-1] == 'S':
			if c > v:
				print('<')
			elif v > c:
				print('>')
			else:
				print('=')
		elif c > v:
			print('>')
		elif v > c:
			print('<')
		else:
			print('=')


tc = int(input())
lst = []
d = {'S': -1, 'M': 1, 'L': 2}
for i in range(tc):
	(a, b) = map(str, input().split())
	c1 = (a.count('X') + 1) * d[a[-1]]
	c2 = (b.count('X') + 1) * d[b[-1]]
	if c1 > c2:
		lst.append('>')
	if c1 < c2:
		lst.append('<')
	if c1 == c2:
		lst.append('=')
for i in lst:
	print(i)


n = int(input())
Xa = 0
Xb = 0
Sa = 0
Sb = 0
La = 0
Lb = 0
M = 0
output = []
for i in range(n):
	(a, b) = map(str, input().split())
	if 'X' in a or b:
		Xa += len(a) - 1
		Xb += len(b) - 1
	if 'S' in a:
		Sa -= 1
	if 'S' in b:
		Sb -= 1
	if 'L' in a:
		La += 1
	if 'L' in b:
		Lb += 1
	if 'X' and 'S' in a:
		Xa *= -1
	if 'X' and 'S' in b:
		Xb *= -1
	A = Xa + La + Sa + M
	B = Xb + Lb + Sb + M
	Xa = 0
	Xb = 0
	Sa = 0
	Sb = 0
	La = 0
	Lb = 0
	M = 0
	if A > B:
		output.append('>')
	elif A < B:
		output.append('<')
	else:
		output.append('=')
for j in output:
	print(j)


for _ in range(int(input())):
	(x, y) = input().split()
	if x == y:
		print('=')
	elif x[-1] != y[-1]:
		if x[-1] > y[-1]:
			print('<')
		else:
			print('>')
	elif x[-1] == 'S':
		print('>' if x.count('X') < y.count('X') else '<')
	elif x[-1] == 'L':
		print('<' if x.count('X') < y.count('X') else '>')


def checkSize(shirts):
	(shirt1, shirt2) = shirts.split(' ')
	index1 = len(shirt1) - 1
	index2 = len(shirt2) - 1
	dic = {'S': 2, 'M': 3, 'L': 4, 'X': 1}
	if shirt1[index1] == shirt2[index2] == 'S':
		if len(shirt1) > len(shirt2):
			return '<'
		elif len(shirt1) < len(shirt2):
			return '>'
		return '='
	sum1 = 0
	sum2 = 0
	while index1 >= 0 and index2 >= 0:
		sum1 += dic.get(shirt1[index1])
		sum2 += dic.get(shirt2[index2])
		if sum1 > sum2:
			return '>'
		elif sum1 < sum2:
			return '<'
		index1 -= 1
		index2 -= 1
	if index1 >= 0:
		return '>'
	elif index2 >= 0:
		return '<'
	else:
		return '='
testCase = []
size = int(input())
for i in range(size):
	testCase.append(input())
for i in testCase:
	print(checkSize(i))


no_test = int(input())
ans = []
for i in range(no_test):
	shirt_size = list(input().split(' '))
	size_order = {'S': 0, 'M': 1, 'L': 2}
	shirt_one = len(shirt_size[0])
	shirt_two = len(shirt_size[1])
	if shirt_size[0][shirt_one - 1] == shirt_size[1][shirt_two - 1]:
		if shirt_size[0][shirt_one - 1] == 'S':
			if shirt_one > shirt_two:
				ans.append('<')
			elif shirt_one == shirt_two:
				ans.append('=')
			else:
				ans.append('>')
		elif shirt_one > shirt_two:
			ans.append('>')
		elif shirt_one == shirt_two:
			ans.append('=')
		else:
			ans.append('<')
	elif size_order[shirt_size[0][shirt_one - 1]] > size_order[shirt_size[1][shirt_two - 1]]:
		ans.append('>')
	else:
		ans.append('<')
for i in ans:
	print(i)


size = int(input())
for index in range(1, size + 1):
	(tshirt_1, tshirt_2) = map(str, input().split())
	if len(tshirt_1) == len(tshirt_2):
		if tshirt_1[-1] == tshirt_2[-1]:
			print('=')
		elif tshirt_1[-1] > tshirt_2[-1]:
			print('<')
		else:
			print('>')
	elif tshirt_1[-1] == tshirt_2[-1] and tshirt_1[-1] == 'L':
		if len(tshirt_1) > len(tshirt_2):
			print('>')
		else:
			print('<')
	elif tshirt_1[-1] == tshirt_2[-1] and tshirt_1[-1] == 'S':
		if len(tshirt_1) > len(tshirt_2):
			print('<')
		else:
			print('>')
	elif tshirt_1[-1] > tshirt_2[-1]:
		print('<')
	else:
		print('>')


import sys
readline = sys.stdin.readline
S = 'SML'
T = int(readline())
for _ in range(T):
	(a, b) = readline().split()
	a_idx = S.index(a[-1])
	b_idx = S.index(b[-1])
	if a_idx == b_idx:
		if a_idx == 0:
			if len(a) == len(b):
				print('=')
			elif len(a) > len(b):
				print('<')
			else:
				print('>')
		elif a_idx == 1:
			print('=')
		elif len(a) == len(b):
			print('=')
		elif len(a) > len(b):
			print('>')
		else:
			print('<')
	elif a_idx < b_idx:
		print('<')
	else:
		print('>')


t = int(input())
output = []
for i in range(t):
	(a, b) = input().split()
	aS = a.count('S')
	bS = b.count('S')
	aM = a.count('M')
	bM = b.count('M')
	aL = a.count('L')
	bL = b.count('L')
	aX = a.count('X')
	bX = b.count('X')
	if aL == 1 or bL == 1:
		if aL > bL:
			output.append('>')
		if aL < bL:
			output.append('<')
		if aL == 1 and bL == 1:
			if aX > bX:
				output.append('>')
			elif aX < bX:
				output.append('<')
			else:
				output.append('=')
	elif aM == 1 or bM == 1:
		if aM < bM:
			output.append('<')
		elif aM > bM:
			output.append('>')
		else:
			output.append('=')
	elif aX > bX:
		output.append('<')
	elif aX < bX:
		output.append('>')
	else:
		output.append('=')
for i in output:
	print(i)


for _ in range(int(input())):
	(s1, s2) = input().split()
	if s1 == s2:
		print('=')
		continue
	n1 = len(s1) * {'S': -1, 'M': 0, 'L': 1}[s1[-1]]
	n2 = len(s2) * {'S': -1, 'M': 0, 'L': 1}[s2[-1]]
	print('>' if n1 > n2 else '<')


def tshirt_value(tshirt):
	tshirt_sizes = {'S': -1, 'M': 0, 'L': 1}
	value = 1
	for letter in tshirt:
		value *= 10 if letter == 'X' else tshirt_sizes[letter]
	return value

def main():
	number_of_test_cases = int(input())
	answers = []
	for test_case in range(number_of_test_cases):
		(tshirt_1, tshirt_2) = input().split()
		value_1 = tshirt_value(tshirt_1)
		value_2 = tshirt_value(tshirt_2)
		answers.append('<' if value_1 < value_2 else '=' if value_1 == value_2 else '>')
	for answer in answers:
		print(answer)
main()


dic = {'S': 0, 'M': 1, 'L': 2}
testcases = int(input())
for _ in range(testcases):
	(a, b) = input().split()
	if dic[a[-1]] > dic[b[-1]]:
		print('>')
	elif dic[a[-1]] < dic[b[-1]]:
		print('<')
	else:
		ax = a.count('X')
		bx = b.count('X')
		if a[-1] == 'S':
			if ax > bx:
				print('<')
			elif ax < bx:
				print('>')
			else:
				print('=')
		elif ax > bx:
			print('>')
		elif ax < bx:
			print('<')
		else:
			print('=')


n = int(input())
for i in range(n):
	size = input().split()
	(x, y) = (size[0], size[1])
	if x[-1] == 'S' and y[-1] == 'M':
		print('<')
	elif x[-1] == 'M' and y[-1] == 'S':
		print('>')
	elif x[-1] == 'M' and y[-1] == 'L':
		print('<')
	elif x[-1] == 'L' and y[-1] == 'M':
		print('>')
	elif x[-1] == 'S' and y[-1] == 'L':
		print('<')
	elif x[-1] == 'L' and y[-1] == 'S':
		print('>')
	elif x[-1] == y[-1]:
		if x[-1] == 'M':
			print('=')
		elif x[-1] == 'L':
			if len(x) == len(y):
				print('=')
			elif len(x) < len(y):
				print('<')
			else:
				print('>')
		elif x[-1] == 'S':
			if len(x) == len(y):
				print('=')
			elif len(x) < len(y):
				print('>')
			else:
				print('<')


testcases = int(input())
sizesDict = {'S': -1, 'M': 0, 'L': 1}
for _ in range(testcases):
	sizes = input().split()
	size1 = sizes[0]
	size2 = sizes[1]
	if sizesDict[size1[-1]] > sizesDict[size2[-1]]:
		print('>')
	elif sizesDict[size1[-1]] < sizesDict[size2[-1]]:
		print('<')
	elif len(size1) == len(size2):
		print('=')
	elif len(size1) > len(size2):
		if size1[-1] == 'L':
			print('>')
		else:
			print('<')
	elif size1[-1] == 'L':
		print('<')
	else:
		print('>')