package main

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

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

	for i := 0; i<num; i++ {
	    sc.Scan()
	    sc.Text()
	    sc.Scan()

		var (
			txtArr []string
			intArr []int
		)
		txtArr = strings.Split(sc.Text(), " ")

		for _, v := range txtArr {
			int, _ := strconv.Atoi(v)
			intArr = append(intArr, int)
		}

	    fmt.Println(increasing(intArr))
	}
}

func increasing(arg []int) string {
	sort.Slice(arg, func(i, j int) bool {
		return arg[i] < arg[j]
	})

	for i := 1; i<len(arg); i++ {
	    if arg[i] == arg[i - 1] {
	        return "NO"
	    }
	}

	return "YES"
}

package main

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

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

	for i := 0; i < num; i++ {
		sc.Scan()
		sc.Text()
		sc.Scan()

		var (
			txtArr []string
			intArr []int
		)
		txtArr = strings.Split(sc.Text(), " ")

		for _, v := range txtArr {
			int, _ := strconv.Atoi(v)
			intArr = append(intArr, int)
		}

		fmt.Println(increasing(intArr))
	}
}

func increasing(arg []int) string {
	sort.Slice(arg, func(i, j int) bool {
		return arg[i] < arg[j]
	})

	for i := 1; i < len(arg); i++ {
		if arg[i] == arg[i-1] {
			return "NO"
		}
	}

	return "YES"
}

package main

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

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

func solve() {
	var n, x int
	Fscan(r, &n)
	set := map[int]bool{}
	for i := 0; i < n; i++ {
		Fscan(r, &x)
		set[x] = true
	}

	if len(set) == n {
		Fprintln(w, "YES")
	} else {
		Fprintln(w, "NO")
	}
}

func main() {
	defer w.Flush()

	var t int
	for Fscan(r, &t); t > 0; t-- {
		solve()
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t, n int
	fmt.Fscan(in, &t)
	for t > 0 {
		t--
		fmt.Fscan(in, &n)
		var x int
		m := make(map[int]int)
		flag := true
		//fmt.Println("n=>", n)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &x)
			m[x]++
			//fmt.Println(x, " => ", m[x], m[x] > 1)
			if m[x] > 1 {
				flag = false
			}
		}
		//fmt.Println(t, n, flag, m)
		if flag {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}

}

package main

import (
	"fmt"
)

func main() {
	//in := bufio.NewReader(os.Stdin)
	var t, n int
	fmt.Scan(&t)
	for t > 0 {
		t--
		fmt.Scan(&n)
		var x int
		m := make(map[int]int)
		flag := true
		//fmt.Println("n=>", n)
		for i := 0; i < n; i++ {
			fmt.Scan(&x)
			m[x]++
			//fmt.Println(x, " => ", m[x], m[x] > 1)
			if m[x] > 1 {
				flag = false
			}
		}
		//fmt.Println(t, n, flag, m)
		if flag {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}

}

package main

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

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

func solve() {
	f := false
	var n int
	fmt.Fscan(in, &n)
	hashMap := make(map[int]struct{})
	for i := 0; i < n; i++ {
		var a int
		fmt.Fscan(in, &a)
		if _, ok := hashMap[a]; !ok {
			hashMap[a] = struct{}{}
		} else {
			f = true
		}
	}

	if f {
		fmt.Fprintln(out, "NO")
		return
	}

	fmt.Fprintln(out, "YES")
}

func main() {
	var T int
	fmt.Fscan(in, &T)
	for ; T > 0; T-- {
		solve()
	}
	out.Flush()
}

package main

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

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

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

	var T int
	var n int
	var x int

	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n)
		r := map[int]bool{}
		for i := 0; i < n; i++ {
			Fscan(in, &x)
			r[x] = true
		}
		ans := "NO"
		if len(r) == n {
			ans = "YES"
		}
		Fprintln(out, ans)
	}
}

package main

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

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

	var T, N int
	for fmt.Fscan(in, &T); T > 0; T-- {
		fmt.Fscan(in, &N)
		nums := make([]int, N)
		for i := 0; i < N; i++ {
			fmt.Fscan(in, &nums[i])
		}
		flag := false
		if N == 1 {
			fmt.Fprintln(out, "YES")
			flag = true
		} else {
			sort.Ints(nums)
			for i := 1; i < N; i++ {
				if nums[i] == nums[i-1] {
					fmt.Fprintln(out, "NO")
					flag = true
					break
				}
			}
		}
		if !flag {
			fmt.Fprintln(out, "YES")
		}
	}
}

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

package main

import "fmt"

func main() {
	var t int

	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		var n int
		fmt.Scan(&n)
		mp := make(map[int]bool)
		flag := false
		for j := 0; j < n; j++ {
			var a int
			fmt.Scan(&a)
			if mp[a] == true {
				flag = true
			}
			mp[a] = true
		}
		if flag == false {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	text, _ := reader.ReadString('\n')
	text = strings.Replace(text, "\r\n", "", -1)
	t := 0
	t, _ = strconv.Atoi(text)
	for i := 0; i < t; i++ {
		raw, _ := reader.ReadString('\n')
		raw = strings.Replace(raw, "\r\n", "", -1)
		arrSize, _ := strconv.Atoi(raw)
		raw, _ = reader.ReadString('\n')
		raw = strings.Replace(raw, "\r\n", "", -1)
		split := strings.Split(raw, " ")
		arr := make([]int, arrSize)
		for ic, ch := range split {
			arr[ic], _ = strconv.Atoi(ch)
		}
		check := checkArr(arr)
		if check {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

func checkArr(arr []int) bool {
	sort.Ints(arr)
	isFirst := true
	prev := 0
	for _, x := range arr {
		if isFirst {
			prev = x
			isFirst = false
		} else {
			if x == prev {
				return false
			}
			prev = x
		}
	}
	return true
}

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 n int
		fmt.Fscan(in, &n)

		mm := make(map[int]bool, n)
		f := true
		for i := 0; i < n; i++ {
			var v int
			fmt.Fscan(in, &v)

			if mm[v] {
				f = false
			}
			mm[v] = true
		}
		if f {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	t, _ := strconv.Atoi(scanner.Text())
	for i := 0; i < t; i++ {
		scanner.Scan()
		scanner.Scan()
		sl := strings.Split(scanner.Text(), " ")
		if CheckUniqueValue(CountValue(sl)) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

func CountValue(arr []string) (res map[string]int) {
	dict := make(map[string]int)
	for _, num := range arr {
		dict[num] = dict[num] + 1
	}
	res = dict
	return
}
func CheckUniqueValue(dict map[string]int) bool {
	for _, v := range dict {
		if 1 != v {
			return false
		}
	}
	return true
}

package main
import(
    "fmt"
    "sort"
)
func main() {
	var t int
	fmt.Scan(&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Scan(&n)
		var list []int = make([]int,n)
		for j:=0;j<n;j++{
			fmt.Scan(&list[j])
		}
		sort.Ints(list)
		for j:=0;j<n-1;j++{
			if list[j] >= list[j+1] {
				fmt.Println("NO")
				goto out
			}
		}
		fmt.Println("YES")
		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()
	for i := 1; i <= T; i++{
		N := readInt()
		can := true
		cache := make(map[int]bool)
		for ;N > 0; N-- {
			a := readInt()
			if cache[a] {
				can = false
			}
			cache[a] = true
		}
		ans := "NO"
		if can{
			ans = "YES"
		}
		fmt.Fprintln(writer, ans)
	}
}

package main

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

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

	// define testcases variable
	var testcases int
	fmt.Fscan(r, &testcases)

	for testcases > 0 {
		testcases -= 1
		var n int
		fmt.Fscan(r, &n)

		var arr = make([]int, n)

		for i := 0; i < n; i++ {
			fmt.Fscan(r, &arr[i])
		}

		sort.Ints(arr)
		var ret = ""

		for i := 1; i < n; i++ {
			if arr[i] == arr[i-1] {
				ret = "NO"
			}
		}
		if ret == "" {
			ret = "YES"
		}

		fmt.Fprintln(w, ret)
	}

}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var T int
	fmt.Scan(&T)
	for Case := 1; Case <= T; Case++ {
		var n int
		fmt.Scan(&n)
		var a = []int{}
		for i := 0; i < n; i++ {
			var x int
			fmt.Scan(&x)
			a = append(a, x)
		}
		sort.Ints(a)
		ok := true
		for i := 0; i + 1 < n; i++ {
			if a[i] == a[i + 1] {
				ok = false
				break
			}
		}
		if ok {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

type CF1742B struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1742B) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1742B) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1742B) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1742B) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1742B) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1742B
Date: 10/14/2022
User: wotan
URL: https://codeforces.com/problemset/problem/1742/B
Problem: CF1742B
**/
func (in *CF1742B) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		mapa := make(map[int]int)
		ans := true
		for i := 0; i < n; i++ {
			val := in.NextInt()
			mapa[val]++
			if v := mapa[val]; v > 1 {
				ans = false
			}
		}
		if ans {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

func NewCF1742B(r *bufio.Reader) *CF1742B {
	return &CF1742B{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1742B(bufio.NewReader(os.Stdin)).Run()
}

package main

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

func increasing(arr []int) string {
	d := map[int]bool{}

	for _, v := range arr {
		if _, ok := d[v]; ok {
			return "NO"
		}
		d[v] = true
	}

	return "YES"
}

func main() {
	in := bufio.NewReader(os.Stdin)
	tc := readInt(in)

	for i := 0; i < tc; i++ {
		_ = readInt(in) // n
		nums := readArrInt(in)
		fmt.Println(increasing(nums))
	}
}

func preprocessStringLine(in *bufio.Reader) string {
	str, _ := in.ReadString('\n')
	str = strings.ReplaceAll(str, "\r", "")
	str = strings.ReplaceAll(str, "\n", "")
	return str
}

func readInt(in *bufio.Reader) int {
	line := preprocessStringLine(in)
	n, _ := strconv.Atoi(line)
	return n
}

func readLineNumbs(in *bufio.Reader) []string {
	line := preprocessStringLine(in)
	numbs := strings.Split(line, " ")
	return numbs
}

func readArrInt(in *bufio.Reader) []int {
	numbs := readLineNumbs(in)
	arr := make([]int, len(numbs))
	for i, n := range numbs {
		val, _ := strconv.Atoi(n)
		arr[i] = val
	}
	return arr
}

package main

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

func main() {
	defer writer.Flush()
	var t int
	scanws(&t)
	for t > 0 {
		solve()
		t--
	}
}

func solve() {
	var n, i, currMin, nextMin int
	var a []int
	var orderable bool
	orderable = true
	scanws(&n)
	a = make([]int, n)
	for i := range a {
		scanws(&a[i])
	}
	if len(a) == 1 {
		printf("YES\n")
		return
	}
	currMin = MinIntIn(a)
	i = firstIndexOf(currMin, a)

	deleteFrom(i, &a)

	for len(a) > 0 {
		nextMin = MinIntIn(a)
		if currMin >= nextMin {
			orderable = false
			break
		}
		currMin = nextMin
		i = firstIndexOf(currMin, a)
		deleteFrom(i, &a)
	}

	switch {
	case orderable:
		printf("YES\n")
	default:
		printf("NO\n")
	}
}

func firstIndexOf(v int, arr []int) int {
	for i := range arr {
		if arr[i] == v {
			return i
		}
	}
	return -1
}

func MinIntIn(arr []int) int {
	var mn, sz int
	sz = len(arr)
	mn = arr[0]
	for i := 1; i < sz; i++ {
		mn = MinInt(mn, arr[i])
	}
	return mn
}

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

func deleteFrom(valueIndex int, slice *[]int) {
	tmp := make([]int, 0)
	tmp = append(tmp, (*slice)[:valueIndex]...)
	tmp = append(tmp, (*slice)[valueIndex+1:]...)
	*slice = tmp
}

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 scanws(a ...interface{}) { fmt.Fscan(reader, a...) }

package main

import (
  "sort"
	"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)

	for ; t > 0; t-- {
    var n int
    fmt.Fscan(in, &n)
    a := make([]int, n, n)
    for i := range a {
      fmt.Fscan(in, &a[i])
    }
    sort.Ints(a)
    ret := "YES"
    for i := 1; i < n; i++ {
      if a[i] == a[i-1] {
        ret = "NO"
        break;
      }
    }
    fmt.Println(ret)
	}
}

package main

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

var (
	reader = bufio.NewReader(os.Stdin)
	t, n   int
)

func solve(n int, a []int) string {
	sort.Ints(a)
	for i := 0; i < n-1; i++ {
		if a[i+1] == a[i] {
			return "NO"
		}
	}
	return "YES"
}

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		fmt.Fscan(reader, &n)
		a := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &a[i])
		}
		fmt.Println(solve(n, a))
	}
}

package main

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

const cf = true

func solve() {
	var n int
	fmt.Fscan(in, &n)
	arr := make([]int, n)
	for i := range arr {
		fmt.Fscan(in, &arr[i])
	}
	sort.Ints(arr)
	for i := 0; i < n-1; i++ {
		if arr[i] == arr[i+1] {
			fmt.Fprintln(out, "NO")
			return
		}
	}
	fmt.Fprintln(out, "YES")
}

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 := []byte(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 (
    "fmt"
    "sort"
)

func main() {
    var n int
    fmt.Scan(&n)

    for i:=0; i<n; i++ {
        var t int
        fmt.Scan(&t)

        arr := make([]int, 0, t)
        for j:=0; j<t; j++ {
            var x int
            fmt.Scan(&x)

            arr = append(arr, x)
        }
        sort.Ints(arr)

        flg := false
        for k:=1; k<t; k++ {
            if arr[k] == arr[k-1] {
                flg = true
                fmt.Println("NO")
                break;
            }
        }
        if !flg {
            fmt.Println("YES")
        }
    }
 }

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var s string
	fmt.Scanln(&s)
	count, _ := strconv.Atoi(s)
	answers := make([]string, 0, count)
	outer:
	for i := 0; i < count ; i++ {
		scanner.Scan()
		scanner.Scan()
		line := strings.Split(scanner.Text(), " ")
		myMap := make(map[string]int)
		for _, digit := range line {
			myMap[digit]++
			if myMap[digit] > 1 {
				answers = append(answers, "NO")
				continue outer
			}
		}
		answers = append(answers, "YES")
	}
	for _, answer := range answers {
		fmt.Println(answer)
	}
}

package main

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

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

func check(arr []int) string {
	mymap := make(map[int]int)
	for _, el := range arr {
		if _, ok := mymap[el]; ok {
			return "NO"
		} else {
			mymap[el] = 1
		}
	}

	return "YES"
}

func main() {
	writer.Flush()
	var test, size int
	fmt.Fscanf(reader, "%d\n", &test)
	for j := 0; j < test; j++ {
		fmt.Fscanf(reader, "%d\n", &size)

		var arr []int
		for i := 0; i < size; i++ {
			var temp int
			fmt.Fscanf(reader, "%d", &temp)
			arr = append(arr, temp)
		}
		fmt.Println(check(arr))
		fmt.Fscanf(reader, "\n")
	}
}

package main

import (
	"fmt"
	"sort"
)

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

		var numArr []int
		var num2 int
		fmt.Scan(&num2)
		for i := 0; i < num2; i++ {
			var num2 int
			fmt.Scan(&num2)
			numArr = append(numArr, num2)
		}
		var res string
		res = sec(numArr)
		fmt.Println(res)
	}

}
func sec(arr []int) string {
	sort.Ints(arr)
	for i := 0; i < len(arr)-1; i++ {
		if arr[i] >= arr[i+1] {
			return "no"
		}
	}
	return "yes"
}

package main

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

func main() {
	var tc int

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

	defer writer.Flush()

	fmt.Fscan(reader, &tc)

	for t := 0; t < tc; t++ {
		var n int

		fmt.Fscan(reader, &n)

		arr := make([]int, n)

		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &arr[i])
		}

		output := solve(&arr, n)

		fmt.Fprintln(writer, output)
	}
}

func solve(arr *[]int, n int) string {
	ans := "YES"

	sort.Ints(*arr)

	for i := 1; i < n; i++ {
		if (*arr)[i-1] >= (*arr)[i] {
			ans = "NO"
			break
		}
	}
	return ans
}

package main

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

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 n int
		fmt.Fscan(r, &n)
		a := make([]int, n)

		for i := range a { fmt.Fscan(r, &a[i]) }
		sort.Ints(a)

		res := "YES"
		for i := range a {
			if i == 0 { continue }
			if a[i] <= a[i-1] {
				res = "NO"
				break
			}
		}

		fmt.Fprintln(w, res)
	}

}

package main

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

var sc = bufio.NewScanner(os.Stdin)

const mod = 998244353
const N = 2e5

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

	T := nextInt()
	for T > 0 {
		T--
		n := nextInt()
		mp := map[int]int{}
		flag := false
		for i := 0; i < n; i++ {
			x := nextInt()
			mp[x]++
			if mp[x] > 1 {
				flag = true
			}
		}
		if flag {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}
}

func max(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"
	"io"
	"os"
	"sort"
)

type IO struct {
	in  io.Reader
	out io.Writer
}

func NewIO(in io.Reader, out io.Writer) *IO {
	return &IO{in: bufio.NewReader(in), out: out}
}

func (io *IO) ReadInt() int {
	var res int
	_, _ = fmt.Fscanf(io.in, "%d\n", &res)
	return res
}

func (io *IO) ReadPairInt() (int, int) {
	var a, b int
	_, _ = fmt.Fscanf(io.in, "%d %d\n", &a, &b)
	return a, b
}

func (io *IO) ReadString() string {
	var res string
	_, _ = fmt.Fscanf(io.in, "%s\n", &res)
	return res
}

func (io *IO) ReadIntSlice(n int) sort.IntSlice {
	var t int
	res := make(sort.IntSlice, 0, n)
	for i := 0; i < n; i++ {
		_, _ = fmt.Fscanf(io.in, "%d", &t)
		res = append(res, t)
	}
	_, _ = fmt.Fscanf(io.in, "\n")
	return res
}

func (io *IO) Println(v ...interface{}) {
	_, _ = fmt.Fprintln(io.out, v...)
}

func (io *IO) Print(v ...interface{}) {
	_, _ = fmt.Fprint(io.out, v...)
}

func (io *IO) Printf(format string, v ...interface{}) {
	_, _ = fmt.Fprintf(io.out, format, v...)
}

func (io *IO) PrintIntSlice(s sort.IntSlice) {
	for _, v := range s {
		io.Printf("%d ", v)
	}
}

func (io *IO) PrintlnIntSlice(s sort.IntSlice) {
	io.PrintIntSlice(s)
	io.Printf("\n")
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

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

func main() {
	io := NewIO(os.Stdin, os.Stdout)

	t := io.ReadInt()
p:
	for i := 0; i < t; i++ {
		n := io.ReadInt()
		a := io.ReadIntSlice(n)
		sort.Ints(a)
		for j := 1; j < len(a); j++ {
			if a[j] == a[j-1] {
				fmt.Println("NO")
				continue p
			}
		}
		fmt.Println("YES")
	}
}

package main

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

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

func solve() {
	n, v := _readArr()
	sort.Ints(v)
	for i := 0; i < n-1; i++ {
		if v[i] == v[i+1] {
			_print("NO")
			return
		}
	}
	_print("YES")
}

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

// ====
func _readInt() int {
	var x int
	fmt.Fscan(in, &x)
	return x
}
func _readStr() string {
	var x string
	fmt.Fscan(in, &x)
	return x
}
func _readArr() (int, []int) {
	var n int
	fmt.Fscan(in, &n)
	var v = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &v[i])
	}
	return n, v
}
func _print(x ...any) {
	fmt.Fprintln(out, x...)
}
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 _sortStr(x string) string {
	r := []rune(x)
	sort.Slice(r, func(i, j int) bool {
		return r[i] < r[j]
	})
	return string(r)
}
func _reverseInts(x []int) {
	n := len(x)
	for i := 0; i < n/2; i++ {
		x[i], x[n-1-i] = x[n-1-i], x[i]
	}
}
func _reverseStr(s string) string {
	x := []rune(s)
	n := len(x)
	for i := 0; i < n/2; i++ {
		x[i], x[n-1-i] = x[n-1-i], x[i]
	}
	return string(x)
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"io/ioutil"
	"os"
	"sort"
	"strings"
)

// https://space.bilibili.com/206214
func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	solve := func(curCase int) bool {
		var n int
		Fscan(in, &n)
		a := make([]int, n)
		for i := range a {
			Fscan(in, &a[i])
		}
		sort.Ints(a)
		for i := 1; i < n; i++ {
			if a[i-1] >= a[i] {
				return false

			}
		}
		return true
	}

	cases := 1
	Fscan(in, &cases)
	for curCase := 1; curCase <= cases; curCase++ {
		if solve(curCase){
			Fprintln(out, "YES")
		} else {
			Fprintln(out, "NO")
		}
	}

	// 如果是多组数据，请务必加上这段保险 —— 已经无法统计，有多少位竞赛选手在漏读数据上损失大把分数（包括我）
	// 此外，如果不小心写成了 scan(v) 而不是 scan(&v)，由于未传入指针，不会读入任何数据，这样本地运行一次就能立马发现错误
	leftData, _ := ioutil.ReadAll(in)
	if s := strings.TrimSpace(string(leftData)); s != "" {
		panic("有未读入的数据：\n" + s)
	}

}

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

package main

import (
	"fmt"
	"sort"
)

func main() {
	count := 0
	ind := 0

	fmt.Scanf("%d", &count)

	// fmt.Println("count ", count)

	for ind < count {
		a := 0
		index := 0
		numArr := []int{}

		fmt.Scanf("%d", &a)

		// fmt.Println("elem arr count ", a)

		if a == 1 {
			num := 0
			fmt.Scan(&num)
			// fmt.Println("-----------------", num)
			numArr = append(numArr, num)
		} else {
			for index < a {
				num := 0
				fmt.Scanf("%d", &num)
				// fmt.Println("---------", num)
				numArr = append(numArr, num)
				index += 1
			}
		}

		// fmt.Println("aa---", numArr)

		// fmt.Println(increasing(numArr))
		ind += 1
	}

	// sc := bufio.NewScanner(os.Stdin)
	// for sc.Scan() {
	// 	var (
	// 		txtArr []string
	// 		intArr []int
	// 	)
	// 	txtArr = strings.Split(sc.Text(), " ")

	// 	for _, v := range txtArr {
	// 		int, _ := strconv.Atoi(v)
	// 		intArr = append(intArr, int)
	// 	}

	// 	fmt.Println(increasing(intArr))

	// }
}

func increasing(arg []int) string {
	sort.Slice(arg, func(i, j int) bool {
		return arg[i] < arg[j]
	})

	if len(arg) == 1 {
		return "YES"
	}

	if arg[0] == arg[len(arg)-1] {
		return "NO"
	}

	return "YES"
}

package main

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

func main() {
	index := 1

	sc := bufio.NewScanner(os.Stdin)
	for sc.Scan() {
		var (
			txtArr []string
			intArr []int
		)
		txtArr = strings.Split(sc.Text(), " ")

		if index == 1 {
			index += 1
			continue
		}

		for _, v := range txtArr {
			int, _ := strconv.Atoi(v)
			intArr = append(intArr, int)
		}

		if index%2 == 1 {
			fmt.Println(increasing(intArr))
		}

		index += 1
	}
}

func increasing(arg []int) string {
	sort.Slice(arg, func(i, j int) bool {
		return arg[i] < arg[j]
	})

	if len(arg) == 1 {
		return "YES"
	}

	if arg[0] == arg[len(arg)-1] {
		return "NO"
	}

	return "YES"
}

package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	for sc.Scan() {
		var (
			txtArr []string
			intArr []int
		)
		txtArr = strings.Split(sc.Text(), " ")

		for _, v := range txtArr {
			int, _ := strconv.Atoi(v)
			intArr = append(intArr, int)
		}

		if len(intArr) > 1 {
			fmt.Println(increasing(intArr))
		}
	}
}

func increasing(arg []int) string {
	sort.Slice(arg, func(i, j int) bool {
		return arg[i] < arg[j]
	})

	if arg[0] == arg[len(arg)-1] {
		return "NO"
	}

	return "YES"
}

package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	for sc.Scan() {
		var (
			txtArr []string
			intArr []int
		)
		txtArr = strings.Split(sc.Text(), " ")

		for _, v := range txtArr {
			int, _ := strconv.Atoi(v)
			intArr = append(intArr, int)
		}

		// fmt.Println(intArr)
		if len(intArr) > 1 {
			fmt.Println(increasing(intArr))
		}
	}
}

func increasing(arg []int) string {
	sort.Slice(arg, func(i, j int) bool {
		return arg[i] < arg[j]
	})

	if arg[0] == arg[len(arg)-1] {
		return "NO"
	}

	return "YES"
}

package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	for sc.Scan() {
		var (
			txtArr []string
			intArr []int
		)
		txtArr = strings.Split(sc.Text(), " ")

		for _, v := range txtArr {
			int, _ := strconv.Atoi(v)
			intArr = append(intArr, int)
		}

		fmt.Println(intArr)
		if len(intArr) > 1 {
			fmt.Println(increasing(intArr))
		}
	}
}

func increasing(arg []int) string {
	sort.Slice(arg, func(i, j int) bool {
		return arg[i] < arg[j]
	})

	if arg[0] == arg[len(arg)-1] {
		return "NO"
	}

	return "YES"
}

package main

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

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

	for i := 0; i<num; i++ {
	    sc.Scan()
	    sc.Text()
	    sc.Scan()

		var (
			txtArr []string
			intArr []int
		)
		txtArr = strings.Split(sc.Text(), " ")

		for _, v := range txtArr {
			int, _ := strconv.Atoi(v)
			intArr = append(intArr, int)
		}

	    fmt.Println(increasing(intArr))
	}
}

func increasing(arg []int) string {
	sort.Slice(arg, func(i, j int) bool {
		return arg[i] < arg[j]
	})

	for i := 1; i<len(arg) - 1; i++ {
	    if arg[i] == arg[i - 1] {
	        return "NO"
	    }
	}

	return "YES"
}

package main

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

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

	for i := 0; i<num; i++ {
	    sc.Scan()
	    sc.Text()
	    sc.Scan()

		var (
			txtArr []string
			intArr []int
		)
		txtArr = strings.Split(sc.Text(), " ")

		for _, v := range txtArr {
			int, _ := strconv.Atoi(v)
			intArr = append(intArr, int)
		}

	    fmt.Println(increasing(intArr))
	}
}

func increasing(arg []int) string {
	sort.Slice(arg, func(i, j int) bool {
		return arg[i] > arg[j]
	})

	for i := 1; i<len(arg) - 1; i++ {
	    if arg[i] == arg[i - 1] {
	        return "NO"
	    }
	}

	return "YES"
}

package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	for sc.Scan() {
		var (
			txtArr []string
			intArr []int
		)
		txtArr = strings.Split(sc.Text(), " ")

		for _, v := range txtArr {
			int, _ := strconv.Atoi(v)
			intArr = append(intArr, int)
		}

	    fmt.Println(increasing(intArr))
	}
}

func increasing(arg []int) string {
	sort.Slice(arg, func(i, j int) bool {
		return arg[i] > arg[j]
	})

	if arg[0] == arg[len(arg)-1] - len(arg) + 1 {
		return "YES"
	}

	return "NO"
}

package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	for sc.Scan() {
		var (
			txtArr []string
			intArr []int
		)
		txtArr = strings.Split(sc.Text(), " ")

		for _, v := range txtArr {
			int, _ := strconv.Atoi(v)
			intArr = append(intArr, int)
		}

		if len(intArr) > 1 {
			fmt.Println(increasing(intArr))
		}
	}
}

func increasing(arg []int) string {
	sort.Slice(arg, func(i, j int) bool {
		return arg[i] < arg[j]
	})

	if arg[0] == arg[len(arg)-1] - len(arg) + 1 {
		return "YES"
	}

	return "NO"
}

package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	for sc.Scan() {
		var (
			txtArr []string
			intArr []int
		)
		txtArr = strings.Split(sc.Text(), " ")

		for _, v := range txtArr {
			int, _ := strconv.Atoi(v)
			intArr = append(intArr, int)
		}

		fmt.Println(intArr)
		if len(intArr) > 1 {
			fmt.Println(increasing(intArr))
		}
	}
}

func increasing(arg []int) string {
	sort.Slice(arg, func(i, j int) bool {
		return arg[i] < arg[j]
	})

	if arg[0] == arg[len(arg)-1] - len(arg) + 1 {
		return "YES"
	}

	return "NO"
}

package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	for sc.Scan() {
		var (
			txtArr []string
			intArr []int
		)
		txtArr = strings.Split(sc.Text(), " ")

		for _, v := range txtArr {
			int, _ := strconv.Atoi(v)
			intArr = append(intArr, int)
		}

		fmt.Println(intArr)
		if len(intArr) > 1 {
			fmt.Println(increasing(intArr))
		}
	}
}

func increasing(arg []int) string {
	sort.Slice(arg, func(i, j int) bool {
		return arg[i] < arg[j]
	})

	if arg[0] == arg[len(arg)-1] - len(arg) + 1 {
		return "NO"
	}

	return "YES"
}

package main

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

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

func solve() {
	var n, x int
	Fscan(r, &n)
	set := map[int]bool{}
	for i := 0; i < n; i++ {
		Fscan(r, &x)
		if _, ok := set[x]; ok {
			Fprintf(w, "NO\n")
			return
		}

		set[x] = true
	}
	Fprintf(w, "YES\n")
}

func main() {
	defer w.Flush()

	var t int
	for Fscan(r, &t); t > 0; t-- {
		solve()
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"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 parseNumbers(n int, s string) []int {
	res := make([]int, 0)
	for _, f := range strings.Fields(s) {
		i, err := strconv.Atoi(f)
		if err == nil {
			res = append(res, i)
		}
	}
	return res
}

func solve() {
	n := 0
	fmt.Scanf("%d", &n)

	if s, e := reader.ReadString('\n'); e == nil {
		m := make(map[int]bool, n)
		nums := parseNumbers(n, s)
		for _, v := range nums {
			if _, ok := m[v]; ok {
				fmt.Println("NO")
				return
			}

			m[v] = true
		}
	}

	fmt.Println("YES")
}

func main() {
	// defer writer.Flush()

	var t, i = 0, 0
	fmt.Scanf("%d", &t)
	for ; i < t; i++ {
		solve()
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"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...) }
var scanner *bufio.Scanner = bufio.NewScanner(os.Stdin)

func parseNumbers(n int, s string) []int {
	res := make([]int, 0)
	for _, f := range strings.Fields(s) {
		i, err := strconv.Atoi(f)
		if err == nil {
			res = append(res, i)
		}
	}
	return res
}

func solve() {
	n := 0
	fmt.Scanf("%d", &n)
	if scanner.Scan() {
		nums := parseNumbers(n, scanner.Text())
		m := make(map[int]bool, n)
		for _, v := range nums {
			if _, ok := m[v]; ok {
				fmt.Println("NO")
				return
			}

			m[v] = true
		}
	}

	fmt.Println("YES")
}

func main() {
	// defer writer.Flush()

	var t, i = 0, 0
	fmt.Scanf("%d", &t)
	for ; i < t; i++ {
		solve()
	}
}

package main

import (
	"fmt"
)

func main() {
	//in := bufio.NewReader(os.Stdin)
	var t, n int
	fmt.Scan(&t)
	for t > 0 {
		t--
		fmt.Scan(&n)
		var x int
		m := make(map[int]int)
		flag := true
		for i := 0; i < n; i++ {
			fmt.Scan(&x)
			m[x]++
			//fmt.Println(x, " => ", m[x], m[x] > 1)
			if m[x] > 1 {
				flag = false
				break
			}
		}
		//fmt.Println(t, n, flag, m)
		if flag {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}

}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t, n int
	fmt.Fscan(in, &t)
	for t > 0 {
		t--
		fmt.Fscan(in, &n)
		var x int64
		m := make(map[int64]int)
		var flag bool
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &x)
			m[x]++
			if m[x] > 1 {
				flag = true
				break
			}
		}
		if !flag {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}

}

package main

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

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

func solve() {
	var n int
	fmt.Fscan(in, &n)
	hashMap := make(map[int]struct{})
	for i := 0; i < n; i++ {
		var a int
		fmt.Fscan(in, &a)
		if _, ok := hashMap[a]; !ok {
			hashMap[a] = struct{}{}
		} else {
			fmt.Fprintln(out, "NO")
			return
		}
	}

	fmt.Fprintln(out, "YES")
}

func main() {
	var T int
	fmt.Fscan(in, &T)
	for ; T > 0; T-- {
		solve()
	}
	out.Flush()
}

package main

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

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

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

	var T int
	var n int
	var x int

loop:
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n)
		m := map[int]bool{}
		for i := 0; i < n; i++ {
			Fscan(in, &x)
			if m[x] {
				Fprintln(out, "NO")
				continue loop
			}
			m[x] = true
		}

		Fprintln(out, "YES")
	}
}

package main

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

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

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

	var T int
	var n int
	var x int

loop:
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n)
		m := map[int]bool{}
		for i := 0; i < n; i++ {
			Fscan(in, &x)
			if m[x] {
				Fprintln(out, "NO")
				continue loop
			} else {
				m[x] = true
			}
		}

		Fprintln(out, "YES")
	}
}

package main

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

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

	var T, N int
	for fmt.Fscan(in, &T); T > 0; T-- {
		fmt.Fscan(in, &N)
		nums := make([]int, N)
		for i := 0; i < N; i++ {
			fmt.Fscan(in, &nums[i])
		}
		flag := false
		if N == 1 {
			fmt.Fprintln(out, "YES")
			flag = true
			break
		} else {
			sort.Ints(nums)
			for i := 1; i < N; i++ {
				if nums[i] == nums[i-1] {
					fmt.Fprintln(out, "NO")
					flag = true
					break
				}
			}
		}
		if !flag {
			fmt.Fprintln(out, "YES")
		}
	}
}

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

package main

import "fmt"

func main() {
	var t int

	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		var n int
		fmt.Scan(&n)
		fmt.Printf("num is %d \n", n)
		mp := make(map[int]bool)
		flag := false
		for j := 0; j < n; j++ {
			var a int
			fmt.Scan(&a)
			if mp[a] == true {
				flag = true
			}
			mp[a] = true
		}
		if flag == false {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	text, _ := reader.ReadString('\n')
	text = strings.Replace(text, "\r\n", "", -1)
	t := 0
	t, _ = strconv.Atoi(text)
	for i := 0; i < t; i++ {
		raw, _ := reader.ReadString('\n')
		raw = strings.Replace(raw, "\r\n", "", -1)
		arrSize, _ := strconv.Atoi(raw)
		raw, _ = reader.ReadString('\n')
		raw = strings.Replace(raw, "\r\n", "", -1)
		split := strings.Split(raw, " ")
		arr := make([]int, arrSize)
		for ic, ch := range split {
			arr[ic], _ = strconv.Atoi(ch)
		}
		check := checkArr(arr)
		if check {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

func checkArr(arr []int) bool {
	sort.Ints(arr)
	isFirst := true
	prev := 0
	for _, x := range arr {
		if isFirst {
			prev = x
			isFirst = false
		} else {
			if x == prev {
				return false
			}
		}
	}
	return true
}

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 n int
		fmt.Fscan(in, &n)

		mm := make(map[int]bool, n)
		f := true
		for i := 0; i < n; i++ {
			var v int
			fmt.Fscan(in, &v)

			if mm[v] {
				f = false
				break
			}
			mm[v] = true
		}
		if f {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}


package main

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

const mx = 1e6

var d [mx + 1]int
var buf = make([]byte, 4096)
var _i = len(buf)

func rc() byte {
	if _i == len(buf) {
		os.Stdin.Read(buf)
		_i = 0
	}
	b := buf[_i]
	_i++
	return b
}

func ri() (x int) {
	b := rc()
	for ; '0' > b; b = rc() {
	}
	for ; '0' <= b; b = rc() {
		x = x*10 + int(b&15)
	}
	return
}

func init() {
	for i := 1; i <= mx; i++ {
		for j := i; j <= mx; j += i {
			d[j]++
		}
	}
}

type seg []struct {
	l, r  int
	s     int64
	fixed bool
}

func (t seg) _pushUp(o int) {
	lo, ro := t[o<<1], t[o<<1|1]
	t[o].s = lo.s + ro.s
	t[o].fixed = lo.fixed && ro.fixed
}

func (t seg) _build(o, l, r int) {
	t[o].l, t[o].r = l, r
	if l == r {
		t[o].s = int64(ri())
		t[o].fixed = t[o].s <= 2
		return
	}
	m := (l + r) >> 1
	t._build(o<<1, l, m)
	t._build(o<<1|1, m+1, r)
	t._pushUp(o)
}

func (t seg) _update(o, l, r int) {
	to := &t[o]
	if to.fixed {
		return
	}
	if to.l == to.r {
		to.s = int64(d[to.s])
		to.fixed = to.s <= 2
		return
	}
	m := (to.l + to.r) >> 1
	if l <= m {
		t._update(o<<1, l, r)
	}
	if m < r {
		t._update(o<<1|1, l, r)
	}
	t._pushUp(o)
}

func (t seg) _query(o, l, r int) (s int64) {
	ol, or := t[o].l, t[o].r
	if l <= ol && or <= r {
		return t[o].s
	}
	m := (ol + or) >> 1
	if l <= m {
		s += t._query(o<<1, l, r)
	}
	if m < r {
		s += t._query(o<<1|1, l, r)
	}
	return
}

func (t seg) init(n int)           { t._build(1, 1, n) }
func (t seg) update(l, r int)      { t._update(1, l, r) }
func (t seg) query(l, r int) int64 { return t._query(1, l, r) }

// github.com/EndlessCheng/codeforces-go
func main() {
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	n, q := ri(), ri()
	t := make(seg, 4*n)
	t.init(n)
	for ; q > 0; q-- {
		if ri() == 1 {
			t.update(ri(), ri())
		} else {
			Fprintln(out, t.query(ri(), ri()))
		}
	}
}

package main

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

var d [1e6 + 1]int

type seg []struct {
	l, r  int
	s     int64
	fixed bool
}

func (t seg) _pushUp(o int) {
	lo, ro := t[o<<1], t[o<<1|1]
	t[o].s = lo.s + ro.s
	t[o].fixed = lo.fixed && ro.fixed
}

func (t seg) _build(a []int, o, l, r int) {
	t[o].l, t[o].r = l, r
	if l == r {
		t[o].s = int64(a[l-1])
		t[o].fixed = a[l-1] <= 2
		return
	}
	m := (l + r) >> 1
	t._build(a, o<<1, l, m)
	t._build(a, o<<1|1, m+1, r)
	t._pushUp(o)
}

func (t seg) _update(o, l, r int) {
	to := &t[o]
	if to.fixed {
		return
	}
	if to.l == to.r {
		to.s = int64(d[to.s])
		to.fixed = to.s <= 2
		return
	}
	m := (to.l + to.r) >> 1
	if l <= m {
		t._update(o<<1, l, r)
	}
	if m < r {
		t._update(o<<1|1, l, r)
	}
	t._pushUp(o)
}

func (t seg) _query(o, l, r int) (s int64) {
	ol, or := t[o].l, t[o].r
	if l <= ol && or <= r {
		return t[o].s
	}
	m := (ol + or) >> 1
	if l <= m {
		s += t._query(o<<1, l, r)
	}
	if m < r {
		s += t._query(o<<1|1, l, r)
	}
	return
}

func (t seg) init(a []int)         { t._build(a, 1, 1, len(a)) }
func (t seg) update(l, r int)      { t._update(1, l, r) }
func (t seg) query(l, r int) int64 { return t._query(1, l, r) }

// github.com/EndlessCheng/codeforces-go
func CF920F(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	const mx = 1e6
	for i := 1; i <= mx; i++ {
		for j := i; j <= mx; j += i {
			d[j]++
		}
	}

	var n, q, op, l, r int
	Fscan(in, &n, &q)
	a := make([]int, n)
	for i := range a {
		Fscan(in, &a[i])
	}
	t := make(seg, 4*n)
	t.init(a)
	for ; q > 0; q-- {
		if Fscan(in, &op, &l, &r); op == 1 {
			t.update(l, r)
		} else {
			Fprintln(out, t.query(l, r))
		}
	}
}

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

package main

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

const mx = 1e6
var d [mx + 1]int
var buf = make([]byte, 4096)
var _i = len(buf)

func rc() byte {
	if _i == len(buf) {
		os.Stdin.Read(buf)
		_i = 0
	}
	b := buf[_i]
	_i++
	return b
}

func ri() (x int) {
	b := rc()
	for ; '0' > b; b = rc() {
	}
	for ; '0' <= b; b = rc() {
		x = x*10 + int(b&15)
	}
	return
}

func init() {
	for i := 1; i <= mx; i++ {
		for j := i; j <= mx; j += i {
			d[j]++
		}
	}
}

type seg []struct {
	l, r  int
	s     int64
	fixed bool
}

func (t seg) _pushUp(o int) {
	lo, ro := t[o<<1], t[o<<1|1]
	t[o].s = lo.s + ro.s
	t[o].fixed = lo.fixed && ro.fixed
}

func (t seg) _build(o, l, r int) {
	t[o].l, t[o].r = l, r
	if l == r {
		t[o].s = int64(ri())
		t[o].fixed = t[o].s <= 2
		return
	}
	m := (l + r) >> 1
	t._build(o<<1, l, m)
	t._build(o<<1|1, m+1, r)
	t._pushUp(o)
}

func (t seg) _update(o, l, r int) {
	to := &t[o]
	if to.fixed {
		return
	}
	if to.l == to.r {
		to.s = int64(d[to.s])
		to.fixed = to.s <= 2
		return
	}
	m := (to.l + to.r) >> 1
	if l <= m {
		t._update(o<<1, l, r)
	}
	if m < r {
		t._update(o<<1|1, l, r)
	}
	t._pushUp(o)
}

func (t seg) _query(o, l, r int) (s int64) {
	ol, or := t[o].l, t[o].r
	if l <= ol && or <= r {
		return t[o].s
	}
	m := (ol + or) >> 1
	if l <= m {
		s += t._query(o<<1, l, r)
	}
	if m < r {
		s += t._query(o<<1|1, l, r)
	}
	return
}

func (t seg) init(n int)           { t._build(1, 1, n) }
func (t seg) update(l, r int)      { t._update(1, l, r) }
func (t seg) query(l, r int) int64 { return t._query(1, l, r) }

// github.com/EndlessCheng/codeforces-go
func main() {
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	n := ri()
	t := make(seg, 4*n)
	t.init(n)
	for q := ri(); q > 0; q-- {
		if ri() == 1 {
			t.update(ri(), ri())
		} else {
			Fprintln(out, t.query(ri(), ri()))
		}
	}
}

package main

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

var d [1e6 + 1]int

type seg []struct {
	l, r, s int
	isFixed bool
}

func (t seg) _pushUp(o int) {
	lo, ro := t[o<<1], t[o<<1|1]
	t[o].s = lo.s + ro.s
	t[o].isFixed = lo.isFixed && ro.isFixed
}

func (t seg) _build(a []int, o, l, r int) {
	t[o].l, t[o].r = l, r
	if l == r {
		t[o].s = a[l-1]
		t[o].isFixed = t[o].s <= 2
		return
	}
	m := (l + r) >> 1
	t._build(a, o<<1, l, m)
	t._build(a, o<<1|1, m+1, r)
	t._pushUp(o)
}

func (t seg) _update(o, l, r int) {
	to := &t[o]
	if to.isFixed {
		return
	}
	if to.l == to.r {
		to.s = d[to.s]
		to.isFixed = to.s <= 2
		return
	}
	m := (to.l + to.r) >> 1
	if l <= m {
		t._update(o<<1, l, r)
	}
	if m < r {
		t._update(o<<1|1, l, r)
	}
	t._pushUp(o)
}

func (t seg) _query(o, l, r int) (res int) {
	ol, or := t[o].l, t[o].r
	if l <= ol && or <= r {
		return t[o].s
	}
	m := (ol + or) >> 1
	if l <= m {
		res += t._query(o<<1, l, r)
	}
	if m < r {
		res += t._query(o<<1|1, l, r)
	}
	return
}

func (t seg) init(a []int)       { t._build(a, 1, 1, len(a)) }
func (t seg) update(l, r int)    { t._update(1, l, r) }
func (t seg) query(l, r int) int { return t._query(1, l, r) }

// github.com/EndlessCheng/codeforces-go
func CF920F(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	const mx = 1e6
	for i := 1; i <= mx; i++ {
		for j := i; j <= mx; j += i {
			d[j]++
		}
	}

	var n, q, op, l, r int
	Fscan(in, &n, &q)
	a := make([]int, n)
	for i := range a {
		Fscan(in, &a[i])
	}
	t := make(seg, 4*n)
	t.init(a)
	for ; q > 0; q-- {
		if Fscan(in, &op, &l, &r); op == 1 {
			t.update(l, r)
		} else {
			Fprintln(out, t.query(l, r))
		}
	}
}

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


package main

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

var scanner = bufio.NewScanner(os.Stdin)

func scanNum() int {
	scanner.Scan()
	num, _ := strconv.Atoi(scanner.Text())
	return num
}

func main() {
	scanner.Split(bufio.ScanWords)
	n, m, x, y, c, sum := scanNum(), scanNum(), scanNum(), scanNum(), scanNum(), int64(0)

	for i := 0; i < c; i++ {
		dx, dy, step := scanNum(), scanNum(), math.MaxInt32
		if dx != 0 {
			newStep := (n - x) / dx
			if dx < 0 {
				newStep = (x - 1) / -dx
			}
			if newStep < step {
				step = newStep
			}
		}
		if dy != 0 {
			newStep := (m - y) / dy
			if dy < 0 {
				newStep = (y - 1) / -dy
			}
			if newStep < step {
				step = newStep
			}
		}
		sum, x, y = sum+int64(step), x+step*dx, y+step*dy
	}

	fmt.Println(sum)
}

// 152B
package main

import (
	"fmt"
)

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

func main() {
	var i, k, n, m, x, y, dx, dy, ans, z1, z2, z int64
	ans = 0
	fmt.Scan(&n, &m, &x, &y, &k)
	for i = 1; i <= k; i++ {
		fmt.Scan(&dx, &dy)
		if dx < 0 {
			z1 = (1 - x) / dx
		} else if dx > 0 {
			z1 = (n - x) / dx
		} else {
			z1 = 1000000000
		}
		if dy < 0 {
			z2 = (1 - y) / dy
		} else if dy > 0 {
			z2 = (m - y) / dy
		} else {
			z2 = 1000000000
		}
		z = min(z1, z2)
		ans += z
		x = x + z*dx
		y = y + z*dy
	}
	fmt.Print(ans)
}

package main

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

type sortR [][2]int

func (r sortR) Less(i, j int) bool {
	if r[i][0] == r[j][0] {
		return r[i][1] < r[j][1]
	}
	return r[i][0] < r[j][0]
}
func (r sortR) Len() int      { return len(r) }
func (r sortR) Swap(i, j int) { r[i], r[j] = r[j], r[i] }

func main() {
	n, k, q := 0, 0, 0
	fmt.Scan(&n, &k, &q)
	r := make([][2]int, n)
	qL := make([][2]int, q)
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	for i := 0; i < n; i++ {
		scanner.Scan()
		r[i][0], _ = strconv.Atoi(scanner.Text())
		scanner.Scan()
		r[i][1], _ = strconv.Atoi(scanner.Text())
	}
	sort.Sort(sortR(r))
	for i := 0; i < q; i++ {
		scanner.Scan()
		qL[i][0], _ = strconv.Atoi(scanner.Text())
		scanner.Scan()
		qL[i][1], _ = strconv.Atoi(scanner.Text())
	}

	qMap := map[int]bool{}
	for _, v := range qL {
		rCount := 0
		for i := v[0]; i <= v[1]; i++ {
			if res, ok := qMap[i]; ok == true {
				if res {
					rCount++
				}
				continue
			}

			// lower := -1
			// // Search the smallest j that r[j][1] >= i, and has bug here
			// // Because r[0][1] might be much bigger then r[1][1]
			// // And r[1][1] might not match the need for r[j][1] >= i, which break stuff
			// l, h := 0, len(r)-1
			// for l <= h {
			// 	mid := (l + h) / 2
			// 	if r[mid][1] >= i {
			// 		lower = mid
			// 		h = mid - 1
			// 	} else {
			// 		l = mid + 1
			// 	}
			// }
			// if lower == -1 {
			// 	continue
			// }

			upper := -1
			// Search the largest j that r[j][0] <= i
			l, h := 0, len(r)-1
			for l <= h {
				mid := (l + h) / 2
				if r[mid][0] <= i {
					upper = mid
					l = mid + 1
				} else {
					h = mid - 1
				}
			}
			if upper == -1 {
				continue
			}

			count := 0
			for j := 0; j <= upper; j++ {
				if r[j][1] >= i {
					count++
				}
			}

			qMap[i] = false
			if count >= k {
				rCount++
				qMap[i] = true
			}
		}
		fmt.Println(rCount)
	}
}

package main

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

var scanner = bufio.NewScanner(os.Stdin)

func scanNum() int {
	scanner.Scan()
	num, _ := strconv.Atoi(scanner.Text())
	return num
}

func main() {
	scanner.Split(bufio.ScanWords)
	n, m, x, y, c, sum := scanNum(), scanNum(), scanNum(), scanNum(), scanNum(), 0

	for i := 0; i < c; i++ {
		dx, dy, step := scanNum(), scanNum(), math.MaxInt32
		if dx != 0 {
			newStep := (n - x) / dx
			if dx < 0 {
				newStep = (x - 1) / -dx
			}
			if newStep < step {
				step = newStep
			}
		}
		if dy != 0 {
			newStep := (m - y) / dy
			if dy < 0 {
				newStep = (y - 1) / -dy
			}
			if newStep < step {
				step = newStep
			}
		}
		sum, x, y = sum+step, x+step*dx, y+step*dy
	}

	fmt.Println(sum)
}


package main

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

// -----------------------------------------------------------------------------

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

func IsNewLine(c byte) bool {
	switch c {
	case '\n', '\r':
		return true
	}
	return false
}

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

// -----------------------------------------------------------------------------

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// -----------------------------------------------------------------------------

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minll(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxll(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

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

func absll(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}

func main() {
	defer Flush()

	n := readi()
	m := readi()
	A := make([][]byte, n)
	for i := range A {
		A[i] = readb()
	}
	a := make([]int, m)
	for i := range a {
		a[i] = readi()
	}

	var ans int
	for j := range a {
		t := make([]int, 5)
		for i := range A {
			t[A[i][j]-'A']++
		}
		x := 0
		for _, v := range t {
			x = max(x, v)
		}
		ans += a[j] * x
	}
	println(ans)
}

package main

import (
	"bufio"
	"os"
	"runtime"
	"strconv"
)

/* solution */

func solve() {

	n, m := readInt(), readInt()
	arr := make([][5]int, m)

	for i := 0; i < n; i++ {
		s := readString()
		for num, c := range s {
			arr[num][c-'A']++
		}
	}

	var points = make([]int, m)
	for i := 0; i < m; i++ {
		points[i] = readInt()
	}

	ret := 0

	for i := 0; i < m; i++ {
		max := arr[i][0]
		for c := 'B'; c <= 'E'; c++ {
			if arr[i][c-'A'] > max {
				max = arr[i][c-'A']
			}
		}
		ret += points[i] * max
	}

	println(strconv.Itoa(ret))

}

/* stubs */

func main() {

	var f *os.File
	if runtime.GOROOT() == "C:\\Soft\\Go" {
		f, _ = os.Open("input.txt")
	} else {
		f = os.Stdin
	}
	defer f.Close()

	writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	reader = bufio.NewScanner(f)
	reader.Split(bufio.ScanWords)

	solve()

}

var reader *bufio.Scanner
var writer *bufio.Writer

func readInt() int {
	reader.Scan()
	ret, _ := strconv.Atoi(reader.Text())
	return ret
}

func readString() string {
	reader.Scan()
	return reader.Text()
}

func print(s string) {
	writer.WriteString(s)
}

func println(s string) {
	print(s)
	print("\n")
}

package main

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

func main() {
	var n, q, cnt int

	scr := bufio.NewReader(os.Stdin)
	// ocr := bufio.NewWriter(os.Stdout)

	fmt.Fscanln(scr, &n, &q)
	st := make([]string, n)
	m := make([]int, q)
	choices := make(map[string]int)
	choices["A"] = 0
	choices["B"] = 1
	choices["C"] = 2
	choices["D"] = 3
	choices["E"] = 4

	for i := 0; i < n; i++ {
		fmt.Fscanln(scr, &st[i])
	}
	for i := 0; i < q; i++ {
		fmt.Fscanf(scr, "%d", &m[i])
	}

	for i := 0; i < q; i++ {
		arr := make([]int, 5)
		for _, y := range st {
			arr[choices[string(y[i])]]++
		}

		max := 0
		for _, y := range arr {
			if y > max {
				max = y
			}
		}
		cnt += m[i] * max
	}
	fmt.Println(cnt)
}

//HOWDY! IT'S ME! A HARD BLACKISH DICK MOVE!
package main

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

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := PrintlnInts(X...)

/*******************************************************************/

func main() {
	n, m := ReadInt2()
	dist := make([][5]int, m)
	for i := 0; i < n; i++ {
		s := ReadString()
		for j := 0; j < m; j++ {
			dist[j][s[j]-'A']++
		}
	}
	scores := ReadIntSlice(m)
	ans := 0
	for j := 0; j < m; j++ {
		max := 0
		for k := 0; k < 5; k++ {
			if dist[j][k] > max {
				max = dist[j][k]
			}
		}
		ans += max * scores[j]
	}
	fmt.Println(ans)
}

/*********** Math ***********/
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func min(args ...int) int {
	if len(args) == 0 {
		panic("empty!")
	}
	min := args[0]
	for i := 1; i < len(args); i++ {
		if args[i] < min {
			min = args[i]
		}
	}
	return min
}

func max(args ...int) int {
	if len(args) == 0 {
		panic("empty!")
	}
	max := args[0]
	for i := 1; i < len(args); i++ {
		if args[i] > max {
			max = args[i]
		}
	}
	return max
}

func _gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return _gcd(b, a%b)
}

func gcd(args ...int) int {
	if len(args) == 0 {
		panic("empty!")
	}
	gcd := args[0]
	for i := 1; i < len(args); i++ {
		gcd = _gcd(gcd, args[i])
	}
	return gcd
}

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func init() {
	ReadString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9))
	// Split sets the split function for the Scanner. The default split function is ScanLines.
	// Split panics if it is called after scanning has started.
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return readInt()
}
func ReadInt2() (int, int) {
	return readInt(), readInt()
}
func ReadInt3() (int, int, int) {
	return readInt(), readInt(), readInt()
}
func ReadInt4() (int, int, int, int) {
	return readInt(), readInt(), readInt(), readInt()
}

func readInt_64() int64 {
	return readIntNbits(64)
}

func ReadInt2_64() (int64, int64) {
	return readInt_64(), readInt_64()
}

func ReadInt3_64() (int64, int64, int64) {
	return readInt_64(), readInt_64(), readInt_64()
}

func readInt() int {
	return int(readIntNbits(32))
}

func readIntNbits(n int) int64 {
	i, err := strconv.ParseInt(ReadString(), 0, n)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

// PrintIntsLine returns integers string delimited by a space.
func PrintlnInts(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	n, m, t := 0, 0, 0
	fmt.Sscanf(scanner.Text(), "%d %d", &n, &m)
	r := make([][5]int, m)
	for i := 0; i < n; i++ {
		scanner.Scan()
		for i, a := range scanner.Text() {
			r[i][a-'A']++
		}
	}
	v := make([]int, m)
	scanner.Scan()
	for i, c := range strings.Split(scanner.Text(), " ") {
		v[i], _ = strconv.Atoi(c)
	}
	for i := range r {
		max := 0
		for _, a := range r[i] {
			if a > max {
				max = a
			}
		}
		t += max * v[i]
	}
	fmt.Println(t)
}

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

func getNumsFromOneLine(ir *bufio.Reader) []int {
	stream, _ := ir.ReadString('\n')
	// Trims the stream and then splits
	trimmedStream := strings.TrimSpace(stream)
	splitArr := strings.Split(trimmedStream, " ")
	// convert strings to integers and store them in a slice
	nums := make([]int, len(splitArr))
	for index, val := range splitArr {
		nums[index], _ = strconv.Atoi(val)
	}
	return nums
}

func main(){
	ir := bufio.NewReader(os.Stdin)
	nm := getNumsFromOneLine(ir)
	n, m := nm[0], nm[1]

	lookup := make([][5]int, m)
	for i := 0; i < n; i++ {
		ans, _ := ir.ReadString('\n')
    //fmt.Println(ans)
		for j := 0; j < m; j++ {
			lookup[j][ans[j] - 'A'] += 1
		}
	}

  scores := getNumsFromOneLine(ir)
	res := 0
	for i := 0; i < m; i++ {
		max := 0
		for _, cnt := range lookup[i] {
			if cnt > max {
				max = cnt
			}
		}
		score := scores[i]
    //fmt.Println(score)
		res += score * max
	}
	fmt.Println(res)
}

package main
import "fmt"

func main(){
	var n, m int
	fmt.Scanf("%d %d\n", &n, &m)

	lookup := make([][5]int, m)
	for i := 0; i < n; i++ {
		ans := ""
		fmt.Scanf("%s\n", &ans)
		for j := 0; j < m; j++ {
			lookup[j][ans[j] - 'A'] += 1
		}
	}

	res := 0
	for i := 0; i < m; i++ {
		max := 0
		for _, cnt := range lookup[i] {
			if cnt > max {
				max = cnt
			}
		}
		score := 0
		//fmt.Scanf("%d", &score)
		res += score * max
	}
	fmt.Println(res)
}

package main
import "fmt"

func main(){
	var n, m int
	fmt.Scanf("%d %d\n", &n, &m)

	lookup := make([][5]int, m)
	for i := 0; i < n; i++ {
		ans := ""
		fmt.Scanf("%s\n", &ans)
		for j := 0; j < m; j++ {
			lookup[i][ans[j] - 'A'] += 1
		}
	}

	res := 0
	for i := 0; i < m; i++ {
		max := 0
		for _, cnt := range lookup[i] {
			if cnt > max {
				max = cnt
			}
		}
		score := 0
		fmt.Scanf("%d", &score)
		res += score * max
	}
	fmt.Println(res)
}

package main
import "fmt"

func main(){
	var n, m int
	fmt.Scanf("%d %d\n", &n, &m)

	lookup := make(map[int]map[byte]int)
	for i := 0; i < n; i++ {
		ans := ""
		fmt.Scanf("%s\n", &ans)
		for j := 0; j < m; j++ {
			if _, ok := lookup[j]; ok {
				if _, o := lookup[j][ans[j]]; o {
					lookup[j][ans[j]] = lookup[j][ans[j]] + 1
				} else {
					lookup[j][ans[j]] = 1
				}
			} else {
				lookup[j] = map[byte]int{ans[j] : 1}
			}

		}
	}

	res := 0
	for i := 0; i < m; i++ {
		max := 0
		for _, cnt := range lookup[i] {
			if cnt > max {
				max = cnt
			}
		}
		score := 0
		fmt.Scanf("%d\n", &score)
		res += score * max
	}
	fmt.Println(res)
}

package main

import (
	"bufio"
	"os"
	"runtime"
	"strconv"
)

/* solution */

func solve() {

	n, m := readInt(), readInt()
	arr := make([][5]int, m)

	for i := 0; i < n; i++ {
		s := readString()
		for num, c := range s {
			arr[num][c-'A']++
		}
	}

	var points [5]int
	for i := 0; i < m; i++ {
		points[i] = readInt()
	}

	ret := 0

	for i := 0; i < m; i++ {
		ans := 'A'
		max := arr[i][0]
		for c := 'B'; c <= 'E'; c++ {
			if arr[i][c-'A'] > max {
				ans = c
				max = arr[i][c-'A']
			}
		}
		ret += points[ans-'A'] * max
	}

	println(strconv.Itoa(ret))

}

/* stubs */

func main() {

	var f *os.File
	if runtime.GOROOT() == "C:\\Soft\\Go" {
		f, _ = os.Open("input.txt")
	} else {
		f = os.Stdin
	}
	defer f.Close()

	writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	reader = bufio.NewScanner(f)
	reader.Split(bufio.ScanWords)

	solve()

}

var reader *bufio.Scanner
var writer *bufio.Writer

func readInt() int {
	reader.Scan()
	ret, _ := strconv.Atoi(reader.Text())
	return ret
}

func readString() string {
	reader.Scan()
	return reader.Text()
}

func print(s string) {
	writer.WriteString(s)
}

func println(s string) {
	print(s)
	print("\n")
}


package main

import (
	. "fmt"
	"sort"
)

// github.com/EndlessCheng/codeforces-go
func main() {
	var T, n, c int
	var ok bool
	for Scan(&T); T > 0; T-- {
		Scan(&n)
		p := make([]int, n)
		for i := range p {
			p[i] = i
		}
		sort.Slice(p, func(i, j int) (d bool) { Println(1, p[j], p[i]); Scan(&d); return })
		a := make([]int, n)
		for i := 0; i < n; {
			c++
			a[p[i]] = c
			i++
			for j := i - 1; j < i; j++ {
				for i < n {
					Print(2, p[j], n-i)
					for k := i; k < n; k++ {
						Print(" ", p[k])
					}
					Println()
					if Scan(&ok); !ok {
						break
					}
					a[p[i]] = c
					i++
				}
			}
		}
		Println(3)
		for _, v := range a {
			for _, w := range a {
				if v < w {
					Print("0")
				} else {
					Print("1")
				}
			}
			Println()
		}
		Scan(&n)
	}
}

package main
import (
	."fmt"
	"sort"
)

// github.com/EndlessCheng/codeforces-go
func main() {
	var T, n, c int
	var ok bool
	for Scan(&T); T > 0; T-- {
		Scan(&n)
		a := make([]int, n)
		for i := range a {
			a[i] = i
		}
		sort.Slice(a, func(i, j int) (d bool) { Println(1, a[j], a[i]); Scan(&d); return })
		g := make([]int, n)
		for i := 0; i < n; {
			c++
			g[a[i]] = c
			i++
			for j := i - 1; j < i; j++ {
				for i < n {
					Print(2, a[j], n-i)
					for _, v := range a[i:] {
						Print(" ", v)
					}
					Println()
					if Scan(&ok); !ok {
						break
					}
					g[a[i]] = c
					i++
				}
			}
		}
		Println(3)
		for _, v := range g {
			s := ""
			for _, w := range g {
				if v < w {
					s+="0"
				} else {
					s+="1"
				}
			}
			Println(s)
		}
		Scan(&n)
	}
}

package main
import (
	."fmt"
	"sort"
)

// github.com/EndlessCheng/codeforces-go
func main() {
	var T, n, c int
	var ok bool
	for Scan(&T); T > 0; T-- {
		Scan(&n)
		a := make([]int, n)
		for i := range a {
			a[i] = i
		}
		sort.Slice(a, func(i, j int) (d bool) { Println(1, a[j], a[i]); Scan(&d); return })
		g := make([]int, n)
		for i := 0; i < n; {
			c++
			v := a[i]
			g[v] = c
			for i++; i < n; i++ {
				Print(2, v, n-i)
				for _, w := range a[i:] {
					Print(" ", w)
				}
				Println()
				if Scan(&ok); !ok {
					break
				}
				g[a[i]] = c
			}
		}
		Println(3)
		for _, v := range a {
			for _, w := range a {
				if v < w {
					Print("0")
				} else {
					Print("1")
				}
			}
			Println()
		}
		Scan(&n)
	}
}


package main

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

func main() {
	defer out.Flush()
	n := in.NextInt()
	q := in.NextInt()
	pos1 := 0
	pos2 := 1
	for i := 0; i < q; i++ {
		t := in.NextInt()
		switch t {
		case 1:
			x := in.NextInt()
			pos1 += x
			pos2 += x
		case 2:
			pos1 ^= 1
			pos2 ^= 1
		}
		pos1 = mathmod(pos1, n)
		pos2 = mathmod(pos2, n)
	}
	ans := make([]int, n)
	for i := 0; i < n; i += 2 {
		ans[(pos1+i)%n] = 1 + i
	}
	for i := 0; i < n; i += 2 {
		ans[(pos2+i)%n] = 2 + i
	}
	for i := range ans {
		if i != 0 {
			fmt.Fprint(out, " ")
		}
		fmt.Fprint(out, ans[i])
	}
	fmt.Fprintln(out)
}

func mathmod(a, b int) int {
	if !(0 <= a && a < b) {
		return (a%b + b) % b
	}
	return a
}

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

type FastReader struct {
	r   *bufio.Reader
	buf string
}

func NewFastReader(r io.Reader) *FastReader {
	return &FastReader{
		r: bufio.NewReader(r),
	}
}

func (r *FastReader) advance() {
	for len(r.buf) != 0 && r.buf[0] == ' ' {
		r.buf = r.buf[1:]
	}
	var err error
	for len(r.buf) == 0 && err != io.EOF {
		buf := new(bytes.Buffer)
		for {
			var chunk []byte
			var more bool
			chunk, more, err = r.r.ReadLine()
			buf.Write(chunk)
			if !more {
				break
			}
		}
		r.buf = buf.String()
	}
}

func (r *FastReader) NextLine() string {
	r.advance()
	line := r.buf
	r.buf = ""
	return line
}

func (r *FastReader) NextWord() string {
	r.advance()
	var word string
	wordStart := 0
	for i := 0; i < len(r.buf); i++ {
		b := r.buf[i]
		if b == ' ' {
			if i != wordStart {
				word = r.buf[wordStart:i]
				r.buf = r.buf[i:]
				break
			}
			wordStart = i + 1
		}
	}
	if len(word) == 0 {
		word = r.buf
		r.buf = ""
	}
	return word
}

func (r *FastReader) NextInt() int {
	return parseInt(r.NextWord())
}

func parseInt(word string) int {
	sign := 1
	if word[0] == '-' {
		sign = -1
		word = word[1:]
	}
	result := 0
	for i := 0; i < len(word); i++ {
		result = result*10 + int(word[i]) - '0'
	}
	result *= sign
	return result
}

package main

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

var in = bufio.NewScanner(os.Stdin)

func readInt() int64 {
	if !in.Scan() {
		panic(in.Err())
	}
	res := int64(0)
	mul := int64(1)
	for _, b := range in.Bytes() {
		if b == '-' {
			mul *= -1
			continue
		}
		res = res*10 + int64(b-'0')
	}
	return mul * res
}

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

	n := readInt()

	shift := int64(0)
	oddForw := int64(0)
	for q := readInt(); q > 0; q-- {
		switch readInt() {
		case 1:
			shift += readInt()
			if shift < 0 {
				shift += n
			} else if shift >= n {
				shift -= n
			}
		case 2:
			if (shift+oddForw)%2 == 0 {
				oddForw++
				if oddForw == n {
					oddForw = 0
				}
			} else {
				oddForw--
				if oddForw < 0 {
					oddForw += n
				}
			}
		default:
			panic("switch")
		}
	}
	ans := make([]int64, n)
	for i := int64(1); i < n; i += 2 {
		ans[(i-1+shift+oddForw)%n] = i
	}
	evenForw := (n - oddForw) % n
	for i := int64(2); i <= n; i += 2 {
		ans[(i-1+shift+evenForw)%n] = i
	}
	for i, v := range ans {
		if i+1 == int(n) {
			fmt.Fprintln(out, v)
		} else {
			fmt.Fprint(out, v, " ")
		}
	}
}

package main

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

var in = bufio.NewScanner(os.Stdin)

func readInt() int64 {
	if !in.Scan() {
		panic(in.Err())
	}
	res := int64(0)
	mul := int64(1)
	for _, b := range in.Bytes() {
		if b == '-' {
			mul *= -1
			continue
		}
		res = res*10 + int64(b-'0')
	}
	return mul * res
}

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

	n := readInt()

	shift := int64(0)
	oddForw := int64(0)
	for q := readInt(); q > 0; q-- {
		switch readInt() {
		case 1:
			shift += readInt()
			if shift < 0 {
				shift += n
			} else if shift >= n {
				shift -= n
			}
		case 2:
			if shift%2 == 0 {
				oddForw++
				if oddForw == n {
					oddForw = 0
				}
			} else {
				oddForw--
				if oddForw < 0 {
					oddForw += n
				}
			}
		default:
			panic("switch")
		}
	}
	ans := make([]int64, n)
	for i := int64(1); i < n; i += 2 {
		ans[(i-1+shift+oddForw)%n] = i
	}
	evenForw := (n - oddForw) % n
	for i := int64(2); i <= n; i += 2 {
		ans[(i-1+shift+evenForw)%n] = i
	}
	for i, v := range ans {
		if i+1 == int(n) {
			fmt.Fprintln(out, v)
		} else {
			fmt.Fprint(out, v, " ")
		}
	}
}

package main

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

func main() {
	defer out.Flush()
	n := in.NextInt()
	q := in.NextInt()
	flip := 0
	shift := 0
	for i := 0; i < q; i++ {
		t := in.NextInt()
		switch t {
		case 1:
			x := in.NextInt()
			shift += x
			if !(0 <= shift && shift < n) {
				shift = (shift%n + n) % n
			}
		case 2:
			flip = 1 - flip
		}
	}
	ans := make([]int, n)
	for i := 0; i < n; i++ {
		ans[(i+shift)%n] = (i ^ flip) + 1
	}
	for i := range ans {
		if i != 0 {
			fmt.Fprint(out, " ")
		}
		fmt.Fprint(out, ans[i])
	}
	fmt.Fprintln(out)
}

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

type FastReader struct {
	r   *bufio.Reader
	buf string
}

func NewFastReader(r io.Reader) *FastReader {
	return &FastReader{
		r: bufio.NewReader(r),
	}
}

func (r *FastReader) advance() {
	for len(r.buf) != 0 && r.buf[0] == ' ' {
		r.buf = r.buf[1:]
	}
	var err error
	for len(r.buf) == 0 && err != io.EOF {
		buf := new(bytes.Buffer)
		for {
			var chunk []byte
			var more bool
			chunk, more, err = r.r.ReadLine()
			buf.Write(chunk)
			if !more {
				break
			}
		}
		r.buf = buf.String()
	}
}

func (r *FastReader) NextLine() string {
	r.advance()
	line := r.buf
	r.buf = ""
	return line
}

func (r *FastReader) NextWord() string {
	r.advance()
	var word string
	wordStart := 0
	for i := 0; i < len(r.buf); i++ {
		b := r.buf[i]
		if b == ' ' {
			if i != wordStart {
				word = r.buf[wordStart:i]
				r.buf = r.buf[i:]
				break
			}
			wordStart = i + 1
		}
	}
	if len(word) == 0 {
		word = r.buf
		r.buf = ""
	}
	return word
}

func (r *FastReader) NextInt() int {
	return parseInt(r.NextWord())
}

func parseInt(word string) int {
	sign := 1
	if word[0] == '-' {
		sign = -1
		word = word[1:]
	}
	result := 0
	for i := 0; i < len(word); i++ {
		result = result*10 + int(word[i]) - '0'
	}
	result *= sign
	return result
}


package main

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

// github.com/EndlessCheng/codeforces-go
func main() {
	in := bufio.NewReader(os.Stdin)
	p := [1e6+1]int{}
	for i := 1; i <= 1e6; i++ {
		p[i] = -1
	}
	var n, m, k, i, cntD, loop int64
	Fscan(in, &n, &m, &k)
	a := make([]int, n)
	diff := make([]int64, n)
	for i := range a {
		Fscan(in, &a[i])
		p[a[i]] = i
		diff[i] = m
	}
	b := make([]int, m)
	for i := range b {
		Fscan(in, &b[i])
		if p[b[i]] >= 0 {
			diff[(int64(p[b[i]]-i)%n+n)%n]--
		}
	}
	for {
		cntD += diff[i]
		loop++
		i = (i + m) % n
		if i == 0 {
			break
		}
	}
	ans := (k - 1) / cntD * loop * m
	k -= (k - 1) / cntD * cntD
	for ; k > diff[i]; i = (i + m) % n {
		k -= diff[i]
		ans += m
	}
	for j := 0; k > 0; j++ {
		if a[i] != b[j] {
			k--
		}
		ans++
		i = (i + 1) % n
	}
	Print(ans)
}

package main

import (
	. "fmt"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func main() {
	_i, buf := 1<<12, make([]byte, 1<<12)
	rc := func() byte {
		if _i == 1<<12 {
			os.Stdin.Read(buf)
			_i = 0
		}
		b := buf[_i]
		_i++
		return b
	}
	r := func() (x int) {
		b := rc()
		for ; '0' > b; b = rc() {
		}
		for ; '0' <= b; b = rc() {
			x = x*10 + int(b&15)
		}
		return
	}
	r64 := func() (x int64) {
		b := rc()
		for ; '0' > b; b = rc() {
		}
		for ; '0' <= b; b = rc() {
			x = x*10 + int64(b&15)
		}
		return
	}
	n, m, k := r(), r(), r64()
	p := make([]int, 2*max(n, m)+1)
	for i := range p {
		p[i] = -1
	}
	a := make([]int, n)
	diff := make([]int, n)
	for i := range a {
		a[i] = r()
		p[a[i]] = i
		diff[i] = m
	}
	b := make([]int, m)
	for i := range b {
		b[i] = r()
		if p[b[i]] >= 0 {
			diff[((p[b[i]]-i)%n+n)%n]--
		}
	}
	i, cntD, loop := 0, int64(0), 0
	for {
		cntD += int64(diff[i])
		loop++
		i = (i + m) % n
		if i == 0 {
			break
		}
	}
	ans := (k - 1) / cntD * int64(loop) * int64(m)
	k -= (k - 1) / cntD * cntD
	for ; k > int64(diff[i]); i = (i + m) % n {
		k -= int64(diff[i])
		ans += int64(m)
	}
	for j := 0; k > 0; j++ {
		if a[i] != b[j] {
			k--
		}
		ans++
		i = (i + 1) % n
	}
	Print(ans)
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	line, _ := reader.ReadBytes('\n')

	var n, m int
	pos := readInt(line, 0, &n) + 1
	pos = readInt(line, pos, &m) + 1
	var k uint64
	readUint64(line, pos, &k)

	A := readNNums(reader, n)
	B := readNNums(reader, m)
	res := solve(A, B, int64(k))

	fmt.Println(res)
}

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func extGcd(a, b int, x *int64, y *int64) int {
	if b == 0 {
		*x = 1
		*y = 0
		return a
	}
	var x1, y1 int64
	g := extGcd(b, a%b, &x1, &y1)
	*x = y1
	*y = x1 - int64(a/b)*y1

	return g
}

const MAX = 1000010

func solve(A, B []int, K int64) int64 {
	n := len(A)
	m := len(B)

	pa := make([]int, MAX)

	for i := 0; i < MAX; i++ {
		pa[i] = -1
	}

	for i, a := range A {
		pa[a] = i
	}
	var x, y int64

	g := extGcd(n, m, &x, &y)

	M := int64(m / g)

	all := make([]int64, 0, m)

	for i := 0; i < m; i++ {
		if pa[B[i]] < 0 || (i-pa[B[i]])%g != 0 {
			continue
		}
		kk := int64(i-pa[B[i]]) / int64(g)
		xx := x * kk
		xx = (xx%M + M) % M
		xx = xx*int64(n) + int64(pa[B[i]]) + 1
		all = append(all, xx)
	}

	sort.Slice(all, func(i, j int) bool {
		return all[i] < all[j]
	})

	L := int64(n) * M
	aa := L - int64(len(all))
	day := K / aa * L
	K %= aa
	if K == 0 {
		day -= L
		K = aa
	}

	check := func(x int64) bool {
		i := sort.Search(len(all), func(i int) bool {
			return all[i] > x
		})
		return x-int64(i) >= K
	}

	var l, r int64 = 0, L

	for l < r {
		mid := (l + r) / 2

		if check(mid) {
			r = mid
		} else {
			l = mid + 1
		}
	}

	return r + day
}

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1500B(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	max := func(a, b int) int {
		if a > b {
			return a
		}
		return b
	}

	var n, m, loop int
	var k, cntDiff int64
	Fscan(in, &n, &m, &k)
	a := make([]int, n)
	pos := make([]int, max(n, m)*2+1)
	for i := range pos {
		pos[i] = -1
	}
	diff := make([]int, n)
	for i := range a {
		Fscan(in, &a[i])
		pos[a[i]] = i
		diff[i] = m
	}
	b := make([]int, m)
	for i := range b {
		Fscan(in, &b[i])
		if pos[b[i]] >= 0 {
			diff[((pos[b[i]]-i)%n+n)%n]--
		}
	}

	i := 0
	for {
		cntDiff += int64(diff[i])
		loop++
		i = (i + m) % n
		if i == 0 {
			break
		}
	}
	ans := (k - 1) / cntDiff * int64(loop) * int64(m)
	k -= (k - 1) / cntDiff * cntDiff
	for ; k > int64(diff[i]); i = (i + m) % n {
		k -= int64(diff[i])
		ans += int64(m)
	}
	for j := 0; k > 0; j++ {
		if a[i] != b[j] {
			k--
		}
		ans++
		i = (i + 1) % n
	}
	Fprint(out, ans)
}
func main() { CF1500B(os.Stdin, os.Stdout) }

package main

import (
	. "fmt"
	"syscall"
)

// github.com/EndlessCheng/codeforces-go
func main() {
	_i, buf := 1<<12, make([]byte, 1<<12)
	rc := func() byte {
		if _i == 1<<12 {
			syscall.Read(syscall.Stdin, buf)
			_i = 0
		}
		b := buf[_i]
		_i++
		return b
	}
	r := func() (x int) {
		b := rc()
		for ; '0' > b; b = rc() {
		}
		for ; '0' <= b; b = rc() {
			x = x*10 + int(b&15)
		}
		return
	}
	r64 := func() (x int64) {
		b := rc()
		for ; '0' > b; b = rc() {
		}
		for ; '0' <= b; b = rc() {
			x = x*10 + int64(b&15)
		}
		return
	}
	n, m, k := r(), r(), r64()
	p := make([]int, 2*max(n, m)+1)
	for i := range p {
		p[i] = -1
	}
	a := make([]int, n)
	diff := make([]int, n)
	for i := range a {
		a[i] = r()
		p[a[i]] = i
		diff[i] = m
	}
	b := make([]int, m)
	for i := range b {
		b[i] = r()
		if p[b[i]] >= 0 {
			diff[((p[b[i]]-i)%n+n)%n]--
		}
	}
	i, cntD, loop := 0, int64(0), 0
	for {
		cntD += int64(diff[i])
		loop++
		i = (i + m) % n
		if i == 0 {
			break
		}
	}
	ans := (k - 1) / cntD * int64(loop) * int64(m)
	k -= (k - 1) / cntD * cntD
	for ; k > int64(diff[i]); i = (i + m) % n {
		k -= int64(diff[i])
		ans += int64(m)
	}
	for j := 0; k > 0; j++ {
		if a[i] != b[j] {
			k--
		}
		ans++
		i = (i + 1) % n
	}
	Print(ans)
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1500B(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	max := func(a, b int) int {
		if a > b {
			return a
		}
		return b
	}

	var n, m, loop int
	var k, cntDiff int64
	Fscan(in, &n, &m, &k)
	a := make([]int, n)
	pos := make([]int, max(n, m)*2+1)
	for i := range pos {
		pos[i] = -1
	}
	diff := make([]int, n)
	for i := range a {
		Fscan(in, &a[i])
		pos[a[i]] = i
		diff[i] = m
	}
	b := make([]int, m)
	for i := range b {
		Fscan(in, &b[i])
		if pos[b[i]] >= 0 {
			diff[((pos[b[i]]-i)%n+n)%n]--
		}
	}

	i := 0
	for {
		cntDiff += int64(diff[i])
		loop++
		i = (i + m) % n
		if i == 0 {
			break
		}
	}
	ans := k / cntDiff * int64(loop) * int64(m)
	k -= k / cntDiff * cntDiff
	for ; k > int64(diff[i]); i = (i + m) % n {
		k -= int64(diff[i])
		ans += int64(m)
	}
	for j := 0; k > 0; j++ {
		if a[i] != b[j] {
			k--
		}
		ans++
		i = (i + 1) % n
	}
	Fprint(out, ans)
}

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

package main

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

// github.com/EndlessCheng/codeforces-go
func main() {
	in := bufio.NewReader(os.Stdin)
	p := [1e6]int{}
	for i := 0; i < 1e6; i++ {
		p[i] = -1
	}
	var n, m, k, i, cntD, loop int
	Fscan(in, &n, &m, &k)
	a := make([]int, n)
	diff := make([]int, n)
	for i := range a {
		Fscan(in, &a[i])
		p[a[i]] = i
		diff[i] = m
	}
	b := make([]int, m)
	for i := range b {
		Fscan(in, &b[i])
		if p[b[i]] >= 0 {
			diff[((p[b[i]]-i)%n+n)%n]--
		}
	}
	for {
		cntD += diff[i]
		loop++
		i = (i + m) % n
		if i == 0 {
			break
		}
	}
	ans := (k - 1) / cntD * loop * m
	k -= (k - 1) / cntD * cntD
	for ; k > diff[i]; i = (i + m) % n {
		k -= diff[i]
		ans += m
	}
	for j := 0; k > 0; j++ {
		if a[i] != b[j] {
			k--
		}
		ans++
		i = (i + 1) % n
	}
	Print(ans)
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	line, _ := reader.ReadBytes('\n')

	var n, m int
	pos := readInt(line, 0, &n) + 1
	pos = readInt(line, pos, &m) + 1
	var k uint64
	readUint64(line, pos, &k)

	A := readNNums(reader, n)
	B := readNNums(reader, m)
	res := solve(A, B, int64(k))

	fmt.Println(res)
}

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func extGcd(a, b int, x *int64, y *int64) int {
	if b == 0 {
		*x = 1
		*y = 0
		return a
	}
	var x1, y1 int64
	g := extGcd(b, a%b, &x1, &y1)
	*x = y1 - int64(a/b)*x1
	*y = x1

	return g
}

const MAX = 1000010

func solve(A, B []int, K int64) int64 {
	n := len(A)
	m := len(B)

	pa := make([]int, MAX)
	pb := make([]int, MAX)

	for i := 0; i < MAX; i++ {
		pa[i] = -1
		pb[i] = -1
	}

	for i, a := range A {
		pa[a] = i
	}

	for i, b := range B {
		pb[b] = i
	}

	var y int64
	g := extGcd(n, m, new(int64), &y)
	L := int64(n) * int64(m) / int64(g)
	var l int64 = 1
	var r int64 = 1e18
	var ans int64
	for l <= r {
		mid := (l + r) / 2
		var same int64
		quo := mid / L
		rem := mid % L
		for cur := 1; cur < MAX && same < mid; cur++ {
			if pa[cur] >= 0 && pb[cur] >= 0 && (pb[cur]-pa[cur])%g == 0 {
				same += quo
				tmp := y*int64(n)*int64((pb[cur]-pa[cur])/g) + int64(pa[cur])
				tmp %= L
				if tmp < 0 {
					tmp += L
				}
				if tmp < rem {
					same++
				}
			}
		}

		if mid-same >= K {
			r = mid - 1
			ans = mid
		} else {
			l = mid + 1
		}
	}
	return ans
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	line, _ := reader.ReadBytes('\n')

	var n, m int
	pos := readInt(line, 0, &n) + 1
	pos = readInt(line, pos, &m) + 1
	var k uint64
	readUint64(line, pos, &k)

	A := readNNums(reader, n)
	B := readNNums(reader, m)
	res := solve(A, B, int64(k))

	fmt.Println(res)
}

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func extGcd(a, b int, x *int64, y *int64) int {
	if b == 0 {
		*x = 1
		*y = 0
		return a
	}
	var x1, y1 int64
	g := extGcd(b, a%b, &x1, &y1)
	*x = y1 - int64(a/b)*x1
	*y = x1

	return g
}

const MAX = 1000010

func solve(A, B []int, K int64) int64 {
	n := len(A)
	m := len(B)

	pa := make([]int, MAX)
	pb := make([]int, MAX)

	for i := 0; i < MAX; i++ {
		pa[i] = -1
		pb[i] = -1
	}

	for i, a := range A {
		pa[a] = i
	}

	for i, b := range B {
		pb[b] = i
	}

	var y int64
	g := extGcd(n, m, new(int64), &y)
	L := int64(n) * int64(m) / int64(g)
	var l int64 = 1
	var r int64 = 1e18

	for l < r {
		mid := (l + r) / 2
		var same int64
		quo := mid / L
		rem := mid % L
		for cur := 1; cur < MAX && same < mid; cur++ {
			if pa[cur] >= 0 && pb[cur] >= 0 && (pb[cur]-pa[cur])%g == 0 {
				same += quo
				tmp := y*int64(n)*int64((pb[cur]-pa[cur])/g) + int64(pa[cur])
				tmp %= L
				if tmp < 0 {
					tmp += L
				}
				if tmp < rem {
					same++
				}
			}
		}

		if mid-same >= K {
			r = mid
		} else {
			l = mid + 1
		}
	}
	return r
}