In a Berland's zoo there is an enclosure with camels. It is known that camels like to spit. Bob watched these interesting animals for the whole day and registered in his notepad where each animal spitted. Now he wants to know if in the zoo there are two camels, which spitted at each other. Help him to solve this task.The trajectory of a camel's spit is an arc, i.e. if the camel in position x spits d meters right, he can hit only the camel in position x + d, if such a camel exists.

The first line contains integer n (1 ≤ n ≤ 100) — the amount of camels in the zoo. Each of the following n lines contains two integers xi and di ( - 104 ≤ xi ≤ 104, 1 ≤ |di| ≤ 2·104) — records in Bob's notepad. xi is a position of the i-th camel, and di is a distance at which the i-th camel spitted. Positive values of di correspond to the spits right, negative values correspond to the spits left. No two camels may stand in the same position.

If there are two camels, which spitted at each other, output YES. Otherwise, output NO.

package main

import (
	"fmt"
	"bytes"
	"os"
	"io/ioutil"
)

func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewBuffer(bs)

	var n int
	fmt.Fscanf(reader,"%d\n", &n)
	pos := make([]int, n)
	dist := make([]int, n)
	for i := 0;i < n;i ++ {
		fmt.Fscanf(reader, "%d %d\n", &pos[i], &dist[i])
		for j := 0;j < i;j ++ {
			if pos[j] + dist[j] == pos[i] && pos[i] + dist[i] == pos[j] {
				fmt.Printf("YES")
				return
			}
		}
	}
	fmt.Printf("NO")
}

package main

import (
	"os"
	"bufio"
	"fmt"
)

var r *bufio.Reader = bufio.NewReader(os.Stdin)
var w *bufio.Writer = bufio.NewWriter(os.Stdout)

func main() {
	defer w.Flush()

	var n int
	fmt.Fscanf(r, "%d\n", &n)
	m := make(map[int]int)
	var x, d int
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%d %d\n", &x, &d)
		m[x] = d
	}

	for k, v := range m {
		if m[k+v] + k + v == k {
			fmt.Fprintf(w, "YES")
			return
		}
	}
	fmt.Fprintf(w, "NO")
}

package main

import "fmt"

const maxn = 102

func main() {
	var n int

	fmt.Scanf("%d\n", &n)

	pos := make([]int, maxn)
	d := make([]int, maxn)

	for i := 0; i < n; i++ {
		fmt.Scanf("%d %d\n", &pos[i], &d[i])
	}

	flag := false
	for i := 0; i < n-1; i++ {
		for j := i + 1; j < n; j++ {
			if pos[i]+d[i] == pos[j] && d[i] == -d[j] {
				flag = true
				break
			}
		}

		if flag {
			break
		}
	}

	if flag {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


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

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.

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

6

XXXS XS

XXXL XL

XL M

XXL XXL

XXXXXS M

L M

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	num, _ := strconv.Atoi(sc.Text())

	for i := 0; i < num; i++ {
		sc.Scan()
		sizes := strings.Split(sc.Text(), " ")

		x1 := strings.Count(sizes[0], "X")
		m1 := strings.Count(sizes[0], "M")
		l1 := strings.Count(sizes[0], "L")
		s1 := strings.Count(sizes[0], "S")

		x2 := strings.Count(sizes[1], "X")
		m2 := strings.Count(sizes[1], "M")
		l2 := strings.Count(sizes[1], "L")
		s2 := strings.Count(sizes[1], "S")

		if sizes[0] == sizes[1] {

			fmt.Println("=")

		} else if (s1 != 0 && m2 != 0) || (s1 != 0 && l2 != 0) || (m1 != 0 && l2 != 0) {

			fmt.Println("<")

		} else if (m1 != 0 && s2 != 0) || (l1 != 0 && s2 != 0) || (l1 != 0 && m2 != 0) {

			fmt.Println(">")

		} else if l1 != 0 && l2 != 0 {
			if x1 > x2 {
				fmt.Println(">")
			} else if x1 < x2 {
				fmt.Println("<")
			} else {
				fmt.Println("=")
			}
		} else if s1 != 0 && s2 != 0 {
			if x1 > x2 {
				fmt.Println("<")
			} else if x1 < x2 {
				fmt.Println(">")
			} else {
				fmt.Println("=")
			}
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	num, _ := strconv.Atoi(sc.Text())

	for i := 0; i < num; i++ {
		sc.Scan()
		sizes := strings.Split(sc.Text(), " ")

		x1 := strings.Count(sizes[0], "X")
		m1 := strings.Count(sizes[0], "M")
		l1 := strings.Count(sizes[0], "L")
		s1 := strings.Count(sizes[0], "S")

		x2 := strings.Count(sizes[1], "X")
		m2 := strings.Count(sizes[1], "M")
		l2 := strings.Count(sizes[1], "L")
		s2 := strings.Count(sizes[1], "S")

		// if s1 != 0 && s2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println(sizes, " <")
		// 	} else if x1 < x2 {
		// 		fmt.Println(sizes, " >")
		// 	} else {
		// 		fmt.Println(sizes, " =")
		// 	}

		// } else if l1 != 0 && l2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println(sizes, " >")
		// 	} else if x1 < x2 {
		// 		fmt.Println(sizes, " <")
		// 	} else {
		// 		fmt.Println(sizes, " =")
		// 	}

		// } else if l1 != 0 && m2 != 0 {

		// 	fmt.Println(sizes, " >")

		// } else if sizes[0] == sizes[1] {

		// 	fmt.Println(sizes, " =")

		// } else if s1 != 0 && m2 != 0 {

		// 	fmt.Println(sizes, " <")

		// } else if l1 != 0 && m2 != 0 {
		// 	fmt.Println(sizes, " <")
		// } else if m1 != 0 {

		// }

		if sizes[0] == sizes[1] {

			fmt.Println("=")

		} else if (s1 != 0 && m2 != 0) || (s1 != 0 && l2 != 0) || (m1 != 0 && l2 != 0) {

			fmt.Println("<")

		} else if (m1 != 0 && s2 != 0) || (l1 != 0 && s2 != 0) || (l1 != 0 && m2 != 0) {

			fmt.Println(">")

		} else if l1 != 0 && l2 != 0 {
			if x1 > x2 {
				fmt.Println(">")
			} else if x1 < x2 {
				fmt.Println("<")
			} else {
				fmt.Println("=")
			}
		} else if s1 != 0 && s2 != 0 {
			if x1 > x2 {
				fmt.Println("<")
			} else if x1 < x2 {
				fmt.Println(">")
			} else {
				fmt.Println("=")
			}
		}
		//  else if m1 != 0 && l2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println(">")
		// 	} else if x1 < x2 {
		// 		fmt.Println("<")
		// 	} else {
		// 		fmt.Println("=")
		// 	}

		// } else if m2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println("<")
		// 	} else if x1 < x2 {
		// 		fmt.Println(">")
		// 	} else {
		// 		fmt.Println("=")
		// 	}

		// } else if s1 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println("<")
		// 	} else if x1 < x2 {
		// 		fmt.Println(">")
		// 	} else {
		// 		fmt.Println("=")
		// 	}

		// } else if s2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println(">")
		// 	} else if x1 < x2 {
		// 		fmt.Println("<")
		// 	} else {
		// 		fmt.Println("=")
		// 	}

		// }

		// if s1 != 0 && s2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println("<")
		// 	} else if x1 < x2 {
		// 		fmt.Println(">")
		// 	} else {
		// 		fmt.Println("=")
		// 	}

		// } else if l1 != 0 && l2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println(">")
		// 	} else if x1 < x2 {
		// 		fmt.Println("<")
		// 	} else {
		// 		fmt.Println("=")
		// 	}

		// } else if m1 != 0 && m2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println(">")
		// 	} else if x1 < x2 {
		// 		fmt.Println("<")
		// 	} else {
		// 		fmt.Println("=")
		// 	}

		// } else if l1 != 0 && m2 != 0 {

		// 	fmt.Println(">")

		// } else if sizes[0] == sizes[1] {

		// 	fmt.Println("=")

		// } else if s1 != 0 && m2 != 0 {

		// 	fmt.Println("<")

		// } else if m1 != 0 && s2 != 0 {

		// 	fmt.Println(">")

		// } else if l1 != 0 && m2 != 0 {

		// 	fmt.Println("<")

		// } else if m1 != l2 {

		// 	fmt.Println(">")

		// }

		// fmt.Println("x1 X count: ", x1)
		// fmt.Println("m1 M count: ", m1)
		// fmt.Println("l1 L count: ", l1)
		// fmt.Println("s1 S count: ", s1)

		// fmt.Println("x2 X count: ", x2)
		// fmt.Println("m2 M count: ", m2)
		// fmt.Println("l2 L count: ", l2)
		// fmt.Println("s2 S count: ", s2)
		// fmt.Println("-----", s.MatchString(sizes[1]))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var T int
	for fmt.Fscan(r, &T); T > 0; T-- {

		var a, b string
		fmt.Fscan(r, &a, &b)

		na := len(a)
		nb := len(b)
		la := a[na-1]
		lb := b[nb-1]
		i := 0

		var cmp1, cmp2 int
		if la == lb {
			cmp1 = na
			cmp2 = nb
			if la == 'L' { i = 1 }
		} else {
			cmp1 = int(la)
			cmp2 = int(lb)
		}

		res := []byte{'<', '>', '='}

		if cmp1 > cmp2 {
			fmt.Fprintf(w, "%c\n", res[i])
		} else if cmp1 < cmp2 {
			fmt.Fprintf(w, "%c\n", res[1^i])
		} else {
			fmt.Fprintf(w, "%c\n", res[2])
		}
	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var T int
	for fmt.Fscan(r, &T); T > 0; T-- {

		var a, b string
		fmt.Fscan(r, &a, &b)

		na := len(a)
		nb := len(b)
		la := a[na-1]
		lb := b[nb-1]

		var res rune
		if la == lb {
			if la == 'S' {
				if na > nb {
					res = '<'
				} else if nb > na {
					res = '>'
				} else {
					res = '='
				}
			} else {
				if na > nb {
					res = '>'
				} else if nb > na {
					res = '<'
				} else {
					res = '='
				}
			}
		} else {
			if la > lb {
				res = '<'
			} else if la < lb {
				res = '>'
			} else {
				res = '='
			}
		}
		fmt.Fprintln(w, string(res))
	}

}

package main

import (
	"bufio"
	"fmt"
  "os"
)

var in = bufio.NewReader(os.Stdin)

func  gcd(a, b int) int {
  for b != 0 {
      a, b = b, a%b
  }
  return a
}

func main() {
	var t int
	fmt.Fscan(in, &t)

  m := map[rune]int{'S': 1, 'M': 2, 'L': 3}

	for ; t > 0; t-- {
    var _a, _b string
    fmt.Fscan(in, &_a, &_b)
    if _a == _b {
      fmt.Println("=")
      continue
    }
    a := []rune(_a)
    b := []rune(_b)
    sa := m[a[len(a)-1]]
    sb := m[b[len(b)-1]]
    if sa > sb {
      fmt.Println(">")
    } else if sa < sb {
      fmt.Println("<")
    } else {
      switch a[len(a)-1] {
        case 'S':
          if len(a) > len(b) {
            fmt.Println("<")
          } else {
            fmt.Println(">")
          }
        case 'L':
          if len(a) > len(b) {
            fmt.Println(">")
          } else {
            fmt.Println("<")
          }
        }
    }
	}
}

package main

import (
	"fmt"
)

func calcSizeStr(s string) int {
	if s == "M" {
		return 0
	} else {
		if s[len(s)-1] == 'S' {
			var counter = -1
			for ch := range s {
				if s[ch] == 'X' {
					counter -= 1
				}
			}
			return counter
		} else {
			var counter = 1
			for ch := range s {
				if s[ch] == 'X' {
					counter += 1
				}
			}
			return counter
		}
	}

}
func main() {
	var t int
	fmt.Scanf("%d \n", &t)
	for i := 0; i < t; i++ {
		var (
			size1 string
			size2 string
		)
		fmt.Scanf("%s %s \n", &size1, &size2)
		intSize1 := calcSizeStr(size1)
		intSize2 := calcSizeStr(size2)
		if intSize1 == intSize2 {
			fmt.Println("=")
		} else {
			if intSize1 < intSize2 {
				fmt.Println("<")
			} else {
				fmt.Println(">")
			}
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var num int
	fmt.Scan(&num)
	for i := 0; i < num; i++ {

		var arr1 string
		fmt.Scan(&arr1)

		var arr2 string
		fmt.Scan(&arr2)
		b := first(arr1, arr2)
		fmt.Printf("%c\n", b)
	}

}

func first(arr1 string, arr2 string) byte {
	a1End := arr1[len(arr1)-1]
	a2End := arr2[len(arr2)-1]
	var a1X int
	var a2X int
	for i := 0; i < len(arr1); i++ {
		if arr1[i] == 'X' {
			a1X++
		}
	}
	for i := 0; i < len(arr2); i++ {
		if arr2[i] == 'X' {
			a2X++
		}
	}
	if a1End < a2End {
		return '>'
	} else if a1End > a2End {
		return '<'
	} else {
		if a1End == 'S' {
			if a1X > a2X {
				return '<'
			} else if a1X < a2X {
				return '>'
			} else {
				return '='
			}
		} else {
			if a1X > a2X {
				return '>'
			} else if a1X < a2X {
				return '<'
			} else {
				return '='
			}
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

var in, out = bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)

func solve() string {
	var x, y string
	fmt.Fscan(in, &x, &y)

	val := map[rune]int{
		'S': 1,
		'M': 2,
		'L': 3,
	}

	lx, ly := len(x), len(y)
	xlast, ylast := rune(x[lx-1]), rune(y[ly-1])
	if xlast != ylast {
		if val[xlast] < val[ylast] {
			return "<"
		}
		if val[xlast] == val[ylast] {
			return "="
		} else {
			return ">"
		}
	}
	xx := strings.Count(x, "X")
	xy := strings.Count(y, "X")

	if xx == xy {
		return "="
	}
	if (xx < xy && xlast == 'L') || (xx > xy && xlast == 'S') {
		return "<"
	}

	return ">"
}

func main() {
	defer out.Flush()
	var t int
	for fmt.Fscanln(in, &t); t > 0; t-- {
		fmt.Fprintln(out, solve())
	}
}

// util functions
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func makeMatrix(n, m int) [][]int {
	x := make([][]int, n)
	for i := range x {
		x[i] = make([]int, m)
	}
	return x
}

package main
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var a,b string
		fmt.Fscan(in,&a,&b)
		if a==b {
			fmt.Fprintln(out,"=")
		} else if string(a[len(a)-1]) < string(b[len(b)-1]) {
			fmt.Fprintln(out,">")
		} else if string(a[len(a)-1]) > string(b[len(b)-1]) {
			fmt.Fprintln(out,"<")
		} else {
			if (len(a) > len(b) && string(a[len(a)-1]) == "L") || (len(a) < len(b) && string(a[len(a)-1]) == "S") {
				fmt.Fprintln(out, ">")
			} else {
				fmt.Fprintln(out, "<")
			}
		}
	}
}

package main

import (
	"fmt"
)

// XXXS < XS
// XXXL > XL
// XL > M
// XXL = XXL
// XXXXXS < M
// XL > XXXS

func main() {
	var t int
	_, err := fmt.Scanln(&t)
	if err != nil {
		panic(err)
	}

	hash := make(map[string]int, t)
	hash["S"] = 10
	hash["M"] = 20
	hash["L"] = 30

	for i := 0; i < t; i++ {
		var str1, str2 string
		_, err := fmt.Scan(&str1, &str2)
		if err != nil {
			panic(err)
		}

		size1 := string(str1[len(str1)-1])
		size2 := string(str2[len(str2)-1])

		switch {
		case size1 == size2:
			switch size1 {
			case "S":
				if len(str1) > len(str2) {
					fmt.Println("<")
				} else if len(str1) < len(str2) {
					fmt.Println(">")
				} else {
					fmt.Println("=")
				}
			default:
				if len(str1) > len(str2) {
					fmt.Println(">")
				} else if len(str1) < len(str2) {
					fmt.Println("<")
				} else {
					fmt.Println("=")
				}
			}
		default:
			v1 := hash[size1]
			v2 := hash[size2]

			if v1 > v2 {
				fmt.Println(">")
			} else if v1 < v2 {
				fmt.Println("<")
			} else {
				fmt.Println("=")
			}

		}

	}
}

// https://codeforces.com/problemset/problem/1741/A

// 1741A - Compare T-Shirt Sizes

// 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≤t≤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).

// Example
// input
// 6
// XXXS XS
// XXXL XL
// XL M
// XXL XXL
// XXXXXS M
// L M
// output
// <
// >
// >
// =
// <
// >

// Tutorial

// Let sa, sb are the last characters of lines a and b respectively. And |a|,|b| are the sizes of these strings.
//  1. sa≠sb: then the answer depends only on sa and sb and is uniquely defined as the inverse of sa to sb ("<" if sa>sb, ">" if sa<sb, since the characters S, M, L are in reverse order in the alphabet).
//  2. sa=sb:
//   • |a|=|b|. Then the answer is "=". This also covers the case sa=sb=M;
//   • sa=sb=S. Then the larger the size of the string, the smaller the size of the t-shirt. That is, the answer is "<" if |a|>|b| and ">" if |a|<|b|;
//   • sa=sb=L. Then the larger the size of the string, the smaller the size of the t-shirt. That is, the answer is "<" if |a|<|b| and ">" if |a|>|b|;

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	var c int
	var t uint
	var a, b string

	for c, _ = fmt.Fscan(reader, &t); c == 1; c, _ = fmt.Fscan(reader, &t) {
		for ; t > 0; t-- {
			fmt.Fscan(reader, &a, &b)

			if a[len(a)-1] > b[len(b)-1] {
				fmt.Fprintln(writer, "<")
			} else if a[len(a)-1] < b[len(b)-1] {
				fmt.Fprintln(writer, ">")
			} else { // a[len(a)-1] == b[len(b)-1]
				if len(a) == len(b) {
					fmt.Fprintln(writer, "=")
				} else if a[len(a)-1] == 'S' {
					if len(a) > len(b) {
						fmt.Fprintln(writer, "<")
					} else {
						fmt.Fprintln(writer, ">")
					}
				} else if a[len(a)-1] == 'L' {
					if len(a) < len(b) {
						fmt.Fprintln(writer, "<")
					} else {
						fmt.Fprintln(writer, ">")
					}
				}
			}
		}
	}

	writer.Flush()
}

package main

import (
	"bufio"
	. "fmt"
	"os"
)

const mod = 998244353
const mx = int64(1e9 + 7)

func solve(in *bufio.Reader, out *bufio.Writer) {
	defer out.Flush()
	var s1, s2 string
	Fscan(in, &s1, &s2)
	var getSize func(s string) (cnt, ty int)
	getSize = func(s string) (cnt, ty int) {
		for _, v := range s {
			if v == 'X' {
				cnt++
			}
			if v == 'S' {
				ty = 0
			} else if v == 'M' {
				ty = 1
			} else {
				ty = 2
			}
		}
		return
	}
	t1Size, t1Type := getSize(s1)
	t2Size, t2Type := getSize(s2)
	if t2Type != t1Type {
		if t1Type > t2Type {
			Fprintln(out, ">")
		} else {
			Fprintln(out, "<")
		}
		return
	}
	if t1Type == 0 {
		t1Size, t2Size = t2Size, t1Size
	}
	if t1Size != t2Size {
		if t1Size > t2Size {
			Fprintln(out, ">")
		} else {
			Fprintln(out, "<")
		}
		return
	}
	Fprintln(out, "=")
}

func abs(a int64) int64 {
	if a > 0 {
		return a
	}
	return -a
}
func sum(a, b int64) int64 {
	return (b + a) * (b - a + 1) / 2
}

func max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}
func min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func gcd(a, b int) int {
	if a%b == 0 {
		return b
	}
	return gcd(b, a%b)
}

func main() {
	stdin := os.Stdin
	stdout := os.Stdout
	in := bufio.NewReader(stdin)
	out := bufio.NewWriter(stdout)
	n := 1
	Fscan(in, &n)
	for i := 0; i < n; i++ {
		solve(in, out)
	}
}

package main

import (
	"fmt"
)

var n int
var a, b string

func solve() {
	lenA := len(a)
	lenB := len(b)
	if a[lenA-1] == b[lenB-1] {
		if lenA == lenB {
			fmt.Println("=")
		} else if lenA < lenB {
			if a[lenA-1] == 'L' {
				fmt.Println("<")
			} else {
				fmt.Println(">")
			}

		} else {
			if a[lenA-1] == 'L' {
				fmt.Println(">")
			} else {
				fmt.Println("<")
			}
		}
	} else {
		if a[lenA-1] < b[lenB-1] {
			fmt.Println(">")
		} else {
			fmt.Println("<")
		}
	}
}

func main() {
	fmt.Scan(&n)
	for ; n != 0; n-- {
		fmt.Scan(&a, &b)
		solve()
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

// S  < M  < L
// (X)S < S < M < L < (X)L

var (
	reader = bufio.NewReader(os.Stdin)
	writer = bufio.NewWriter(os.Stdin)
)

func compare(str1, str2 string) int {
	endStr1 := str1[len(str1)-1]
	endStr2 := str2[len(str2)-1]

	if endStr1 == endStr2 {
		if len(str1) == len(str2) {
			return 0
		}

		if len(str1) < len(str2) {
			if endStr1 == 'S' {
				return 1
			}

			return -1
		} else {
			if endStr1 == 'S' {
				return -1
			}

			return 1
		}
	}

	if endStr1 < endStr2 {
		return 1
	}

	if endStr1 > endStr2 {
		return -1
	}

	return 0
}

func main() {
	writer.Flush()
	var test int
	var str1, str2 string
	fmt.Fscanf(reader, "%d\n", &test)

	for test > 0 {
		fmt.Fscanf(reader, "%s %s\n", &str1, &str2)
		ans := compare(str1, str2)
		if ans == 1 {
			fmt.Printf("%c\n", '>')
		} else if ans == -1 {
			fmt.Printf("%c\n", '<')
		} else {
			fmt.Printf("%c\n", '=')
		}
		test--
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var testCases int

	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)

	defer writer.Flush()

	fmt.Fscan(reader, &testCases)

	for testCase := 0; testCase < testCases; testCase++ {
		var aS, bS string
		fmt.Fscan(reader, &aS, &bS)

		output := solveA(aS, bS)

		fmt.Fprintln(writer, output)
	}
}

func solveA(aS, bS string) string {

	aCounts := getCounts(aS)
	bCounts := getCounts(bS)
	aScore := getScore(aCounts)
	bScore := getScore(bCounts)

	if aScore == bScore {
		return "="
	}
	if aScore > bScore {
		return ">"
	} else {
		return "<"
	}

}
func getScore(arr []int) int {
	s := -2
	m := -1
	l := 1

	sum := 1
	if arr[3] > 0 {
		sum += arr[3]
	}
	if arr[0] > 0 {
		sum *= arr[0] * s
	}
	if arr[1] > 0 {
		sum *= arr[1] * m
	}
	if arr[2] > 0 {
		sum *= arr[2] * l
	}
	return sum
}
func getCounts(a string) []int {
	counts := make([]int, 4) //s,m,l,x
	for _, v := range a {
		if v == 'S' {
			counts[0]++
		}
		if v == 'M' {
			counts[1]++
		}
		if v == 'L' {
			counts[2]++
		}
		if v == 'X' {
			counts[3]++
		}
	}
	return counts
}

/*
	A template for Go on codeforces.com
	Author: Yakov, frvr.ru
*/

package main

import (
	"bufio"
	"fmt"
	"os"
	"reflect"
	"strconv"
	"strings"
)

func main() {
	// START WRITING YOUR SOLUTION HERE:
	// writeLine(typeOf(readInt()))
	t := readInt()
	for j := 0; j < t; j++ {
		// S=>1, M=>2,L=>3
		arr := readStrings()
		cnt1, cnt2, flag1, flag2 := 0, 0, 0, 0
		for i := 0; i < len(arr[0]); i++ {
			if arr[0][i] == 'X' {
				cnt1 += 10
				flag1 = 1
			} else {
				if arr[0][i] == 'L' {
					cnt1 += 3
				} else if arr[0][i] == 'M' {
					cnt1 += 2
				} else {
					if flag1 == 1 {
						cnt1 = -cnt1
						cnt1 -= 1
					} else {
						cnt1 += 1
					}
				}
			}
		}
		for i := 0; i < len(arr[1]); i++ {
			if arr[1][i] == 'X' {
				cnt2 += 10
				flag2 = 1
			} else {
				if arr[1][i] == 'L' {
					cnt2 += 3
				} else if arr[1][i] == 'M' {
					cnt2 += 2
				} else {
					if flag2 == 1 {
						cnt2 = -cnt2
						cnt2 -= 1
					} else {
						cnt2 += 1
					}
				}
			}
		}
		if cnt1 > cnt2 {
			writeLine(">")
		} else if cnt1 < cnt2 {
			writeLine("<")
		} else {
			writeLine("=")
		}
	}

}

/* ~~~~~~~~~~ */
/* ~~~~~~~~~~ */
/* ~~~~~~~~~~ */

var in = bufio.NewReader(os.Stdin)

type float = float32
type double = float64
type long = int64
type ulong = uint64

func typeOf(arg interface{}) string {
	switch reflect.TypeOf(arg).Kind() {
	case reflect.Int:
		return "int"
	case reflect.Int8:
		return "int8"
	case reflect.Int16:
		return "int16"
	case reflect.Int32:
		return "int32"
	case reflect.Int64:
		return "int64"
	case reflect.Uint:
		return "uint"
	case reflect.Uint8:
		return "uint8"
	case reflect.Uint16:
		return "uint16"
	case reflect.Uint32:
		return "uint32"
	case reflect.Uint64:
		return "uint64"
	case reflect.Float32:
		return "float32"
	case reflect.Float64:
		return "float64"
	case reflect.Complex64:
		return "complex64"
	case reflect.Complex128:
		return "complex128"
	case reflect.Bool:
		return "bool"
	case reflect.String:
		return "string"
	case reflect.Chan:
		return "chan"
	case reflect.Ptr:
		return "ptr"
	case reflect.Uintptr:
		return "uintptr"
	case reflect.UnsafePointer:
		return "unsafeptr"
	case reflect.Interface:
		return "interface"
	case reflect.Array:
		return "array"
	case reflect.Slice:
		return "slice"
	case reflect.Map:
		return "map"
	case reflect.Struct:
		return "struct"
	case reflect.Func:
		return "func"
	case reflect.Invalid:
		return "invalid"
	default:
		return "nil"
	}
}

/* ~~~~~~~~~~ */

func _scln() string {
	ln, _ := in.ReadString('\n')
	return strings.Trim(ln, " \r\n")
}
func _sc(s []string) string {
	if len(s) == 0 {
		return _scln()
	}
	return s[0]
}

func readLine() string              { return _scln() }
func readString() string            { return _scln() }
func readStrings() []string         { return strings.Split(_scln(), " ") }
func readBool(s ...string) bool     { t, _ := strconv.ParseBool(_sc(s)); return t }
func readByte(s ...string) byte     { t, _ := strconv.ParseUint(_sc(s), 10, 8); return byte(t) }
func readDouble(s ...string) double { t, _ := strconv.ParseFloat(_sc(s), 64); return t }
func readFloat(s ...string) float   { t, _ := strconv.ParseFloat(_sc(s), 32); return float32(t) }
func readInt(s ...string) int       { t, _ := strconv.Atoi(_sc(s)); return t }
func readLong(s ...string) long     { t, _ := strconv.ParseInt(_sc(s), 10, 64); return t }
func readULong(s ...string) ulong   { t, _ := strconv.ParseUint(_sc(s), 10, 64); return t }

/* ~~~~~~~~~~ */

// Too much overhead with universal method using interface{}, wait for the generics,
// but for now — just don't look at the redundancy of the code after that commentary :)

func readBools() []bool {
	strs := readStrings()
	arr := make([]bool, len(strs))
	for i, s := range strs {
		arr[i] = readBool(s)
	}
	return arr
}
func readBytes() []byte {
	strs := readStrings()
	arr := make([]byte, len(strs))
	for i, s := range strs {
		arr[i] = readByte(s)
	}
	return arr
}
func readDoubles() []double {
	strs := readStrings()
	arr := make([]double, len(strs))
	for i, s := range strs {
		arr[i] = readDouble(s)
	}
	return arr
}
func readFloats() []float {
	strs := readStrings()
	arr := make([]float, len(strs))
	for i, s := range strs {
		arr[i] = readFloat(s)
	}
	return arr
}
func readInts() []int {
	strs := readStrings()
	arr := make([]int, len(strs))
	for i, s := range strs {
		arr[i] = readInt(s)
	}
	return arr
}
func readLongs() []long {
	strs := readStrings()
	arr := make([]long, len(strs))
	for i, s := range strs {
		arr[i] = readLong(s)
	}
	return arr
}
func readULongs() []ulong {
	strs := readStrings()
	arr := make([]ulong, len(strs))
	for i, s := range strs {
		arr[i] = readULong(s)
	}
	return arr
}

/* ~~~~~~~~~~ */

func write(arg ...interface{})                 { fmt.Print(arg...) }
func writeLine(arg ...interface{})             { fmt.Println(arg...) }
func writeFormat(f string, arg ...interface{}) { fmt.Printf(f, arg...) }

package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func solve() {
	var a,b string
	scanf("%s %s\n", &a, &b)
	if strings.Compare(a, b) == 0 {
		printf("=\n")
		return
	}
	A, B := len(a), len(b)
	getSize := func (ch string) int {
		// printf("%v\n", ch)
		if strings.Compare(ch, "S") == 0 {
			return 0
		}
		if strings.Compare(ch, "M") == 0 {
			return 1
		}
		return 2
	}
	aSize, bSize := getSize(string(a[A-1])), getSize(string(b[B-1]))
	// printf("%v %v %v %v\n", A, B, aSize, bSize)
	if aSize < bSize {
		printf("<\n")
		return
	}
	if aSize > bSize {
		printf(">\n")
		return
	}
	if aSize == 0 {
		if A > B {
			printf("<\n")
			return
		}
		printf(">\n")
		return
	}
	if A > B {
		printf(">\n")
		return
	}
	printf("<\n")
}

func main() {
	defer writer.Flush()

	var T int
	scanf("%d\n", &T)
	for tt:=1; tt<=T; tt++ {
		solve()
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

const cf = true

func solve() {
	var s1, s2 string
	fmt.Fscan(in, &s1, &s2)
	len1, len2 := 0, 0
	if s1[len(s1)-1] == byte('S') {
		len1 -= len(s1) - 1
	} else if s1[len(s1)-1] == byte('M') {
		len1 += 100
	} else if s1[len(s1)-1] == byte('L') {
		len1 += 200 + len(s1) - 1
	}
	if s2[len(s2)-1] == byte('S') {
		len2 -= len(s2) - 1
	} else if s2[len(s2)-1] == byte('M') {
		len2 += 100
	} else if s2[len(s2)-1] == byte('L') {
		len2 += 200 + len(s2) - 1
	}
	if len1 == len2 {
		fmt.Fprintln(out, "=")
	} else if len1 < len2 {
		fmt.Fprintln(out, "<")
	} else if len1 > len2 {
		fmt.Fprintln(out, ">")
	}
}

func main() {
	defer out.Flush()
	t := 1
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		solve()
	}
}

type SqrtInt interface {
	SignedSqrt | UnsignedSqrt
}

type SignedSqrt interface {
	~int | ~int32 | ~int64
}

type UnsignedSqrt interface {
	~uint | ~uint32 | ~uint64 | ~uintptr
}

func sqrt[T SqrtInt](x T) T {
	l, r := T(0), T(2000000123)
	for l < r {
		mid := (l + r) / 2
		if mid*mid > x {
			r = mid
		} else {
			l = mid + 1
		}
	}
	return l - 1
}

func ConvertInt(val string, base, toBase int) (string, error) {
	i, err := strconv.ParseInt(val, base, 64)
	if err != nil {
		return "", err
	}
	return strconv.FormatInt(i, toBase), nil
}

type set[T Ordered] struct {
	itms map[T]struct{}
}

func (s *set[T]) init() {
	if s.itms == nil {
		s.itms = make(map[T]struct{})
	}
}

func (s *set[T]) add(item T) *set[T] {
	s.init()
	s.itms[item] = exists
	return s
}

func (s *set[T]) remove(item T) *set[T] {
	s.init()
	delete(s.itms, item)
	return s
}

func (s *set[T]) has(item T) bool {
	s.init()
	_, c := s.itms[item]
	return c
}

func (s *set[T]) sortedItems() []T {
	s.init()
	items := make([]T, 0, s.size())
	for item := range s.itms {
		items = append(items, item)
	}
	sort.Slice(items, func(i, j int) bool {
		return items[i] < items[j]
	})
	return items
}

func (s *set[T]) items() []T {
	s.init()
	items := make([]T, 0, s.size())
	for item := range s.itms {
		items = append(items, item)
	}
	return items
}

func (s *set[T]) size() int {
	s.init()
	return len(s.itms)
}

var exists = struct{}{}

const MaxUint = ^uint(0)
const MinUint = 0
const MaxInt = int(MaxUint >> 1)
const MinInt = -MaxInt - 1

func reverseStr(s string) string {
	r := []rune(s)
	for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
		r[i], r[j] = r[j], r[i]
	}
	return string(r)
}

type Float interface {
	~float32 | ~float64
}

type Integer interface {
	Signed | Unsigned
}

type Signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

type Unsigned interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}

type Ordered interface {
	Integer | Float | ~string
}

func abs[T Signed](x T) T {
	if x < 0 {
		return -x
	}
	return x
}

func min[T Ordered](x, y T) T {
	if x < y {
		return x
	}
	return y
}

func max[T Ordered](x, y T) T {
	if x > y {
		return x
	}
	return y
}

var (
	in  = getReader()
	out = getWriter()
)

func getReader() *bufio.Reader {
	if cf {
		return bufio.NewReader(os.Stdin)
	} else {
		in, _ := os.Open("input.txt")
		return bufio.NewReader(in)
	}
}

func getWriter() *bufio.Writer {
	if cf {
		return bufio.NewWriter(os.Stdout)
	} else {
		out, _ := os.Create("output.txt")
		return bufio.NewWriter(out)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	reader = bufio.NewReader(os.Stdin)
	writer = bufio.NewWriter(os.Stdout)
)

func readInt() int {
	var i int
	fmt.Fscan(reader, &i)
	return i
}

func readString() string {
	var s string
	fmt.Fscan(reader, &s)
	return s
}

func main(){
	defer writer.Flush()
	T := readInt()

	cmp := func(s, t string) string {
		ls := len(s)
		lt := len(t)
		if s[ls - 1] != t[lt - 1] {
			if s[ls - 1] > t[lt - 1] {
				return "<"
			}
			return ">"
		}
		if ls == lt {
			return "="
		}
		if ls > lt {
			if s[ls - 1] == 'L' {
				return ">"
			}
			return "<"
		}

		if s[ls - 1] == 'L'{
			return "<"
		}
		return ">"
	}

	for ;T > 0; T-- {
		s, t := readString(), readString()
		fmt.Fprintln(writer, cmp(s, t))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	scanner := bufio.NewScanner(os.Stdin)
	// mod := int64(998244353998244353)
	for i := 0; i < t; i++ {
		var s string
		var a, b string
		if scanner.Scan() {
			s = scanner.Text()
			tempArr := strings.Split(s, " ")
			a = tempArr[0]
			b = tempArr[1]
		}

		var scoreA, scoreB float64
		countXA, countXB := 1, 1
		for _, v := range []rune(a) {
			if v == 'M' {
				scoreA = 0
			} else if v == 'X' {
				countXA++
			} else if v == 'S' {
				scoreA = -1
			} else { // L
				scoreA = 1
			}
		}
		scoreA *= float64(countXA)

		for _, v := range []rune(b) {
			if v == 'M' {
				scoreB = 0
			} else if v == 'X' {
				countXB++
			} else if v == 'S' {
				scoreB = -1
			} else { // L
				scoreB = 1
			}
		}
		scoreB *= float64(countXB)

		// fmt.Println(scoreA, scoreB)
		if scoreA == scoreB {
			fmt.Println("=")
		} else if scoreA < scoreB {
			fmt.Println("<")
		} else {
			fmt.Println(">")
		}

	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

const INF = 1e18
const N = 2e5 + 5

func main() {
	sc.Buffer(make([]byte, 500000*1+1), 500000)
	sc.Split(bufio.ScanWords)

	T := nextInt()
	for T > 0 {
		T--
		s1, s2 := nextString(), nextString()
		n1, n2 := len(s1), len(s2)
		if s1[n1-1] != s2[n2-1] {
			if s1[n1-1] == 'S' || (s1[n1-1] == 'M' && s2[n2-1] == 'L') {
				fmt.Println("<")
				continue
			}
			fmt.Println(">")
		} else {
			if n1 == n2 {
				fmt.Println("=")
			} else {
				if s1[n1-1] == 'S' {
					if n1 < n2 {
						fmt.Println(">")
					} else {
						fmt.Println("<")
					}
				} else {
					if n1 > n2 {
						fmt.Println(">")
					} else {
						fmt.Println("<")
					}
				}
			}
		}
	}
}

func min(args ...int) int {
	res := args[0]
	for _, v := range args {
		if v < res {
			res = v
		}
	}
	return res
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var T int
	fmt.Fscan(in, &T)
	for t := 0; t < T; t++ {
		var a, b string
		fmt.Fscan(in, &a, &b)

		c, d := a[len(a)-1], b[len(b)-1]
		var z string
		if c == d {
			if len(a) == len(b) {
				z = "="
			} else if c == 'S' && len(a) > len(b) {
				z = "<"
			} else if c == 'L' && len(a) < len(b) {
				z = "<"
			} else {
				z = ">"
			}
		} else if c == 'S' && d == 'M' || d == 'L' {
			z = "<"
		} else if c == 'M' && d == 'L' {
			z = "<"
		} else {
			z = ">"
		}

		fmt.Fprintln(out, z)
	}
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

func solve(_r io.Reader, _w io.Writer) {

	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)

	defer out.Flush()

	var T int
	Fscan(in, &T)
	for ; T > 0; T-- {
		var a, b string
		Fscan(in, &a, &b)
		cnt1, cnt2 := 0, 0
		for i := range a {
			if a[i] == 'X' {
				cnt1++
			}
		}
		for i := range b {
			if b[i] == 'X' {
				cnt2++
			}
		}
		if a[len(a)-1] == b[len(b)-1] {
			if cnt1 == cnt2 {
				Fprintln(out, "=")
			} else if a[len(a)-1] == 'S' {
				if cnt1 > cnt2 {
					Fprintln(out, "<")
				} else {
					Fprintln(out, ">")
				}
			} else {
				if cnt1 > cnt2 {
					Fprintln(out, ">")
				} else {
					Fprintln(out, "<")
				}
			}
		} else {
			if a[len(a)-1] > b[len(b)-1] {
				Fprintln(out, "<")
			} else {
				Fprintln(out, ">")
			}
		}
	}

}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func lcm(x, y int) int {
	return x / gcd(x, y) * y
}

func main() { solve(os.Stdin, os.Stdout) }

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

func main() {
	a1740(os.Stdin, os.Stdout)
}

func a1740(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var T int
	var a string
	var b string

	c := map[byte]int{'S': 0, 'M': 1, 'L': 2}

	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &a)
		Fscan(in, &b)

		ans := ""
		if a == b {
			ans = "="
		} else {
			e, f := a[len(a)-1], b[len(b)-1]
			if e == f {
				if e == 'S' {
					if len(a) > len(b) {
						ans  = "<"
					} else {
						ans = ">"
					}
				} else {
					if len(a) < len(b) {
						ans  = "<"
					} else {
						ans = ">"
					}
				}
			} else if c[e] > c[f] {
				ans = ">"
			} else {
				ans = "<"
			}
		}

		Fprintln(out, ans)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	num, _ := strconv.Atoi(sc.Text())

	for i := 0; i < num; i++ {
		sc.Scan()
		sizes := strings.Split(sc.Text(), " ")

		x1 := strings.Count(sizes[0], "X")
		m1 := strings.Count(sizes[0], "M")
		l1 := strings.Count(sizes[0], "L")
		s1 := strings.Count(sizes[0], "S")

		x2 := strings.Count(sizes[1], "X")
		m2 := strings.Count(sizes[1], "M")
		l2 := strings.Count(sizes[1], "L")
		s2 := strings.Count(sizes[1], "S")

		// if s1 != 0 && s2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println(sizes, " <")
		// 	} else if x1 < x2 {
		// 		fmt.Println(sizes, " >")
		// 	} else {
		// 		fmt.Println(sizes, " =")
		// 	}

		// } else if l1 != 0 && l2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println(sizes, " >")
		// 	} else if x1 < x2 {
		// 		fmt.Println(sizes, " <")
		// 	} else {
		// 		fmt.Println(sizes, " =")
		// 	}

		// } else if l1 != 0 && m2 != 0 {

		// 	fmt.Println(sizes, " >")

		// } else if sizes[0] == sizes[1] {

		// 	fmt.Println(sizes, " =")

		// } else if s1 != 0 && m2 != 0 {

		// 	fmt.Println(sizes, " <")

		// } else if l1 != 0 && m2 != 0 {
		// 	fmt.Println(sizes, " <")
		// } else if m1 != 0 {

		// }

		if sizes[0] == sizes[1] {

			fmt.Println("=")

		} else if (s1 != 0 && m2 != 0) || (s1 != 0 && l2 != 0) || (m1 != 0 && l2 != 0) {

			fmt.Println(sizes, "<")

		} else if (m1 != 0 && s2 != 0) || (l1 != 0 && s2 != 0) || (l1 != 0 && m2 != 0) {

			fmt.Println(sizes, ">")

		} else if l1 != 0 && l2 != 0 {
			if x1 > x2 {
				fmt.Println(sizes, ">")
			} else if x1 < x2 {
				fmt.Println(sizes, "<")
			} else {
				fmt.Println(sizes, "=")
			}
		} else if s1 != 0 && s2 != 0 {
			if x1 > x2 {
				fmt.Println(sizes, "<")
			} else if x1 < x2 {
				fmt.Println(sizes, ">")
			} else {
				fmt.Println(sizes, "=")
			}
		}
		//  else if m1 != 0 && l2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println(">")
		// 	} else if x1 < x2 {
		// 		fmt.Println("<")
		// 	} else {
		// 		fmt.Println("=")
		// 	}

		// } else if m2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println("<")
		// 	} else if x1 < x2 {
		// 		fmt.Println(">")
		// 	} else {
		// 		fmt.Println("=")
		// 	}

		// } else if s1 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println("<")
		// 	} else if x1 < x2 {
		// 		fmt.Println(">")
		// 	} else {
		// 		fmt.Println("=")
		// 	}

		// } else if s2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println(">")
		// 	} else if x1 < x2 {
		// 		fmt.Println("<")
		// 	} else {
		// 		fmt.Println("=")
		// 	}

		// }

		// if s1 != 0 && s2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println("<")
		// 	} else if x1 < x2 {
		// 		fmt.Println(">")
		// 	} else {
		// 		fmt.Println("=")
		// 	}

		// } else if l1 != 0 && l2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println(">")
		// 	} else if x1 < x2 {
		// 		fmt.Println("<")
		// 	} else {
		// 		fmt.Println("=")
		// 	}

		// } else if m1 != 0 && m2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println(">")
		// 	} else if x1 < x2 {
		// 		fmt.Println("<")
		// 	} else {
		// 		fmt.Println("=")
		// 	}

		// } else if l1 != 0 && m2 != 0 {

		// 	fmt.Println(">")

		// } else if sizes[0] == sizes[1] {

		// 	fmt.Println("=")

		// } else if s1 != 0 && m2 != 0 {

		// 	fmt.Println("<")

		// } else if m1 != 0 && s2 != 0 {

		// 	fmt.Println(">")

		// } else if l1 != 0 && m2 != 0 {

		// 	fmt.Println("<")

		// } else if m1 != l2 {

		// 	fmt.Println(">")

		// }

		// fmt.Println("x1 X count: ", x1)
		// fmt.Println("m1 M count: ", m1)
		// fmt.Println("l1 L count: ", l1)
		// fmt.Println("s1 S count: ", s1)

		// fmt.Println("x2 X count: ", x2)
		// fmt.Println("m2 M count: ", m2)
		// fmt.Println("l2 L count: ", l2)
		// fmt.Println("s2 S count: ", s2)
		// fmt.Println("-----", s.MatchString(sizes[1]))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	num, _ := strconv.Atoi(sc.Text())

	for i := 0; i < num; i++ {
		sc.Scan()
		sizes := strings.Split(sc.Text(), " ")

		x1 := strings.Count(sizes[0], "X")
		m1 := strings.Count(sizes[0], "M")
		l1 := strings.Count(sizes[0], "L")
		s1 := strings.Count(sizes[0], "S")

		x2 := strings.Count(sizes[1], "X")
		m2 := strings.Count(sizes[1], "M")
		l2 := strings.Count(sizes[1], "L")
		s2 := strings.Count(sizes[1], "S")

		// if s1 != 0 && s2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println(sizes, " <")
		// 	} else if x1 < x2 {
		// 		fmt.Println(sizes, " >")
		// 	} else {
		// 		fmt.Println(sizes, " =")
		// 	}

		// } else if l1 != 0 && l2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println(sizes, " >")
		// 	} else if x1 < x2 {
		// 		fmt.Println(sizes, " <")
		// 	} else {
		// 		fmt.Println(sizes, " =")
		// 	}

		// } else if l1 != 0 && m2 != 0 {

		// 	fmt.Println(sizes, " >")

		// } else if sizes[0] == sizes[1] {

		// 	fmt.Println(sizes, " =")

		// } else if s1 != 0 && m2 != 0 {

		// 	fmt.Println(sizes, " <")

		// } else if l1 != 0 && m2 != 0 {
		// 	fmt.Println(sizes, " <")
		// } else if m1 != 0 {

		// }

		if sizes[0] == sizes[1] {

			fmt.Println("=")

		} else if l1 != 0 {

			if x1 > x2 {
				fmt.Println(">")
			} else if x1 < x2 {
				fmt.Println("<")
			} else {
				fmt.Println(">")
			}

		} else if l2 != 0 {

			if x1 > x2 {
				fmt.Println("<")
			} else if x1 < x2 {
				fmt.Println(">")
			} else {
				fmt.Println("<")
			}

		} else if m1 != 0 {

			if x1 > x2 {
				fmt.Println(">")
			} else if x1 < x2 {
				fmt.Println("<")
			} else {
				fmt.Println("=")
			}

		} else if m2 != 0 {

			if x1 > x2 {
				fmt.Println("<")
			} else if x1 < x2 {
				fmt.Println(">")
			} else {
				fmt.Println("=")
			}

		} else if s1 != 0 {

			if x1 > x2 {
				fmt.Println("<")
			} else if x1 < x2 {
				fmt.Println(">")
			} else {
				fmt.Println("=")
			}

		} else if s2 != 0 {

			if x1 > x2 {
				fmt.Println(">")
			} else if x1 < x2 {
				fmt.Println("<")
			} else {
				fmt.Println("=")
			}

		}

		// if s1 != 0 && s2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println("<")
		// 	} else if x1 < x2 {
		// 		fmt.Println(">")
		// 	} else {
		// 		fmt.Println("=")
		// 	}

		// } else if l1 != 0 && l2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println(">")
		// 	} else if x1 < x2 {
		// 		fmt.Println("<")
		// 	} else {
		// 		fmt.Println("=")
		// 	}

		// } else if m1 != 0 && m2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println(">")
		// 	} else if x1 < x2 {
		// 		fmt.Println("<")
		// 	} else {
		// 		fmt.Println("=")
		// 	}

		// } else if l1 != 0 && m2 != 0 {

		// 	fmt.Println(">")

		// } else if sizes[0] == sizes[1] {

		// 	fmt.Println("=")

		// } else if s1 != 0 && m2 != 0 {

		// 	fmt.Println("<")

		// } else if m1 != 0 && s2 != 0 {

		// 	fmt.Println(">")

		// } else if l1 != 0 && m2 != 0 {

		// 	fmt.Println("<")

		// } else if m1 != l2 {

		// 	fmt.Println(">")

		// }

		// fmt.Println("x1 X count: ", x1)
		// fmt.Println("m1 M count: ", m1)
		// fmt.Println("l1 L count: ", l1)
		// fmt.Println("s1 S count: ", s1)

		// fmt.Println("x2 X count: ", x2)
		// fmt.Println("m2 M count: ", m2)
		// fmt.Println("l2 L count: ", l2)
		// fmt.Println("s2 S count: ", s2)
		// fmt.Println("-----", s.MatchString(sizes[1]))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	num, _ := strconv.Atoi(sc.Text())

	for i := 0; i < num; i++ {
		sc.Scan()
		sizes := strings.Split(sc.Text(), " ")

		x1 := strings.Count(sizes[0], "X")
		m1 := strings.Count(sizes[0], "M")
		l1 := strings.Count(sizes[0], "L")
		s1 := strings.Count(sizes[0], "S")

		x2 := strings.Count(sizes[1], "X")
		m2 := strings.Count(sizes[1], "M")
		l2 := strings.Count(sizes[1], "L")
		s2 := strings.Count(sizes[1], "S")

		// if s1 != 0 && s2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println(sizes, " <")
		// 	} else if x1 < x2 {
		// 		fmt.Println(sizes, " >")
		// 	} else {
		// 		fmt.Println(sizes, " =")
		// 	}

		// } else if l1 != 0 && l2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println(sizes, " >")
		// 	} else if x1 < x2 {
		// 		fmt.Println(sizes, " <")
		// 	} else {
		// 		fmt.Println(sizes, " =")
		// 	}

		// } else if l1 != 0 && m2 != 0 {

		// 	fmt.Println(sizes, " >")

		// } else if sizes[0] == sizes[1] {

		// 	fmt.Println(sizes, " =")

		// } else if s1 != 0 && m2 != 0 {

		// 	fmt.Println(sizes, " <")

		// } else if l1 != 0 && m2 != 0 {
		// 	fmt.Println(sizes, " <")
		// } else if m1 != 0 {

		// }

		if s1 != 0 && s2 != 0 {

			if x1 > x2 {
				fmt.Println("<")
			} else if x1 < x2 {
				fmt.Println(">")
			} else {
				fmt.Println("=")
			}

		} else if l1 != 0 && l2 != 0 {

			if x1 > x2 {
				fmt.Println(">")
			} else if x1 < x2 {
				fmt.Println("<")
			} else {
				fmt.Println("=")
			}

		} else if m1 != 0 && m2 != 0 {

			if x1 > x2 {
				fmt.Println(">")
			} else if x1 < x2 {
				fmt.Println("<")
			} else {
				fmt.Println("=")
			}

		} else if l1 != 0 && m2 != 0 {

			fmt.Println(">")

		} else if sizes[0] == sizes[1] {

			fmt.Println("=")

		} else if s1 != 0 && m2 != 0 {

			fmt.Println("<")

		} else if m1 != 0 && s2 != 0 {

			fmt.Println(">")

		} else if l1 != 0 && m2 != 0 {

			fmt.Println("<")

		} else if m1 != l2 {

			fmt.Println(">")

		}

		// fmt.Println("x1 X count: ", x1)
		// fmt.Println("m1 M count: ", m1)
		// fmt.Println("l1 L count: ", l1)
		// fmt.Println("s1 S count: ", s1)

		// fmt.Println("x2 X count: ", x2)
		// fmt.Println("m2 M count: ", m2)
		// fmt.Println("l2 L count: ", l2)
		// fmt.Println("s2 S count: ", s2)
		// fmt.Println("-----", s.MatchString(sizes[1]))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	num, _ := strconv.Atoi(sc.Text())

	for i := 0; i < num; i++ {
		sc.Scan()
		sizes := strings.Split(sc.Text(), " ")

		x1 := strings.Count(sizes[0], "X")
		m1 := strings.Count(sizes[0], "M")
		l1 := strings.Count(sizes[0], "L")
		s1 := strings.Count(sizes[0], "S")

		x2 := strings.Count(sizes[1], "X")
		m2 := strings.Count(sizes[1], "M")
		l2 := strings.Count(sizes[1], "L")
		s2 := strings.Count(sizes[1], "S")

		// if s1 != 0 && s2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println(sizes, " <")
		// 	} else if x1 < x2 {
		// 		fmt.Println(sizes, " >")
		// 	} else {
		// 		fmt.Println(sizes, " =")
		// 	}

		// } else if l1 != 0 && l2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println(sizes, " >")
		// 	} else if x1 < x2 {
		// 		fmt.Println(sizes, " <")
		// 	} else {
		// 		fmt.Println(sizes, " =")
		// 	}

		// } else if l1 != 0 && m2 != 0 {

		// 	fmt.Println(sizes, " >")

		// } else if sizes[0] == sizes[1] {

		// 	fmt.Println(sizes, " =")

		// } else if s1 != 0 && m2 != 0 {

		// 	fmt.Println(sizes, " <")

		// } else if l1 != 0 && m2 != 0 {
		// 	fmt.Println(sizes, " <")
		// } else if m1 != 0 {

		// }

		if s1 != 0 && s2 != 0 {

			if x1 > x2 {
				fmt.Println("<")
			} else if x1 < x2 {
				fmt.Println(">")
			} else {
				fmt.Println("=")
			}

		} else if l1 != 0 && l2 != 0 {

			if x1 > x2 {
				fmt.Println(">")
			} else if x1 < x2 {
				fmt.Println("<")
			} else {
				fmt.Println("=")
			}

		} else if m1 != 0 && m2 != 0 {

			if x1 > x2 {
				fmt.Println(">")
			} else if x1 < x2 {
				fmt.Println("<")
			} else {
				fmt.Println("=")
			}

		} else if l1 != 0 && m2 != 0 {

			fmt.Println(">")

		} else if sizes[0] == sizes[1] {

			fmt.Println("=")

		} else if s1 != 0 && m2 != 0 {

			fmt.Println("<")

		} else if l1 != 0 && m2 != 0 {

			fmt.Println("<")

		} else if m1 != l2 {

			fmt.Println(">")

		}

		// fmt.Println("x1 X count: ", x1)
		// fmt.Println("m1 M count: ", m1)
		// fmt.Println("l1 L count: ", l1)
		// fmt.Println("s1 S count: ", s1)

		// fmt.Println("x2 X count: ", x2)
		// fmt.Println("m2 M count: ", m2)
		// fmt.Println("l2 L count: ", l2)
		// fmt.Println("s2 S count: ", s2)
		// fmt.Println("-----", s.MatchString(sizes[1]))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	num, _ := strconv.Atoi(sc.Text())

	for i := 0; i < num; i++ {
		sc.Scan()
		sizes := strings.Split(sc.Text(), " ")

		x1 := strings.Count(sizes[0], "X")
		m1 := strings.Count(sizes[0], "M")
		l1 := strings.Count(sizes[0], "L")
		s1 := strings.Count(sizes[0], "S")

		x2 := strings.Count(sizes[1], "X")
		m2 := strings.Count(sizes[1], "M")
		l2 := strings.Count(sizes[1], "L")
		s2 := strings.Count(sizes[1], "S")

		// if s1 != 0 && s2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println(sizes, " <")
		// 	} else if x1 < x2 {
		// 		fmt.Println(sizes, " >")
		// 	} else {
		// 		fmt.Println(sizes, " =")
		// 	}

		// } else if l1 != 0 && l2 != 0 {

		// 	if x1 > x2 {
		// 		fmt.Println(sizes, " >")
		// 	} else if x1 < x2 {
		// 		fmt.Println(sizes, " <")
		// 	} else {
		// 		fmt.Println(sizes, " =")
		// 	}

		// } else if l1 != 0 && m2 != 0 {

		// 	fmt.Println(sizes, " >")

		// } else if sizes[0] == sizes[1] {

		// 	fmt.Println(sizes, " =")

		// } else if s1 != 0 && m2 != 0 {

		// 	fmt.Println(sizes, " <")

		// } else if l1 != 0 && m2 != 0 {
		// 	fmt.Println(sizes, " <")
		// } else if m1 != 0 {

		// }

		if s1 != 0 && s2 != 0 {

			if x1 > x2 {
				fmt.Println("<")
			} else if x1 < x2 {
				fmt.Println(">")
			} else {
				fmt.Println("=")
			}

		} else if l1 != 0 && l2 != 0 {

			if x1 > x2 {
				fmt.Println(">")
			} else if x1 < x2 {
				fmt.Println("<")
			} else {
				fmt.Println("=")
			}

		} else if l1 != 0 && m2 != 0 {

			fmt.Println(">")

		} else if sizes[0] == sizes[1] {

			fmt.Println("=")

		} else if s1 != 0 && m2 != 0 {

			fmt.Println("<")

		} else if l1 != 0 && m2 != 0 {
			fmt.Println("<")
		} else if m1 != 0 {

		}

		// fmt.Println("x1 X count: ", x1)
		// fmt.Println("m1 M count: ", m1)
		// fmt.Println("l1 L count: ", l1)
		// fmt.Println("s1 S count: ", s1)

		// fmt.Println("x2 X count: ", x2)
		// fmt.Println("m2 M count: ", m2)
		// fmt.Println("l2 L count: ", l2)
		// fmt.Println("s2 S count: ", s2)
		// fmt.Println("-----", s.MatchString(sizes[1]))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	// ТОЛЬКО ЧТОБЫ ПОСМОТРЕТЬ ИНПУТЫ)

	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	num, _ := strconv.Atoi(sc.Text())

	for i := 0; i < num; i++ {
		sc.Scan()
		sizes := strings.Split(sc.Text(), " ")

		x1 := strings.Count(sizes[0], "X")
		m1 := strings.Count(sizes[0], "M")
		l1 := strings.Count(sizes[0], "L")
		s1 := strings.Count(sizes[0], "S")

		x2 := strings.Count(sizes[1], "X")
		m2 := strings.Count(sizes[1], "M")
		l2 := strings.Count(sizes[1], "L")
		s2 := strings.Count(sizes[1], "S")

		if sizes[0] == sizes[1] {
			fmt.Println(sizes, " =")
		}

		if l1 != 0 && m2 != 0 {
			fmt.Println(sizes, " >")
		}
		// if s1 > 0

		fmt.Println("x1 X count: ", x1)
		fmt.Println("m1 M count: ", m1)
		fmt.Println("l1 L count: ", l1)
		fmt.Println("s1 S count: ", s1)

		fmt.Println("x2 X count: ", x2)
		fmt.Println("m2 M count: ", m2)
		fmt.Println("l2 L count: ", l2)
		fmt.Println("s2 S count: ", s2)
		// fmt.Println("-----", s.MatchString(sizes[1]))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var T int
	for fmt.Fscan(r, &T); T > 0; T-- {

		var a, b string
		fmt.Fscan(r, &a, &b)

		na := len(a)
		nb := len(b)
		la := a[na-1]
		lb := b[nb-1]
		i := 0

		var cmp1, cmp2 int
		if la == lb {
			cmp1 = na
			cmp2 = nb
			if la == 'S' { i = 1 }
		} else {
			cmp1 = int(la)
			cmp2 = int(lb)
		}

		res := []byte{'>', '<', '='}

		if cmp1 > cmp2 {
			fmt.Fprintf(w, "%c\n", res[i])
		} else if cmp1 < cmp2 {
			fmt.Fprintf(w, "%c\n", res[1^i])
		} else {
			fmt.Fprintf(w, "%c\n", res[2])
		}
	}

}

package main

import (
	"bufio"
	"fmt"
  "os"
)

var in = bufio.NewReader(os.Stdin)

func  gcd(a, b int) int {
  for b != 0 {
      a, b = b, a%b
  }
  return a
}

func main() {
	var t int
	fmt.Fscan(in, &t)

  m := map[rune]int{'S': 1, 'M': 2, 'L': 3}

	for ; t > 0; t-- {
    var _a, _b string
    fmt.Fscan(in, &_a, &_b)
    a := []rune(_a)
    b := []rune(_b)
    sa := m[a[len(a)-1]]
    sb := m[b[len(b)-1]]
    if sa > sb {
      fmt.Println(">")
    } else if sa < sb {
      fmt.Println("<")
    } else {
      switch a[len(a)-1] {
        case 'S':
          if len(a) > len(b) {
            fmt.Println("<")
          } else if len(a) < len(b) {
            fmt.Println(">")
          } else {
            fmt.Println("=")
          }
        case 'L':
          if len(a) > len(b) {
            fmt.Println(">")
          } else if len(a) < len(b) {
            fmt.Println("<")
          } else {
            fmt.Println("=")
          }
      }
    }
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var in, out = bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)

func solve() string {
	var s string
	fmt.Fscan(in, &s)

	return ""
}

func main() {
	defer out.Flush()
	var t int
	for fmt.Fscanln(in, &t); t > 0; t-- {
		fmt.Fprintln(out, solve())
	}
}

// util functions
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func makeMatrix(n, m int) [][]int {
	x := make([][]int, n)
	for i := range x {
		x[i] = make([]int, m)
	}
	return x
}


Roman and Denis are on the trip to the programming competition. Since the trip was long, they soon got bored, and hence decided to came up with something. Roman invented a pizza's recipe, while Denis invented a string multiplication. According to Denis, the result of multiplication (product) of strings $$$s$$$ of length $$$m$$$ and $$$t$$$ is a string $$$t + s_1 + t + s_2 + \ldots + t + s_m + t$$$, where $$$s_i$$$ denotes the $$$i$$$-th symbol of the string $$$s$$$, and "+" denotes string concatenation. For example, the product of strings "abc" and "de" is a string "deadebdecde", while the product of the strings "ab" and "z" is a string "zazbz". Note, that unlike the numbers multiplication, the product of strings $$$s$$$ and $$$t$$$ is not necessarily equal to product of $$$t$$$ and $$$s$$$.Roman was jealous of Denis, since he invented such a cool operation, and hence decided to invent something string-related too. Since Roman is beauty-lover, he decided to define the beauty of the string as the length of the longest substring, consisting of only one letter. For example, the beauty of the string "xayyaaabca" is equal to $$$3$$$, since there is a substring "aaa", while the beauty of the string "qwerqwer" is equal to $$$1$$$, since all neighboring symbols in it are different.In order to entertain Roman, Denis wrote down $$$n$$$ strings $$$p_1, p_2, p_3, \ldots, p_n$$$ on the paper and asked him to calculate the beauty of the string $$$( \ldots (((p_1 \cdot p_2) \cdot p_3) \cdot \ldots ) \cdot p_n$$$, where $$$s \cdot t$$$ denotes a multiplication of strings $$$s$$$ and $$$t$$$. Roman hasn't fully realized how Denis's multiplication works, so he asked you for a help. Denis knows, that Roman is very impressionable, he guarantees, that the beauty of the resulting string is at most $$$10^9$$$.

The first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 100\,000$$$) — the number of strings, wroted by Denis. Next $$$n$$$ lines contain non-empty strings $$$p_1, p_2, \ldots, p_n$$$, consisting of lowercase english letters. It's guaranteed, that the total length of the strings $$$p_i$$$ is at most $$$100\,000$$$, and that's the beauty of the resulting product is at most $$$10^9$$$.

Print exactly one integer — the beauty of the product of the strings.

NoteIn the first example, the product of strings is equal to "abaaaba".In the second example, the product of strings is equal to "abanana".

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	str []byte
	dp  []int
)

func findE() (int, int) {

	lenstr := len(str)
	var l, r int
	l = lenstr
	r = lenstr
	for i := 0; i < lenstr; i++ {
		if str[i] != str[0] {
			l = i
			break
		}
	}
	for i := lenstr - 1; i >= 0; i-- {
		if str[i] != str[lenstr-1] {
			r = lenstr - i - 1
			break
		}
	}

	return l, r
}
func cint(c byte) int {
	return int(c - 'a')
}
func main() {
	buf := bufio.NewReader(os.Stdin)
	var n int
	str = make([]byte, 100100)
	dp = make([]int, 26)
	fmt.Fscanf(buf, "%d\n", &n)

	for i := 0; i < n; i++ {
		fmt.Fscanf(buf, "%s\n", &str)
	//	fmt.Printf("--> %s\n", str)
		left, right := findE()
		lenstr := len(str)
		//fmt.Printf("left=%d right=%d\n", left, right)
		for i := 0; i < 26; i++ {
			if str[0] != 'a'+byte(i) && str[lenstr-1] != byte('a'+byte(i)) {
				if dp[i] > 0 {
					dp[i] = 1
				}
			}
		}
		if left == lenstr {
			dp[cint(str[0])] += (dp[cint(str[0])] + 1) * left
		} else {
			if dp[cint(str[0])] > 0 {
				dp[cint(str[0])] = 1
			} else {
				dp[cint(str[0])] = 0
			}
			if dp[cint(str[lenstr-1])] > 0 {
				dp[cint(str[lenstr-1])] = 1
			} else {
				dp[cint(str[lenstr-1])] = 0
			}
			dp[cint(str[0])] += left
			dp[cint(str[lenstr-1])] += right
		}
	//	fmt.Printf("%v\n", dp)
		f := 0
		r := 0
		for f < lenstr && f <= r {
			for r < lenstr && str[r] == str[f] {
				r++
			}
			if dp[cint(str[f])] < r-f {
				dp[cint(str[f])] = r - f
			}
			f = r
		}
	//	fmt.Printf("%v\n\n", dp)
	}
	ans := 0
	for i := 0; i < 26; i++ {
		if ans < dp[i] {
			ans = dp[i]
		}
	}
	fmt.Printf("%d\n", ans)

}

package main

import (
	"fmt"
	"bufio"
	"os"
)

const M = 26
const inf = 1000000000 + 7
const Nil = -1

type Node struct {
	best [M]int
	first_char int
	last_char int

	first_length int
	last_length int

	full_char int
}

func update_max(p_val *int, update int) {
	if update > *p_val {
		*p_val = update
	}
}

func compute(s string) (ans Node) {
	last, count := '-', 0

	for _, c := range(s) {
		if c == last {
			count += 1
		} else {
			count = 1
		}
		last = c
		update_max(&ans.best[last - 'a'], count)
	}

	n := len(s)

	ans.first_char = int(s[0] - 'a')
	ans.last_char = int(s[n - 1] - 'a')

	for i := 0; i < n && s[i] == s[0]; i++ {
		ans.first_length++
	}

	for i:= n - 1; i >= 0 && s[i] == s[n - 1]; i-- {
		ans.last_length++
	}

	ans.full_char = -1
	if ans.first_length == n {
		ans.full_char = ans.first_char
	}

	return ans
}

func multiply(pre, now Node) (ans Node) {
	ans.first_char, ans.last_char = now.first_char, now.last_char

	for i := 0; i < M; i++ {
		ans.best[i] = now.best[i]
		if pre.best[i] > 0 {
			update_max(&ans.best[i], 1)
		}
	}

	first, last := ans.first_char, ans.last_char
	if pre.best[first] > 0 {
		update_max(&ans.best[first], 1 + now.first_length)
	}
	if pre.best[last] > 0 {
		update_max(&ans.best[last], 1 + now.last_length)
	}

	if first == last {
		if now.full_char == Nil {
			if pre.best[first] > 0 {
				update_max(&ans.best[first], 1 + now.first_length + now.last_length)
			}
		} else {
			update_max(&ans.best[first],  pre.best[first] + (pre.best[first] + 1) * now.best[first])
		}
	}

	ans.first_length = now.first_length
	ans.last_length = now.last_length

	if now.full_char == now.first_char {
		if now.first_char == pre.first_char {
			ans.first_length = pre.first_length + (pre.first_length + 1) * now.first_length
		}
		if now.last_char == pre.last_char {
			ans.last_length = pre.last_length + (pre.last_length + 1) * now.last_length
		}
	}

	ans.full_char = Nil
	if pre.full_char == now.full_char {
		ans.full_char = now.full_char
	}

	return ans
}

func main() {
	rbuf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanln(rbuf, &n)
	var ans Node

	for i := 0; i < n; i++ {
		var s string
		fmt.Fscanln(rbuf, &s)
		now := compute(s)
		if i == 0 {
			ans = now
		} else {
			ans = multiply(ans, now)
		}
	}

	best := 0
	for i := 0; i < M; i++ {
		update_max(&best, ans.best[i])
	}
	fmt.Println(best)
}

package main

import (
	"fmt"
	"bufio"
	"os"
)

const M = 26
const inf = 1000000000 + 7

type Node struct {
	best [M]int
	length int64
	first_char int
	last_char int

	first_length int
	last_length int
}

func update_max(p_val *int, update int) {
	if update > *p_val {
		*p_val = update
	}
}

func compute(s string) (ans Node) {
	ans.length = int64(len(s))
	last, count := '-', 0

	for _, c := range(s) {
		if c == last {
			count += 1
		} else {
			count = 1
		}
		last = c
		update_max(&ans.best[last - 'a'], count)
	}

	n := len(s)

	ans.first_char = int(s[0] - 'a')
	ans.last_char = int(s[n - 1] - 'a')

	for i := 0; i < n && s[i] == s[0]; i++ {
		ans.first_length++
	}

	for i:= n - 1; i >= 0 && s[i] == s[n - 1]; i-- {
		ans.last_length++
	}

	return ans
}

func multiply(pre, now Node) (ans Node) {
	ans.first_char, ans.last_char = now.first_char, now.last_char
	ans.length = pre.length * now.length
	if (ans.length > inf) {
		ans.length = inf
	}
	for i := 0; i < M; i++ {
		ans.best[i] = now.best[i]
		if pre.best[i] > 0 {
			update_max(&ans.best[i], 1)
		}
	}

	first, last := ans.first_char, ans.last_char
	if pre.best[first] > 0 {
		update_max(&ans.best[first], 1 + now.first_length)
	}
	if pre.best[last] > 0 {
		update_max(&ans.best[last], 1 + now.last_length)
	}

	if first == last && pre.best[first] == int(pre.length) {
		if now.first_length < int(now.length) {
			update_max(&ans.best[first], pre.best[first] + now.first_length + now.last_length)
		} else {
			update_max(&ans.best[first], int(pre.length + now.length * (pre.length + 1)))
		}
	}

	if first == last && now.best[first] == int(now.length) {
		update_max(&ans.best[first], pre.best[first] + (pre.best[first] + 1) * int(now.length))
	}

	ans.first_length = now.first_length
	ans.last_length = now.last_length

	if now.first_length == int(now.length) {
		if pre.first_length == int(pre.length) {
			if now.first_char == pre.first_char {
				ans.first_length = int(ans.length)
				ans.last_length = int(ans.length)
			}
		} else {
			if now.first_char == pre.first_char {
				ans.first_length = pre.first_length + (pre.first_length + 1) * now.first_length
			}
			if now.last_char == pre.last_char {
				ans.last_length = pre.last_length + (pre.last_length + 1) * now.last_length
			}
		}
	}

	return ans
}

func main() {
	rbuf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanln(rbuf, &n)
	var ans Node

	for i := 0; i < n; i++ {
		var s string
		fmt.Fscanln(rbuf, &s)
		now := compute(s)
		if i == 0 {
			ans = now
		} else {
			ans = multiply(ans, now)
		}
	}

	best := 0
	for i := 0; i < M; i++ {
		update_max(&best, ans.best[i])
	}
	fmt.Println(best)
}

package main

import (
	"fmt"
	"bufio"
	"os"
)

const M = 26
const inf = 1000000000 + 7

type Node struct {
	best [M]int
	length int64
	first_char int
	last_char int

	first_length int
	last_length int
}

func update_max(p_val *int, update int) {
	if update > *p_val {
		*p_val = update
	}
}

func compute(s string) (ans Node) {
	ans.length = int64(len(s))
	last, count := '-', 0

	for _, c := range(s) {
		if c == last {
			count += 1
		} else {
			count = 1
		}
		last = c
		update_max(&ans.best[last - 'a'], count)
	}

	ans.first_char = int(s[0] - 'a')
	ans.last_char = int(s[len(s) - 1] - 'a')

	n := len(s)
	for i := 0; i < n && s[i] == s[0]; i++ {
		ans.first_length++
	}

	for i:= n - 1; i >= 0 && s[i] - 'a' == s[n - 1]; i-- {
		ans.last_length++
	}

	return ans
}

func multiply(pre, now Node) (ans Node) {
	ans.first_char, ans.last_char = now.first_char, now.last_char
	ans.length = pre.length * now.length
	if (ans.length > inf) {
		ans.length = inf
	}
	for i := 0; i < M; i++ {
		ans.best[i] = now.best[i]
		if pre.best[i] > 0 {
			update_max(&ans.best[i], 1)
		}
	}

	first, last := ans.first_char, ans.last_char
	update_max(&ans.best[first], pre.best[first] + now.first_length)
	update_max(&ans.best[last], pre.best[last] + now.last_length)

	if first == last && pre.best[first] == int(pre.length) {
		if now.first_length < int(now.length) {
			update_max(&ans.best[first], pre.best[first] )
		} else {
			update_max(&ans.best[first], int(pre.length + now.length * (pre.length + 1)))
		}
	}

	ans.first_length = now.first_length
	ans.last_length = now.last_length

	if now.first_length == int(now.length) {
		if pre.first_length == int(pre.length) {
			if now.first_char == pre.first_char {
				ans.first_length = int(ans.length)
				ans.last_length = int(ans.length)
			}
		} else {
			if now.first_char == pre.first_char {
				ans.first_length = pre.first_length + (pre.first_length + 1) * now.first_length
			}
			if now.last_char == pre.last_char {
				ans.last_length = pre.last_length + (pre.last_length + 1) * now.last_length
			}
		}
	}

	return ans
}

func main() {
	rbuf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanln(rbuf, &n)
	var ans Node

	for i := 0; i < n; i++ {
		var s string
		fmt.Fscanln(rbuf, &s)
		now := compute(s)
		if i == 0 {
			ans = now
		} else {
			ans = multiply(ans, now)
		}
	}

	best := 0
	for i := 0; i < M; i++ {
		update_max(&best, ans.best[i])
	}
	fmt.Println(best)
}

package main

import (
	"fmt"
	"bufio"
	"os"
)

const M = 26
const inf = 1000000000 + 7

type Node struct {
	best [M]int
	length int64
	first_char int
	last_char int

	first_length int
	last_length int
}

func update_max(p_val *int, update int) {
	if update > *p_val {
		*p_val = update
	}
}

func compute(s string) (ans Node) {
	ans.length = int64(len(s))
	last, count := '-', 0

	for _, c := range(s) {
		if c == last {
			count += 1
		} else {
			count = 1
		}
		last = c
		update_max(&ans.best[last - 'a'], count)
	}

	ans.first_char = int(s[0] - 'a')
	ans.last_char = int(s[len(s) - 1] - 'a')

	n := len(s)
	for i := 0; i < n && s[i] == s[0]; i++ {
		ans.first_length++
	}

	for i:= n - 1; i >= 0 && s[i] - 'a' == s[n - 1]; i-- {
		ans.last_length++
	}

	return ans
}

func multiply(pre, now Node) (ans Node) {
	ans.first_char, ans.last_char = now.first_char, now.last_char
	ans.length = pre.length * now.length
	if (ans.length > inf) {
		ans.length = inf
	}
	for i := 0; i < M; i++ {
		ans.best[i] = now.best[i]
	}

	first, last := ans.first_char, ans.last_char
	update_max(&ans.best[first], pre.best[first] + now.first_length)
	update_max(&ans.best[last], pre.best[last] + now.last_length)

	if first == last && pre.best[first] == int(pre.length) {
		if now.first_length < int(now.length) {
			update_max(&ans.best[first], pre.best[first] )
		} else {
			update_max(&ans.best[first], int(pre.length + now.length * (pre.length + 1)))
		}
	}

	ans.first_length = now.first_length
	ans.last_length = now.last_length

	if now.first_length == int(now.length) {
		if pre.first_length == int(pre.length) {
			if now.first_char == pre.first_char {
				ans.first_length = int(ans.length)
				ans.last_length = int(ans.length)
			}
		} else {
			if now.first_char == pre.first_char {
				ans.first_length = pre.first_length + (pre.first_length + 1) * now.first_length
			}
			if now.last_char == pre.last_char {
				ans.last_length = pre.last_length + (pre.last_length + 1) * now.last_length
			}
		}
	}

	return ans
}

func main() {
	rbuf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanln(rbuf, &n)
	var ans Node

	for i := 0; i < n; i++ {
		var s string
		fmt.Fscanln(rbuf, &s)
		now := compute(s)
		if i == 0 {
			ans = now
		} else {
			ans = multiply(ans, now)
		}
	}

	best := 0
	for i := 0; i < M; i++ {
		update_max(&best, ans.best[i])
	}
	fmt.Println(best)
}

package main

import (
	"fmt"
	"bufio"
	"os"
)

const M = 26
const inf = 1000000000 + 7

type Node struct {
	best [M]int
	length int64
	first_char int
	last_char int

	first_length int
	last_length int
}

func update_max(p_val *int, update int) {
	if update > *p_val {
		*p_val = update
	}
}

func compute(s string) (ans Node) {
	ans.length = int64(len(s))
	last, count := '-', 0

	for _, c := range(s) {
		if c == last {
			count += 1
		} else {
			count = 1
		}
		last = c
		update_max(&ans.best[last - 'a'], count)
	}

	n := len(s)

	ans.first_char = int(s[0] - 'a')
	ans.last_char = int(s[n - 1] - 'a')

	for i := 0; i < n && s[i] == s[0]; i++ {
		ans.first_length++
	}

	for i:= n - 1; i >= 0 && s[i] == s[n - 1]; i-- {
		ans.last_length++
	}

	return ans
}

func multiply(pre, now Node) (ans Node) {
	ans.first_char, ans.last_char = now.first_char, now.last_char
	ans.length = pre.length * now.length
	if (ans.length > inf) {
		ans.length = inf
	}
	for i := 0; i < M; i++ {
		ans.best[i] = now.best[i]
		if pre.best[i] > 0 {
			update_max(&ans.best[i], 1)
		}
	}

	first, last := ans.first_char, ans.last_char
	if pre.best[first] > 0 {
		update_max(&ans.best[first], 1 + now.first_length)
	}
	if pre.best[last] > 0 {
		update_max(&ans.best[last], 1 + now.last_length)
	}

	if first == last && pre.best[first] == int(pre.length) {
		if now.first_length < int(now.length) {
			update_max(&ans.best[first], pre.best[first] + now.first_length + now.last_length)
		} else {
			update_max(&ans.best[first], int(pre.length + now.length * (pre.length + 1)))
		}
	}

	ans.first_length = now.first_length
	ans.last_length = now.last_length

	if now.first_length == int(now.length) {
		if pre.first_length == int(pre.length) {
			if now.first_char == pre.first_char {
				ans.first_length = int(ans.length)
				ans.last_length = int(ans.length)
			}
		} else {
			if now.first_char == pre.first_char {
				ans.first_length = pre.first_length + (pre.first_length + 1) * now.first_length
			}
			if now.last_char == pre.last_char {
				ans.last_length = pre.last_length + (pre.last_length + 1) * now.last_length
			}
		}
	}

	return ans
}

func main() {
	rbuf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanln(rbuf, &n)
	var ans Node

	for i := 0; i < n; i++ {
		var s string
		fmt.Fscanln(rbuf, &s)
		now := compute(s)
		if i == 0 {
			ans = now
		} else {
			ans = multiply(ans, now)
		}
	}

	best := 0
	for i := 0; i < M; i++ {
		update_max(&best, ans.best[i])
	}
	fmt.Println(best)
}


You are given an array $$$a$$$ consisting of $$$n$$$ integers. You should divide $$$a$$$ into continuous non-empty subarrays (there are $$$2^{n-1}$$$ ways to do that).Let $$$s=a_l+a_{l+1}+\ldots+a_r$$$. The value of a subarray $$$a_l, a_{l+1}, \ldots, a_r$$$ is:   $$$(r-l+1)$$$ if $$$s>0$$$, $$$0$$$ if $$$s=0$$$, $$$-(r-l+1)$$$ if $$$s<0$$$.  What is the maximum sum of values you can get with a partition?

The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 5 \cdot 10^5$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$). The second line of each test case contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($$$-10^9 \le a_i \le 10^9$$$). It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$5 \cdot 10^5$$$.

For each test case print a single integer — the maximum sum of values you can get with an optimal parition.

package main

import (
	"bufio"
	. "fmt"
	"math"
	"os"
	"sort"
)

type Int int64

const (
	INF = 3e5 + 10
	L0  = Int(0)
	L1  = Int(1)
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var t int
	Fscan(in, &t)

	for tt := 0; tt < t; tt++ {
		var n Int
		Fscan(in, &n)
		a := make([]Int, n+1)
		pre := make([]Int, n+1)
		rank := make([]Int, n+1)
		ord := make([]Int, n+1)
		for i := L1; i <= n; i++ {
			Fscan(in, &a[i])
			pre[i] = pre[i-1] + a[i]
			rank[i] = i
		}
		sort.SliceStable(rank[1:n+1], func(i, j int) bool {
			if pre[rank[i+1]] == pre[rank[j+1]] {
				return rank[i+1] > rank[j+1]
			}
			return pre[rank[i+1]] < pre[rank[j+1]]
		})

		for i := L1; i <= n; i++ {
			ord[rank[i]] = i
		}

		dp := make([]Int, n+1)
		f := make([]Int, n+1)
		for i, _ := range f {
			f[i] = -0x7fffffff
		}
		for i := L1; i <= n; i++ {
			v := L0
			if a[i] > 0 {
				v = L1
			}
			if a[i] < 0 {
				v = -L1
			}
			dp[i] = dp[i-1] + v

			dp[i] = Max(dp[i], get(ord[i], f)+i)

			if pre[i] > 0 {
				dp[i] = i
			}

			update(ord[i], dp[i]-i, f)
		}
		Fprintln(out, dp[n])
	}

}

func Abs(x Int) Int {
	if x > 0 {
		return x
	}
	return -x
}

func Min(a Int, b Int) Int {
	if a > b {
		return b
	}
	return a
}

func Max(a Int, b Int) Int {
	if a > b {
		return a
	}
	return b
}

func update(x Int, k Int, f []Int) {
	for int(x) < len(f) {
		f[x] = Max(f[x], k)
		x += x & -x
	}
}

func get(x Int, f []Int) Int {
	res := Int(math.MinInt64)
	for x > 0 {
		res = Max(res, f[x])
		x -= x & -x
	}
	return res
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

const avc = int(-1e9)

var (
	in = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

type SegmentTree struct {

	l, r, mid, vall, valr, id int
	left, right *SegmentTree
}

func max(a, b int) int {

	if a < b {

		return b
	}
	return a
}

func (seg *SegmentTree) init(l, r, id int) *SegmentTree {

	seg.l, seg.r, seg.mid, seg.vall, seg.valr, seg.id = l, r, (l + r) / 2, avc, avc, id
	if l != r {

		seg.left = new(SegmentTree).init(seg.l, seg.mid, id << 1)
		seg.right = new(SegmentTree).init(seg.mid + 1, seg.r, id << 1 | 1)
		seg.vall = max(seg.left.vall, seg.right.vall)
		seg.valr = max(seg.left.valr, seg.right.valr)
	}
	return seg
}

func (seg *SegmentTree) print() {

	fmt.Println(seg.vall, " ", seg.valr, " ", seg.id)
	if seg.l != seg.r {

		seg.left.print()
		seg.right.print()
	}
}

func (seg *SegmentTree) update(index, vall, valr int) {

	if seg.l != seg.r {

		if seg.mid >= index {

			seg.left.update(index, vall, valr)
		} else {

			seg.right.update(index, vall, valr)
		}

		seg.vall = max(seg.left.vall, seg.right.vall)
		seg.valr = max(seg.left.valr, seg.right.valr)
	} else {

		seg.vall = max(seg.vall, vall)
		seg.valr = max(seg.valr, valr)
	}
}

func (seg *SegmentTree) getl(l, r int) (int) {

	if l <= seg.l && seg.r <= r {

		return seg.vall
	}

	if l > seg.r || r < seg.l {

		return avc
	}

	return max(seg.left.getl(l, r), seg.right.getl(l, r))
}

func (seg *SegmentTree) getr(l, r int) (int) {

	if l <= seg.l && seg.r <= r {

		return seg.valr
	}

	if l > seg.r || r < seg.l {

		return avc
	}

	return max(seg.left.getr(l, r), seg.right.getr(l, r))
}

func lower_bound(a []int64, x int64) int {

	var (

		l = 0
		r = len(a) - 1
		mid = (r + l) / 2
	)

	for r - l > 1 {

		mid = (l + r) / 2
		if a[mid] < x {

			l = mid + 1
		} else {

			r = mid
		}
	}
	if a[l] >= x {

		return l
	}
	return r
}

func solve(n *int) {

	var (

		fsum []int64
		a []int64
		ans = make([]int, *n + 1)
		mp map[int64]int = map[int64]int{}
	)
	a = append(a, 0)
	fsum = append(fsum, 0)
	ans[0] = 0
	for i := 0; i < *n; i++ {

		var x int64
		fmt.Fscan(in, &x)
		a = append(a, a[i] + x)
		fsum = append(fsum, a[i + 1])
		ans[i + 1] = avc
	}

	sort.Slice(fsum, func(i, j int) bool {

		return fsum[i] < fsum[j]
	})

	seg := new(SegmentTree).init(1, *n + 1, 1)

	for index := range a {

		a[index] = int64(lower_bound(fsum, a[index])) + 1
		if index == 0 {

			seg.update(int(a[index]), 0, 0)
			mp[a[index]] = 0
			continue
		}
		valmp, ok := mp[a[index]]
		if ok {

			ans[index] = max(ans[index], valmp)
		}
		vall, valr := avc, avc
		if int(a[index]) <= *n {

			vall = seg.getl(int(a[index]) + 1, *n + 1)
		}
		if int(a[index]) > 1 {

			valr = seg.getr(1, int(a[index]) - 1)
		}

		ans[index] = max(ans[index], max(vall - index, valr + index))
		seg.update(int(a[index]), ans[index] + index, ans[index] - index)
		mp[a[index]] = ans[index]
	}

	fmt.Fprintln(out, ans[*n])
}

func main() {

	defer out.Flush()
	var T int
	fmt.Fscan(in, &T)
	for i := 0; i < T; i++ {

		var n int
		fmt.Fscan(in, &n)
		solve(&n)
	}
}