package main

import (
	"bufio"
	"fmt"
	"os"
	"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)
		split := strings.Split(raw, " ")
		n1, _ := strconv.Atoi(split[0])
		n2, _ := strconv.Atoi(split[1])
		n3, _ := strconv.Atoi(split[2])
		if n1 == n2+n3 || n2 == n1+n3 || n3 == n1+n2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

func main() {

	t := 0
	fmt.Scanln(&t)
	var str strings.Builder
	for ; t > 0; t-- {
		a, b, c := 0, 0, 0
		fmt.Scanln(&a, &b, &c)
		if a+b == c || a+c == b || b+c == a {
			str.WriteString("YES\n")
		} else {
			str.WriteString("NO\n")
		}
	}
	fmt.Print(str.String())

	//solve()
}

func solve() {
	sc := bufio.NewReader(os.Stdin)
	line, _ := sc.ReadString('\n')

	t, _ := strconv.Atoi(strings.TrimSpace(line))
	var str strings.Builder
	for ; t > 0; t-- {
		line, _ = sc.ReadString('\n')
		aux := strings.Split(line, " ")
		a, _ := strconv.Atoi(strings.TrimSpace(aux[0]))
		b, _ := strconv.Atoi(strings.TrimSpace(aux[1]))
		c, _ := strconv.Atoi(strings.TrimSpace(aux[2]))
		if a+b == c || a+c == b || b+c == a {
			str.WriteString("YES\n")
		} else {
			str.WriteString("NO\n")
		}

	}
	fmt.Print(str.String())
}

package main

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

func main() {
	/*
		t := 0
		fmt.Scanf("%d\n", &t)
		var str strings.Builder
		for ; t > 0; t-- {
			a, b, c := 0, 0, 0
			fmt.Scanf("%d %d %d\n", &a, &b, &c)
			if a+b == c || a+c == b || b+c == a {
				str.WriteString("YES\n")
			} else {
				str.WriteString("NO\n")
			}
		}
		fmt.Print(str.String())

	*/
	solve()
}

func solve() {
	sc := bufio.NewReader(os.Stdin)
	line, _ := sc.ReadString('\n')

	t, _ := strconv.Atoi(strings.TrimSpace(line))
	var str strings.Builder
	for ; t > 0; t-- {
		line, _ = sc.ReadString('\n')
		aux := strings.Split(line, " ")
		a, _ := strconv.Atoi(strings.TrimSpace(aux[0]))
		b, _ := strconv.Atoi(strings.TrimSpace(aux[1]))
		c, _ := strconv.Atoi(strings.TrimSpace(aux[2]))
		if a+b == c || a+c == b || b+c == a {
			str.WriteString("YES\n")
		} else {
			str.WriteString("NO\n")
		}

	}
	fmt.Print(str.String())
}

package main

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

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

func (in *CF1742AA) 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 *CF1742AA) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

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

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

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

/**
Run solve the problem CF1742AA
Date: 10/15/2022
User: wotan
URL: https://codeforces.com/problemset/problem/1742/A
Problem: CF1742AA
**/
func (in *CF1742AA) Run() {
	var str strings.Builder
	for t := in.NextInt(); t > 0; t-- {
		a, b, c := in.NextInt(), in.NextInt(), in.NextInt()
		if a+b == c || a+c == b || b+c == a {
			str.WriteString("YES\n")
		} else {
			str.WriteString("NO\n")
		}
	}
	fmt.Print(str.String())
}

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

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

package main

import (
	"fmt"
	"strings"
)

func main() {
	t := 0
	fmt.Scanf("%d\n", &t)
	var str strings.Builder
	for ; t > 0; t-- {
		a, b, c := 0, 0, 0
		fmt.Scanf("%d %d %d\n", &a, &b, &c)
		if a+b == c || a+c == b || b+c == a {
			str.WriteString("YES\n")
		} else {
			str.WriteString("NO\n")
		}
	}
	fmt.Print(str.String())
}

package main

import "fmt"

func main() {
	t := 0
	fmt.Scanf("%d\n", &t)
	for ; t > 0; t-- {
		a, b, c := 0, 0, 0
		fmt.Scanf("%d %d %d\n", &a, &b, &c)
		if a+b == c || a+c == b || b+c == a {
			fmt.Println("YES")
		} else {
			fmt.Println("NO ")
		}
	}

}

package main

import "fmt"

func main() {
	var t int
	var a, b, c int

	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		fmt.Scan(&a, &b, &c)

		if (a == b+c) || (b == a+c) || (c == a+b) {
			// fmt.Printf("%d %d %d\n", a, b, c)
			fmt.Println("YES")
		} else {
			// fmt.Printf("%d %d %d\n", a, b, c)
			fmt.Println("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) > 2 {
			fmt.Println(sum(intArr))
		}
	}
}

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

	if arg[0]+arg[1] == arg[2] {
		return "YES"
	}

	return "NO"
}

package main

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

func main() {
	// var (
	// 	a, b, c int
	// 	arg     []int
	// )

	// fmt.Scanf("%d", &a)
	// fmt.Scanf("%d", &b)
	// fmt.Scanf("%d", &c)

	// arg = append(arg, a, b, c)

	// fmt.Println(sum(arg))

	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("\n", intArr)
		fmt.Println(sum(intArr))
	}
}

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

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

	return "NO"
}

package main
import(
    "fmt"
    "os"
    "bufio"
)
func main() {
	var t int
	var in = bufio.NewReader(os.Stdin)
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var a,b,c int
		fmt.Fscan(in,&a,&b,&c)
		if a + b == c || a + c == b || b + c == a {
			fmt.Println("YES")
		}else {
			fmt.Println("NO")
		}
	}
}

package main

import "fmt"

func isSum(a, b, c int) bool {
	if a == b+c || b == a+c || c == a+b {
		return true
	}
	return false
}
func main() {
	var test, a, b, c int

	fmt.Scanln(&test)
	for test > 0 {
		fmt.Scanln(&a, &b, &c)
		if isSum(a,b,c) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}

		test--
	}
	return
}

package main

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

func sum(a int, b int, c int) string {
	if a+b == c || a+c == b || b+c == a {
		return "YES"
	}
	return "NO"
}

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

	for i := 0; i < tc; i++ {
		nums := readArrInt(in)
		fmt.Println(sum(nums[0], nums[1], nums[2]))
	}
}

func readInt(in *bufio.Reader) int {
	nStr, _ := in.ReadString('\n')
	nStr = strings.ReplaceAll(nStr, "\r", "")
	nStr = strings.ReplaceAll(nStr, "\n", "")
	n, _ := strconv.Atoi(nStr)
	return n
}

func readLineNumbs(in *bufio.Reader) []string {
	line, _ := in.ReadString('\n')
	line = strings.ReplaceAll(line, "\r", "")
	line = strings.ReplaceAll(line, "\n", "")
	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 "fmt"
func main(){
	var tt int

	fmt.Scan(&tt)
	for tt>0 {
		var a,b,c int

		fmt.Scan(&a)
		fmt.Scan(&b)
		fmt.Scan(&c)
		if a==b+c || b==c+a || c==a+b{
			fmt.Println("YES")
		} else{
			fmt.Println("NO")
		}
		tt--;
	}

}

package main

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

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

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

	var T int
	var a int
	var b int
	var c int

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

		if a == b+c || b == a+c || c == b+a {
			Fprintln(out, "YES")
			continue
		}

		Fprintln(out, "NO")
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"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--
		a := make([]int, 3)
		a[0], a[1], a[2] = nextInt(), nextInt(), nextInt()
		sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })
		// fmt.Printf("%v", a)
		if a[0]+a[1] == a[2] {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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"
	"os"
	"strconv"
	"strings"
)

func main() {
	var (
		t  int
		a  int
		b  int
		c  int
		sl []string
	)
	fmt.Scanf("%d\n", &t)
	scanner := bufio.NewScanner(os.Stdin)
	for i := 0; i < t; i++ {
		scanner.Scan()
		sl = strings.Split(scanner.Text(), " ")
		a, _ = strconv.Atoi(sl[0])
		b, _ = strconv.Atoi(sl[1])
		c, _ = strconv.Atoi(sl[2])
		if a == b+c {
			fmt.Println("YES")
		} else if b == a+c {
			fmt.Println("YES")
		} else if c == a+b {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		t--
		x := make([]int, 3)
		fmt.Fscan(in, &x[0], &x[1], &x[2])
		sort.Ints(x)
		if (x[0] + x[1]) == x[2] {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}

package main

import "fmt"

func main() {
	var x, y, z, a int
	fmt.Scan(&a)
	for i := 0; i < a; i++ {
		fmt.Scan(&x, &y, &z)
		if x+y == z || x+z == y || y+z == x {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}

	}
}

package main

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

func main() {
	var in = bufio.NewReader(os.Stdin)
	var tt int

	fmt.Fscan(in,&tt)

	for i:=0; i<tt; i++{
		var a, b, c int
		fmt.Fscan(in, &a, &b, &c)

		if a + b == c || a + c == b || b + c == a {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
	"sort"
)

var (
	t int
	a []int
)

func solve() bool {

	sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })
	if a[0]+a[1] == a[2] {
		return true
	}
	return false
}

func main() {
	fmt.Scanf("%d", &t)
	a = make([]int, 3)
	for ; t != 0; t-- {
		fmt.Scan(&a[0], &a[1], &a[2])
		flag := solve()
		if flag {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}

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(){
	T := readInt()
	defer writer.Flush()
	for i := 1; i <= T; i++{
		a, b, c := readInt(), readInt(), readInt()
		tot := a + b + c
		res := "NO"
		if (tot == 2 * a) || (tot == 2 * b) || (tot == 2 * c) {
			res = "YES"
		}
		fmt.Fprintln(writer, res)
	}
}

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 = 3
		var arr = make([]int, n)

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

		sort.Ints(arr)
		if arr[0]+arr[1] == arr[2] {
			fmt.Fprintln(w, "YES")
		} else {
			fmt.Fprintln(w, "NO")
		}

	}

}

package main

import "fmt"

func main() {
	var t int
	var a, b, c int
	fmt.Scanf("%d\n", &t)

	for ; t > 0; t-- {
		fmt.Scanf("%d %d %d\n", &a, &b, &c)
		if (a+b) == c || (a+c) == b || (b+c) == a {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")

		}

	}

}

package main

import (
	"fmt"
)

func main() {
	var T int
	fmt.Scan(&T)
	for Case := 1; Case <= T; Case++ {
		var a, b, c int
		fmt.Scan(&a, &b, &c)
		if a == b + c || b == a + c || c == a + b {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

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

func solve() {
	var a, b, c int
	var ab, bc, ac int
	scanws(&a, &b, &c)
	ab, bc, ac = (a+b),(b+c),(a+c)
	switch {
	case ab==c || bc==a || ac==b:
		printf("YES\n")
	default:
		printf("NO\n")
	}
}

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 (
	"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 a, b, c int
    fmt.Fscan(in, &a, &b, &c)
    switch {
      case a+b == c:
        fmt.Println("YES")
        break;
      case c+b == a:
        fmt.Println("YES")
        break;
      case a+c == b:
        fmt.Println("YES")
        break;
      default:
        fmt.Println("NO")
        break;
    }
	}
}

package main

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

var (
	reader     = bufio.NewReader(os.Stdin)
	t, a, b, c int
)

func solve(a, b, c int) string {
	if a == b+c || b == a+c || c == a+b {
		return "YES"
	}
	return "NO"
}

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		fmt.Fscan(reader, &a, &b, &c)
		fmt.Println(solve(a, b, c))
	}
}

package main

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

const cf = true

func solve() {
	var a, b, c int
	fmt.Fscan(in, &a, &b, &c)
	if a == b+c || b == a+c || c == a+b {
		fmt.Fprintln(out, "YES")
	} else {
		fmt.Fprintln(out, "NO")
	}
}

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 (
	"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)
	for i := 0; i < count ; i++ {
		scanner.Scan()
		line := scanner.Text()
		numString := strings.Split(line, " ")
		nums := make([]int, 0, 3)
		for _, num := range numString {
			digit, _ := strconv.Atoi(num)
			nums = append(nums, digit)
		}

		maxIndex := 0
		maxVal := -1
		for i, n := range nums {
			if n > maxVal {
				maxIndex = i
				maxVal = n
			}
		}
		if maxIndex == 0 {
			if nums[1] + nums[2] == nums[0] {
				answers = append(answers, "YES")
			} else {
				answers = append(answers, "NO")
			}
		} else if maxIndex == 1 {
			if nums[0] + nums[2] == nums[1] {
				answers = append(answers, "YES")
			} else {
				answers = append(answers, "NO")
			}
		} else {
			if nums[0] + nums[1] == nums[2] {
				answers = append(answers, "YES")
			} else {
				answers = append(answers, "NO")
			}
		}
	}
	for _, s := range answers {
		fmt.Println(s)
	}
}

package main

import (
	"fmt"
)

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

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

}

func first(arr []int) string {
	if (arr[0]+arr[1] == arr[2]) || (arr[0]+arr[2] == arr[1]) || arr[1]+arr[2] == arr[0] {
		return "yes"
	} else {
		return "no"
	}
}

package main

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

func main() {
	var tc int

	r_ := bufio.NewReader(os.Stdin)
	w_ := bufio.NewWriter(os.Stdout)

	defer w_.Flush()

	fmt.Fscan(r_, &tc)

	for t := 0; t < tc; t++ {
		var a, b, c int

		fmt.Fscan(r_, &a, &b, &c)

		ans := "NO"

		if a == b+c {
			ans = "YES"
		}
		if b == a+c {
			ans = "YES"
		}
		if c == b+a {
			ans = "YES"
		}

		fmt.Fprintln(w_, ans)
	}
}

package main

import (
	"fmt"
)

func main() {
	var count int
	var a, b, c int
	fmt.Scan(&count)
	for i := 0; i < count; i++ {
		fmt.Scan(&a, &b, &c)
		if a+b == c || b+c == a || c+a == b {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}

}

package main

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

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

func check(a, b, c int) bool {
	return a+b == c || b+c == a || c+a == b
}

func main() {
	writer.Flush()

	var test int
	var a, b, c int
	fmt.Fscanf(reader, "%d\n", &test)
	for test > 0 {
		fmt.Fscanf(reader, "%d %d %d\n", &a, &b, &c)
		if check(a, b, c) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
		test--
	}
}

package main

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

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 a, b, c int

		fmt.Fscan(reader, &a, &b, &c)

		o := solve(a, b, c)

		fmt.Fprintln(writer, o)
	}
}

func solve(a, b, c int) string {
	ans := "NO"

	if a == b+c {
		ans = "YES"
	}
	if b == a+c {
		ans = "YES"
	}
	if c == b+a {
		ans = "YES"
	}
	return ans
}

package main

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

func check(a, b, c int) int {
	if a+b == c || a+c == b || b+c == a {
		return 1
	}
	return 0
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var a, b, c, data int

	fmt.Fscan(in, &data)
	for i := 0; i < data; i++ {
		fmt.Fscan(in, &a, &b, &c)
		rez := check(a, b, c)
		if rez == 1 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}

}

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-- {

		a := make([]int, 3)
		fmt.Fscan(r, &a[0], &a[1], &a[2])
		sum := a[0] + a[1] + a[2]
		res := "NO"

		for _, v := range a {
			if 2*v == sum {
				res = "YES"
				break
			}
		}

		fmt.Fprintln(w, res)
	}

}

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)

	n := io.ReadInt()
	for i := 0; i < n; i++ {
		a := io.ReadIntSlice(3)
		sort.Ints(a)
		if a[0]+a[1] == a[2] {
			io.Println("YES")
		} else {
			io.Println("NO")
		}
	}
}

package main

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

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

	var T, a, b, c int
	for fmt.Fscan(in, &T); T > 0; T-- {
		fmt.Fscan(in, &a, &b, &c)
		if a+b == c || a+c == b || b+c == a {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

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

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

		if a+b == c || a+c == b || b+c == a {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

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

func solve() {
	a, b, c := _readInt(), _readInt(), _readInt()
	if a+b == c || a+c == b || b+c == a {
		_print("YES")
	} else {
		_print("NO")
	}

}

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"
	"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 a,b,c int
		Fscan(in, &a, &b, &c)
		return a+c==b || a+b==c || b+c==a

	}

	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 (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	/*
		t := 0
		fmt.Scanf("%d\n", &t)
		var str strings.Builder
		for ; t > 0; t-- {
			a, b, c := 0, 0, 0
			fmt.Scanf("%d %d %d\n", &a, &b, &c)
			if a+b == c || a+c == b || b+c == a {
				str.WriteString("YES\n")
			} else {
				str.WriteString("NO\n")
			}
		}
		fmt.Print(str.String())

	*/
	solve()
}

func solve() {
	sc := bufio.NewReader(os.Stdin)
	line, _ := sc.ReadString('\n')
	t, _ := strconv.Atoi(line)
	var str strings.Builder
	for ; t > 0; t-- {
		line, _ = sc.ReadString('\n')
		aux := strings.Split(line, " ")
		a, _ := strconv.Atoi(aux[0])
		b, _ := strconv.Atoi(aux[1])
		c, _ := strconv.Atoi(aux[2])
		if a+b == c || a+c == b || b+c == a {
			str.WriteString("YES\n")
		} else {
			str.WriteString("NO\n")
		}

	}
	fmt.Print(str.String())
}

package main

import "fmt"

func main() {
	t := 0
	fmt.Scanf("%d", &t)

	for ; t > 0; t-- {
		a, b, c := 0, 0, 0
		fmt.Scanf("%d %d %d", &a, &b, &c)
		if a+b == c || b+c == a || a+c == b {
			fmt.Println("YES")
		} else {
			fmt.Println("NO ")
		}
	}

}

package main

import "fmt"

func main() {
	var t int
	var a, b, c int

	fmt.Scanf("%d", &t)
	for i := 0; i < t; i++ {
		fmt.Scanf("%d %d %d", &a, &b, &c)

		if (a == b+c) || (b == a+c) || (c == a+b) {
			fmt.Printf("%d %d %d\n", a, b, c)
			// fmt.Println("YES")
		} else {
			fmt.Printf("%d %d %d\n", a, b, c)
			// fmt.Println("NO")
		}
	}
}

package main

import "fmt"

func main() {
	var t int
	var a, b, c int

	fmt.Scanf("%d", &t)
	for i := 0; i < t; i++ {
		fmt.Scanf("%d %d %d", &a, &b, &c)

		if (a == b+c) || (b == a+c) || (c == a+b) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import "fmt"

func main() {
	var t int
	var a, b, c int

	fmt.Scan(t)

	for i := 0; i < t; i++ {
		fmt.Scan(a)
		fmt.Scan(b)
		fmt.Scan(c)

		if (a == b+c) || (b == a+c) || (c == a+b) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

func main() {
	// var (
	// 	a, b, c int
	// 	arg     []int
	// )

	// fmt.Scanf("%d", &a)
	// fmt.Scanf("%d", &b)
	// fmt.Scanf("%d", &c)

	// arg = append(arg, a, b, c)

	// fmt.Println(sum(arg))

	sc := bufio.NewScanner(os.Stdin)
	for sc.Scan() {
		txt := sc.Text()
		fmt.Printf("Эхо: %s\n", txt)
	}
}

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

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

	return "NO"
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var (
		a, b, c int
		arg     []int
	)

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

	arg = append(arg, a, b, c)

	fmt.Println(sum(arg))
}

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

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

	return "NO"
}

package main

import "fmt"

func isSum(a, b, c int) bool {
	if a == b+c || b == a+c || c == a+b {
		return true
	}
	return false
}

func main() {
	var test, a, b, c int

	fmt.Scanln(&test)
	for test > 0 {
		fmt.Scanln(&a, &b, &c)
		fmt.Println(isSum(a,b,c))
		test--
	}
	return
}

package main

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

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

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

	var T int
	var a int
	var b int
	var c int

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

		if a == b+c || b == a+c || c == b+a {
			Fprintln(out, "YES")

		}

		Fprintln(out, "NO")
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"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--
		a := make([]int, 3)
		a[0], a[1], a[2] = nextInt(), nextInt(), nextInt()
		sort.Slice(a, func(i, j int) bool { return i < j })
		if a[0]+a[1] == a[2] {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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"
	"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()
	cnt1 := make([]int64, 26)
	cnt2 := make([]int64, 26)
	for i := 1; i <= T; i++{
		for c := 0; c < 26; c++ {
			cnt1[c] = 0
			cnt2[c] = 0
		}
		cnt1[0] = 1
		cnt2[0] = 1
		q := readInt()
		for ;q > 0; q-- {
			d, k := readInt(), int64(readInt())
			x := readString()
			if d == 1 {
				for i := 0; i < len(x); i++ {
					cnt1[x[i] - 'a'] += k
				}
			} else{
				for i := 0; i < len(x); i++ {
					cnt2[x[i] - 'a'] += k
				}
			}
			can := false
			for c2 := 1; c2 < 26; c2++ {
				if cnt2[c2] > 0 {
					can = true
				}
			}
			if can {
				fmt.Fprintln(writer, "YES")
				continue
			}
			can = true
			for c1 := 1; c1 < 26; c1++ {
				if cnt1[c1] > 0 {
					can = false
					break
				}
			}
			can = can && (cnt1[0] < cnt2[0])
			if can {
				fmt.Fprintln(writer, "YES")
			} else {
				fmt.Fprintln(writer, "NO")
			}
		}
	}
}

package main

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

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

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

	var T int
	var n int
	var s string
	var xi int
	var x int

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

		a, b := [26]int{}, [26]int{}
		a[0], b[0] = 1, 1
		sa := 1
		sb := 1

	loop:
		for i := 0; i < n; i++ {
			Fscan(in, &xi, &x)
			Fscan(in, &s)
			if xi == 1 {
				for _, v := range s {
					a[v-'a'] += x
					sa += x
				}
			}
			if xi == 2 {
				for _, v := range s {
					b[v-'a'] += x
					sb += x
				}
			}
			//Fprintln(out, a, b)

			c := 0
			for ; c < 26; c++ {
				if a[c] > 0 {
					// g
					for d := c + 1; d < 26; d++ {
						if b[d] > 0 {
							Fprintln(out, "YES")
							continue loop
						}
					}
					if sb == b[c] && b[c] == a[c] {
						Fprintln(out, "NO")
						continue loop
					}
					if a[c] == sa && a[c] <= b[c] {
						Fprintln(out, "YES")
						continue loop
					}
				}
			}

			Fprintln(out, "NO")
		}

	}
}

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) ReadTwoDigitsAndString() (int, int, string) {
	var a, b int
	var res string
	_, _ = fmt.Fscanf(io.in, "%d %d %s\n", &a, &b, &res)
	return a, b, res
}

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 gcd(a, b int) int {
	for b != 0 {
		a %= b
		a, b = b, a
	}
	return a
}

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

	t := io.ReadInt()
	for ; t > 0; t-- {
		n := io.ReadInt()
		ma := make(map[byte]int, 26)
		mb := make(map[byte]int, 26)

	p:
		for i := 0; i < n; i++ {
			d, k, s := io.ReadTwoDigitsAndString()
			for j := 0; j < len(s); j++ {
				ch := s[j] - 'a'
				if d == 1 {
					ma[ch] += k
				} else {
					mb[ch] += k
				}
			}

			for j := byte(26 - 1); j >= 1; j-- {
				if mb[j] > 0 {
					io.Println("YES")
					continue p
				}
			}

			for j := byte(1); j < 26; j++ {
				if ma[j] > 0 {
					io.Println("NO")
					continue p
				}
			}

			if ma[0] < mb[0] {
				io.Println("YES")
			} else {
				io.Println("NO")
			}
		}
	}
}

package main

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

var (
	reader bufio.Reader
	writer bufio.Writer
)

type void struct{}
var member void

func solve() {
	var q int
	scan(&q)

	in_a := make(map[rune]int)
	in_b := make(map[rune]int)

	in_a['a'] = 1
	in_b['a'] = 1

	for i := 0; i < q; i += 1 {
		var (
			t int
			x int
			s string
		)

		scan(&t, &x, &s)
		for _, c := range s {
			if t == 1 {
				in_a[c] += x
			} else {
				in_b[c] += x
			}
		}

		val_a := make([]rune, 0)
		val_b := make([]rune, 0)

		for k := range in_a {
			val_a = append(val_a, k)
		}

		for k := range in_b {
			val_b = append(val_b, k)
		}

		sort.Slice(val_a, func(c, v int) bool {
			return val_a[c] < val_a[v]
		})

		sort.Slice(val_b, func(c, v int) bool {
			return val_b[c] > val_b[v]
		})

		if val_a[0] == val_b[0] {
			if len(val_a) == 1 {
				if in_a[val_a[0]] >= in_b[val_b[0]] {
					printf("NO\n")
				} else {
					printf("YES\n")
				}
			} else {
				printf("NO\n")
			}
		} else {
			if val_a[0] < val_b[0] {
				printf("YES\n")
			} else {
				printf("NO\n")
			}
		}
	}
}

func main() {
	inp, err := os.Open("input.txt")
	if err == nil {
		os.Stdin = inp
		outp, _ := os.Create("output.txt")
		os.Stdout = outp
		defer outp.Close()
		defer inp.Close()
	}

	reader = *bufio.NewReader(os.Stdin)
	writer = *bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	T := 1
	scan(&T)

	for ; T > 0; T-- {
		solve()
	}
}

func scan(a ...interface{}) (n int, err error) { return fmt.Fscan(&reader, a...) }
func printf(format string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(&writer, format, a...)
}

package main

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

func upd(m []int, k int, s string) {
	for _, v := range s {
		m[int(v)-int('a')] += k
	}
}

func check(m1, m2 []int) string {
	var l1, l2, l3 int
	for l2 = 25; l2 >= 0; l2-- {
		if m2[l2] > 0 { break }
	}
	for l3 = 25; l3 >= 0; l3-- {
		if m1[l3] > 0 { break }
	}
	for l1 = 0; l2 < 26; l1++ {
		if m1[l1] > 0 { break }
	}
	if l1 > l2 || (l1 == l2 && m1[l1] >= m2[l2]) || (l1 == l2 && m1[l1] < m2[l2] && l1 != l3) {
		return "NO"
	}
	return "YES"
}

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 q int
		fmt.Fscan(r, &q)
		m1 := make([]int, 26)
		m2 := make([]int, 26)
		m1[0] = 1
		m2[0] = 1

		for i := 0; i < q; i++ {
			var d, k int
			var str string
			fmt.Fscan(r, &d, &k, &str)

			if d == 1 {
				upd(m1, k, str)
			} else {
				upd(m2, k, str)
			}

			fmt.Fprintln(w, check(m1, m2))
		}
	}
}

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)

		aa := make([]int, 26)
		bb := make([]int, 26)
		aa[0], bb[0] = 1, 1

	Loop:
		for i := 0; i < n; i++ {
			var d, k int
			var s string
			fmt.Fscan(in, &d, &k, &s)
			for _, ch := range s {
				if d == 1 {
					aa[ch-'a'] += k
				} else {
					bb[ch-'a'] += k
				}
			}
			for j := 25; j > 0; j-- {
				if bb[j] > 0 {
					fmt.Fprintln(out, "YES")
					continue Loop
				}
			}

			for j := 1; j < 26; j++ {
				if aa[j] > 0 {
					fmt.Fprintln(out, "NO")
					continue Loop
				}
			}
			if aa[0] < bb[0] {
				fmt.Fprintln(out, "YES")
			} else {
				fmt.Fprintln(out, "NO")
			}
		}

	}
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
	"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()

	var T, n, d, k int
	var s string
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n)
		cntA := [2]int64{}
		hasOther := [2]bool{}
		for i := 0; i < n; i++ {
			Fscan(in, &d, &k, &s)
			d--
			a := strings.Count(s, "a")
			if !hasOther[d] && a < len(s) {
				hasOther[d] = true
			}
			cntA[d] += int64(a) * int64(k)
			if hasOther[1] || !hasOther[0] && cntA[0] < cntA[1] {
				Fprintln(out, "YES")
			} else {
				Fprintln(out, "NO")
			}
		}
	}
}

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

package main

import (
	"bufio"
	. "fmt"
	"io"
	"io/ioutil"
	"os"
	"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) {
		var n int
		Fscan(in, &n)
		c := [2][26]int64{}
		other := [2]bool{}
		for i := 0; i < n; i++ {
			var op, k int
			var s string
			Fscan(in, &op, &k, &s)
			op--
			if !other[op] {
				other[op] = strings.Count(s, "a") != len(s)
			}
			for _, b := range s {
				b -= 'a'
				c[op][b] += int64(k)
			}

			if other[1] {
				Fprintln(out, "YES")
				continue
			}
			if !other[0] && c[0][0] < c[1][0] {
				Fprintln(out, "YES")
				continue
			}
			Fprintln(out, "NO")
		}
	}

	cases := 1
	Fscan(in, &cases)
	for curCase := 1; curCase <= cases; curCase++ {
		solve(curCase)
	}

	// 如果是多组数据，请务必加上这段保险 —— 已经无法统计，有多少位竞赛选手在漏读数据上损失大把分数（包括我）
	// 此外，如果不小心写成了 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 (
	"bufio"
	"fmt"
	"os"
)

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

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

func main() {
	var t, n, d, k int
	var x string
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &n)
		s := make([]int, 26)
		y := make([]int, 26)
		for j := 0; j < n; j++ {
			fmt.Fscan(in, &d, &k, &x)
			if d == 1 {
				for _, v := range x {
					s[v-'a'] += k
				}
			} else {
				for _, v := range x {
					y[v-'a'] += k
				}
			}
			f := false
			pd := false
			for l := 1; l < 26; l++ {
				if y[l] > 0 {
					f = true
					break
				}
				if s[l] > 0 {
					pd = true
				}
			}
			if f || (!pd && s[0] < y[0]) {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		}

	}
}

package main

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

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

	var T, n, d, k int
	var s string
	for fmt.Fscan(in, &T); T > 0; T-- {
		fmt.Fscan(in, &n)
		count := [2]int64{}
		hasOther := [2]bool{}
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &d, &k, &s)
			d--
			a := strings.Count(s, "a")
			if !hasOther[d] && a < len(s) {
				hasOther[d] = true
			}
			count[d] += int64(a) * int64(k)
			if hasOther[1] || !hasOther[0] && count[0] < count[1] {
				fmt.Fprintln(out, "YES")
			} else {
				fmt.Fprintln(out, "NO")
			}
		}
	}
}

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 n int
	Fscan(in, &n)
	a1JustA := true
	a2JustA := true
	a1 := 0
	a2 := 0
	for x := 0; x < n; x++ {
		var tpe, cnt int
		var str string
		Fscan(in, &tpe, &cnt, &str)
		for i := 0; i < len(str); i++ {
			if tpe == 1 {
				if str[i] != 'a' {
					a1JustA = false
				}
				a1 += cnt
			} else {
				if str[i] != 'a' {
					a2JustA = false
				}
				a2 += cnt
			}
		}
		if !a2JustA {
			Fprintln(out, "Yes")
		} else if a1JustA && a1 < a2 {
			Fprintln(out, "Yes")
		} else {
			Fprintln(out, "No")
		}
	}
}

func abs(a int64) int64 {
	if a > 0 {
		return a
	}
	return -a
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}
func min(a, b int) int {
	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 (
	"bufio"
	. "fmt"
	"io"
	"os"
)

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

func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	var T int
	Fscan(in, &T)
	for Case := 1; Case <= T; Case++ {
		var n int
		Fscan(in, &n)
		var cnts, cntt = [26]int64{}, [26]int64{}
		cnts[0] = 1
		cntt[0] = 1
		for i := 0; i < n; i++ {
			var d, val int64
			var s string
			Fscan(in, &d, &val, &s)
			if d == 1 {
				for k := 0; k < len(s); k++ {
					cnts[s[k] - 'a'] += val
				}
			} else {
				for k := 0; k < len(s); k++ {
					cntt[s[k] - 'a'] += val
				}
			}
			var minsp, mintp, maxsp, maxtp int64 = 27, 27, -1, -1
			var k int64
			for k = 0; k < 26; k++ {
				if cnts[k] > 0 {
					minsp = min(k, minsp)
					maxsp = max(k, maxsp)
				}
				if cntt[k] > 0 {
					mintp = min(k, mintp)
					maxtp = max(k, maxtp)
				}
			}
			if minsp < maxtp {
				Fprintln(out, "YES")
				continue
			}
			if minsp > maxtp {
				Fprintln(out, "NO")
				continue
			}
			if cnts[minsp] < cntt[maxtp] && maxsp == minsp {
				Fprintln(out, "YES")
				continue
			}
			Fprintln(out, "NO")
		}
	}
}

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

package main

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

func upd(m []int, k int, s string) {
	for _, v := range s {
		m[int(v)-int('a')] += k
	}
}

func check(m1, m2 []int) string {
	res := "NO"
	for i := 25; i >= 0; i-- {
		if m1[i] < m2[i] {
			res = "YES"
			break
		}
	}
	return res
}

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 q int
		fmt.Fscan(r, &q)
		m1 := make([]int, 26)
		m2 := make([]int, 26)
		m1[0] = 1
		m2[0] = 1

		for i := 0; i < q; i++ {
			var d, k int
			var str string
			fmt.Fscan(r, &d, &k, &str)

			if d == 1 {
				upd(m1, k, str)
			} else {
				upd(m2, k, str)
			}

			fmt.Fprintln(w, check(m1, m2))
		}
	}
}

package main

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

func upd(m []int, k int, s string) {
	for _, v := range s {
		m[int(v)-int('a')] += k
	}
}

func check(m1, m2 []int) string {
	res := "NO"
	for i := 25; i >= 0; i-- {
		if m1[i] < m2[i] {
			res = "YES"
			break
		} else if m1[i] > m2[i] {
			break
		}
	}
	return res
}

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 q int
		fmt.Fscan(r, &q)
		m1 := make([]int, 26)
		m2 := make([]int, 26)
		m1[0] = 1
		m2[0] = 1

		for i := 0; i < q; i++ {
			var d, k int
			var str string
			fmt.Fscan(r, &d, &k, &str)

			if d == 1 {
				upd(m1, k, str)
			} else {
				upd(m2, k, str)
			}

			fmt.Fprintln(w, check(m1, m2))
		}
	}
}

package main

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

func upd(m *[]int, k int, s string) {
	for _, v := range s {
		(*m)[int(v)-int('a')] += k
	}
}

func num(m []int) int {
	n := 0
	for _, v := range m {
		n = n + 2*v
	}
	return n
}

func check(m1, m2 []int) string {
	/*
	fmt.Println("*********") // ***
	fmt.Println("##### m1 ", m1) // **
	fmt.Println("##### m2 ", m2) // **
	*/
	res := "NO"
	for i := range m1 {
		if m1[i] > m2[i] {
			m1[i] = 1
			m2[i] = 0
		} else if m1[i] < m2 [i] {
			m1[i] = 0
			m2[i] = 1
		} else {
			m1[i] = 0
			m2[i] = 0
		}
	}
	/*
	fmt.Println("##### m1 n1 ", m1, num(m1)) // **
	fmt.Println("##### m2 n2 ", m2, num(m2)) // **
	*/
	if num(m1) < num(m2) { res = "YES" }
	return res
}

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 q int
		fmt.Fscan(r, &q)
		m1 := make([]int, 26)
		m2 := make([]int, 26)
		m1[0] = 1
		m2[0] = 1

		for i := 0; i < q; i++ {
			var d, k int
			var str string
			fmt.Fscan(r, &d, &k, &str)

			if d == 1 {
				upd(&m1, k, str)
			} else {
				upd(&m2, k, str)
			}

			fmt.Fprintln(w, check(m1, m2))
		}
	}
}

package main

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

func upd(m *[]int, k int, s string) {
	for _, v := range s {
		(*m)[int(v)-int('a')] += k
	}
}

func num(m1 []int) int {
	n := 0
	for i := 25; i >= 0; i-- {
		n = 2*n + m1[i]
	}
	return n
}

func check(m1, m2 []int) string {
	/*
	fmt.Println("*********") // ***
	fmt.Println("##### m1 ", m1) // **
	fmt.Println("##### m2 ", m2) // **
	*/
	res := "NO"
	for i := 0; i < 26; i++ {
		if m1[i] > m2[i] {
			m1[i] = 1
			m2[i] = 0
		} else if m1[i] < m2[i] {
			m2[i] = 1
			m1[i] = 0
		} else {
			m1[i] = 0
			m2[i] = 0
		}
	}
	/*
	fmt.Println("##### m1 n1 ", m1, num(m1)) // **
	fmt.Println("##### m2 n2 ", m2, num(m2)) // **
	*/
	if num(m1) < num(m2) { res = "YES" }
	return res
}

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 q int
		fmt.Fscan(r, &q)
		m1 := make([]int, 26)
		m2 := make([]int, 26)
		m1[0] = 1
		m2[0] = 1

		for i := 0; i < q; i++ {
			var d, k int
			var str string
			fmt.Fscan(r, &d, &k, &str)

			if d == 1 {
				upd(&m1, k, str)
			} else {
				upd(&m2, k, str)
			}

			fmt.Fprintln(w, check(m1, m2))
		}
	}
}

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)

		aa := make([]int, 26)
		bb := make([]int, 26)
		aa[0], bb[0] = 1, 1
		a, b := 1, 1
		fn := func() bool {
			x, y := a, b
			for i := range aa {
				x -= aa[i]
				y -= bb[i]
				if x == 0 && y > 0 {
					return true
				} else if x == 0 && y == 0 && aa[i] < bb[i] {
					return true
				} else if x > 0 && y > 0 && aa[i] > bb[i] {
					return true
				} else if x > 0 && y == 0 {
					return false
				}
			}
			return false
		}

		for i := 0; i < n; i++ {
			var d, k int
			var s string
			fmt.Fscan(in, &d, &k, &s)
			for _, ch := range s {
				if d == 1 {
					aa[ch-'a'] += k
					a += k
				} else {
					bb[ch-'a'] += k
					b += k
				}
			}
			if fn() {
				fmt.Fprintln(out, "YES")
			} else {
				fmt.Fprintln(out, "NO")
			}
		}

	}
}

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)

		aa := make([]int, 26)
		bb := make([]int, 26)
		aa[0], bb[0] = 1, 1
		a, b := 1, 1
		fn := func() bool {
			x, y := a, b
			for i := range aa {
				x -= aa[i]
				y -= bb[i]
				if x == 0 && y > 0 {
					return true
				} else if x == 0 && y == 0 && aa[i] < bb[i] {
					return true
				} else if x > 0 && y > 0 && aa[i] > bb[i] {
					return true
				}
			}
			return false
		}

		for i := 0; i < n; i++ {
			var d, k int
			var s string
			fmt.Fscan(in, &d, &k, &s)
			for _, ch := range s {
				if d == 1 {
					aa[ch-'a'] += k
					a += k
				} else {
					bb[ch-'a'] += k
					b += k
				}
			}
			if fn() {
				fmt.Fprintln(out, "YES")
			} else {
				fmt.Fprintln(out, "NO")
			}
		}

	}
}

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)

		aa := make([]int, 26)
		bb := make([]int, 26)
		aa[0], bb[0] = 1, 1
		a, b := 1, 1
		fn := func() bool {
			x, y := a, b
			for i := range aa {
				x -= aa[i]
				y -= bb[i]
				if x == 0 && y > 0 {
					return true
				} else if x == 0 && y == 0 && aa[i] < bb[i] {
					return true
				}
			}
			return false
		}

		for i := 0; i < n; i++ {
			var d, k int
			var s string
			fmt.Fscan(in, &d, &k, &s)
			for _, ch := range s {
				if d == 1 {
					aa[ch-'a'] += k
					a += k
				} else {
					bb[ch-'a'] += k
					b += k
				}
			}
			if fn() {
				fmt.Fprintln(out, "YES")
			} else {
				fmt.Fprintln(out, "NO")
			}
		}

	}
}


package main

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

func main() {
	r := bufio.NewReader(os.Stdin)

	num := 0
	fmt.Fscanf(r, "%d\n", &num)

	coords := make([]int, num, num)
	apples := make(map[int]int, num)

	onright := 0
	onleft := 0

	for i := 0; i < num; i++ {
		var coord int
		var appleNum int
		fmt.Fscanf(r, "%d %d\n", &coord, &appleNum)

		if coord > 0 {
			onright++
		} else if coord < 0 {
			onleft++
		}

		apples[coord] = appleNum
		coords[i] = coord
	}
	sort.Ints(coords)

	if onright > onleft {
		coords = coords[:2*onleft+1]
	} else if onright < onleft {
		coords = coords[len(coords)-2*onright-1:]
	}

	total := 0
	for _, coord := range coords {
		total += apples[coord]
	}

	fmt.Printf("%d\n", total)
}

package main

import (
	"fmt"
)

type AppleTree struct {
	location int
	apples   int
}

func main() {
	var n int
	if _, err := fmt.Scanf("%d\n", &n); err != nil {
		return
	}

	array := make([]*AppleTree, n)
	neg_cnt := 0
	neg_apple := 0
	pos_cnt := 0
	pos_apple := 0

	for i := 0; i < n; i++ {
		var x, a int
		if _, err := fmt.Scanf("%d %d\n", &x, &a); err != nil {
			return
		}
		array[i] = &AppleTree{x, a}
		if x < 0 {
			neg_cnt++
			neg_apple += a
		} else {
			pos_cnt++
			pos_apple += a
		}
	}

	if neg_cnt == pos_cnt {
		fmt.Println(neg_apple + pos_apple)
	} else {
		apples := 0
		bubble_sort(array, n)

		if neg_cnt == 0 {
			fmt.Println(array[0].apples)
			return
		} else if pos_cnt == 0 {
			fmt.Println(array[n-1].apples)
			return
		} else if neg_cnt < pos_cnt {
			apples += neg_apple
			for i := neg_cnt; i < neg_cnt+neg_cnt+1; i++ {
				apples += array[i].apples
			}
		} else if neg_cnt > pos_cnt {
			apples += pos_apple
			for i := neg_cnt - pos_cnt - 1; i < neg_cnt; i++ {
				apples += array[i].apples
			}
		}

		fmt.Println(apples)
	}
}

func swap(a, b int, array []*AppleTree) {
	tmp := array[a]
	array[a] = array[b]
	array[b] = tmp
}

func bubble_sort(array []*AppleTree, length int) {
	for i := 0; i < length; i++ {
		for j := 0; j < length; j++ {
			if array[i].location < array[j].location {
				swap(i, j, array)
			}
		}
	}
}

package main

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

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

type Tree struct {
	a, x int
}

type ByPos []Tree

func (a ByPos) Len() int           { return len(a) }
func (a ByPos) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a ByPos) Less(i, j int) bool { return a[i].x < a[j].x }

//Wrong
func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	n := nextInt()
	a := make([]Tree, n+1)

	for i := range a[1:] {
		a[i].x = nextInt()
		a[i].a = nextInt()
	}

	sort.Sort(ByPos(a))

	mid := 0

	for i := 0; i < len(a); i++ {
		if a[i].x == 0 {
			mid = i
			break
		}
	}

	l, r := collectApple(a, mid, 0), collectApple(a, mid, 1)
	// println(l, r)
	// println(a)
	if l > r {
		println(l)
	} else {
		println(r)
	}

}

func collectApple(a []Tree, mid, dir int) int {
	cnt := 0
	l, r := mid-1, mid+1
	for {
		if dir == 1 {
			if r >= len(a) {
				break
			}

			cnt += a[r].a
			r++
		} else {
			if l < 0 {
				break
			}
			cnt += a[l].a
			l--
		}
		dir = 1 - dir
	}
	return cnt
}

func scan(a ...interface{}) {
	fmt.Fscan(reader, a...)
}

func next() string {
	if !scanner.Scan() {
		panic(scanner.Err())
	}
	return scanner.Text()
}

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

func nextInt() int {
	n, _ := strconv.Atoi(next())
	return n
}

func nextFloat() float64 {
	n, _ := strconv.ParseFloat(next(), 64)
	return n
}

func println(a ...interface{})               { fmt.Fprintln(writer, a...) }
func print(a ...interface{})                 { fmt.Fprint(writer, a...) }
func printf(format string, a ...interface{}) { fmt.Fprintf(writer, format, a...) }

package main

import (
	"fmt"
	"math"
	"sort"
)

type tree struct {
	X, Apls int
}

type TreesLine []tree

func (b TreesLine) Len() int           { return len(b) }
func (b TreesLine) Less(i, j int) bool { return b[i].X < b[j].X }
func (b TreesLine) Swap(i, j int)      { b[i], b[j] = b[j], b[i] }

func toPath(in_trees TreesLine, curr_index, direct int) int {
	trees := TreesLine(make([]tree, len(in_trees)))
	copy(trees, in_trees)
	i := curr_index
	for trees[i].X == 0 {
		i += direct
		if i < 0 || i >= len(trees) {
			return 0
		}
	}
	trees[i].X = 0
	return trees[i].Apls + toPath(trees, curr_index, -direct)
}

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

	trees := TreesLine{tree{0, 0}}
	for ; count > 0; count-- {
		var x, apls int
		fmt.Scan(&x, &apls)
		trees = append(trees, tree{x, apls})
	}

	sort.Sort(trees)
	nool_i := sort.Search(len(trees), func(i int) bool { return trees[i].X >= 0 })
	max_apls := math.Max(float64(toPath(trees, nool_i, 1)), float64(toPath(trees, nool_i, -1)))
	fmt.Println(int64(max_apls))
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(reader, &n)

	var ps, ng []int64
	elem := make(map[int64]int64)
	for i := 0; i < n; i++ {
		var x, y int64
		fmt.Fscan(reader, &x, &y)
		elem[x] = y

		if x > 0 {
			ps = append(ps, x)
		} else {
			ng = append(ng, x)
		}
	}
	sort.Slice(ps, func(i, j int) bool { return ps[i] < ps[j] })
	sort.Slice(ng, func(i, j int) bool { return ng[i] < ng[j] })

	for i, j := 0, len(ng)-1; i < j; i, j = i+1, j-1 {
		ng[i], ng[j] = ng[j], ng[i]
	}
	var count int64
	ln, mn := len(ng), len(ps)

	xn := min(ln, mn) + 1

	for i := 0; i < min(ln, xn); i++ {
		count += elem[ng[i]]
	}

	for i := 0; i < min(mn, xn); i++ {
		count += (elem[ps[i]])
	}

	fmt.Println(count)
}

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

package main

import (
	"fmt"
	"math"
	"sort"
)

type tree struct {
	X, Apls int
}

type TreesLine []tree

func (b TreesLine) Len() int           { return len(b) }
func (b TreesLine) Less(i, j int) bool { return b[i].X < b[j].X }
func (b TreesLine) Swap(i, j int)      { b[i], b[j] = b[j], b[i] }

func toPath(in_trees TreesLine, curr_index, direct int) int {
	trees := TreesLine(make([]tree, len(in_trees)))
	copy(trees, in_trees)
	i := curr_index
	for trees[i].X == 0 {
		i += direct
		if i < 0 || i >= len(trees) {
			return 0
		}
	}
	trees[i].X = 0
	return trees[i].Apls + toPath(trees, curr_index, -direct)
}

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

	trees := TreesLine{tree{0, 0}}
	for ; count > 0; count-- {
		var x, apls int
		fmt.Scan(&x, &apls)
		trees = append(trees, tree{x, apls})
	}

	sort.Sort(trees)
	nool_i := sort.Search(len(trees), func(i int) bool { return trees[i].X >= 0 })
	max_apls := math.Max(float64(toPath(trees, nool_i, 1)), float64(toPath(trees, nool_i, -1)))
	fmt.Println(max_apls)
}

package main

import (
	"fmt"
)

type AppleTree struct {
	location int
	apples   int
}

func main() {
	var n int
	if _, err := fmt.Scanf("%d\n", &n); err != nil {
		return
	}

	array := make([]*AppleTree, n)
	neg_cnt := 0
	neg_apple := 0
	pos_cnt := 0
	pos_apple := 0

	for i := 0; i < n; i++ {
		var x, a int
		if _, err := fmt.Scanf("%d %d\n", &x, &a); err != nil {
			return
		}
		array[i] = &AppleTree{x, a}
		if x < 0 {
			neg_cnt++
			neg_apple += a
		} else {
			pos_cnt++
			pos_apple += a
		}
	}

	if neg_cnt == pos_cnt {
		fmt.Println(neg_apple + pos_apple)
	} else {
		apples := 0
		start := -1
		end := -1
		bubble_sort(array, n)

		if neg_cnt == 0 {
			fmt.Println(array[0].apples)
			return
		} else if pos_cnt == 0 {
			fmt.Println(array[n-1].apples)
			return
		} else if neg_cnt < pos_cnt {
			apples += neg_apple
			start = neg_cnt
			end = n
		} else if neg_cnt > pos_cnt {
			apples += pos_apple
			start = 0
			end = neg_cnt
		}

		for i := start; i < end; i++ {
			apples += array[i].apples
		}

		fmt.Println(apples)
	}
}

func swap(a, b int, array []*AppleTree) {
	tmp := array[a]
	array[a] = array[b]
	array[b] = tmp
}

func bubble_sort(array []*AppleTree, length int) {
	for i := 0; i < length; i++ {
		for j := 0; j < length; j++ {
			if array[i].location < array[j].location {
				swap(i, j, array)
			}
		}
	}
}

package main

import (
	"fmt"
)

type AppleTree struct {
	location int
	apples   int
}

func main() {
	var n int
	if _, err := fmt.Scanf("%d\n", &n); err != nil {
		return
	}

	array := make([]*AppleTree, n)
	neg_cnt := 0
	neg_apple := 0
	pos_cnt := 0
	pos_apple := 0

	for i := 0; i < n; i++ {
		var x, a int
		if _, err := fmt.Scanf("%d %d\n", &x, &a); err != nil {
			return
		}
		array[i] = &AppleTree{x, a}
		if x < 0 {
			neg_cnt++
			neg_apple += a
		} else {
			pos_cnt++
			pos_apple += a
		}
	}

	if neg_cnt == pos_cnt {
		fmt.Println(neg_apple + pos_apple)
	} else {
		apples := 0
		start := -1
		end := -1
		bubble_sort(array, n)

		if neg_cnt == 0 {
			fmt.Println(array[0].apples)
			return
		} else if pos_cnt == 0 {
			fmt.Println(array[n-1].apples)
			return
		} else if neg_cnt < pos_cnt {
			apples += neg_apple
			start = neg_cnt
			end = n
			for i := start; i < end; i++ {
				apples += array[i].apples
			}
		} else if neg_cnt > pos_cnt {
			apples += pos_apple
			start = neg_cnt - pos_cnt - 1
			end = n - pos_cnt
			fmt.Println(start, end)
			for i := start; i < end; i++ {
				apples += array[i].apples
			}
		}

		fmt.Println(apples)
	}
}

func swap(a, b int, array []*AppleTree) {
	tmp := array[a]
	array[a] = array[b]
	array[b] = tmp
}

func bubble_sort(array []*AppleTree, length int) {
	for i := 0; i < length; i++ {
		for j := 0; j < length; j++ {
			if array[i].location < array[j].location {
				swap(i, j, array)
			}
		}
	}
}

package main

import (
	"fmt"
)

type AppleTree struct {
	location int
	apples   int
}

func main() {
	var n int
	if _, err := fmt.Scanf("%d\n", &n); err != nil {
		return
	}

	array := make([]*AppleTree, n)
	neg_cnt := 0
	neg_apple := 0
	pos_cnt := 0
	pos_apple := 0

	for i := 0; i < n; i++ {
		var x, a int
		if _, err := fmt.Scanf("%d %d\n", &x, &a); err != nil {
			return
		}
		array[i] = &AppleTree{x, a}
		if x < 0 {
			neg_cnt++
			neg_apple += a
		} else {
			pos_cnt++
			pos_apple += a
		}
	}

	if neg_cnt == pos_cnt {
		fmt.Println(neg_apple + pos_apple)
	} else {
		apples := 0
		start := -1
		end := -1
		bubble_sort(array, n)

		if neg_cnt == 0 {
			fmt.Println(array[0].apples)
			return
		} else if pos_cnt == 0 {
			fmt.Println(array[n-1].apples)
			return
		} else if neg_cnt < pos_cnt {
			apples += neg_apple
			start = neg_cnt
			end = n
			for i := start; i < end; i++ {
				apples += array[i].apples
			}
		} else if neg_cnt > pos_cnt {
			apples += pos_apple
			start = neg_cnt - pos_cnt - 1
			end = n - pos_cnt
			for i := start; i < end; i++ {
				apples += array[i].apples
			}
		}

		fmt.Println(apples)
	}
}

func swap(a, b int, array []*AppleTree) {
	tmp := array[a]
	array[a] = array[b]
	array[b] = tmp
}

func bubble_sort(array []*AppleTree, length int) {
	for i := 0; i < length; i++ {
		for j := 0; j < length; j++ {
			if array[i].location < array[j].location {
				swap(i, j, array)
			}
		}
	}
}

package main

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

func main() {
	r := bufio.NewReader(os.Stdin)

	num := 0
	fmt.Fscanf(r, "%d\n", &num)

	coords := make([]int, 0, num)
	apples := make(map[int]int, num)

	onright := 0
	onleft := 0
	total := 0

	for i := 0; i < num; i++ {
		var coord int
		var appleNum int
		fmt.Fscanf(r, "%d %d\n", &coord, &appleNum)

		if coord > 0 {
			onright++
		} else if coord < 0 {
			onleft++
		} else {
			total += appleNum
		}

		if coord != 0 {
			apples[coord] = appleNum
			coords = append(coords, coord)
		}
	}
	sort.Ints(coords)

	if onright > onleft {
		coords = coords[:2*onleft+1]
	} else if onright < onleft {
		coords = coords[len(coords)-2*onright-1:]
	}

	for _, coord := range coords {
		total += apples[coord]
	}

	println(total)

}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(reader, &n)

	var ps, ng []int64
	elem := make(map[int64]int64)
	for i := 0; i < n; i++ {
		var x, y int64
		fmt.Fscan(reader, &x, &y)
		elem[x] = y

		if x > 0 {
			ps = append(ps, x)
		} else {
			ng = append(ng, x)
		}
	}
	sort.Slice(ps, func(i, j int) bool { return ps[i] < ps[j] })
	sort.Slice(ng, func(i, j int) bool { return ng[i] < ng[j] })

	for i, j := 0, len(ng)-1; i < j; i, j = i+1, j-1 {
		ng[i], ng[j] = ng[j], ng[i]
	}
	var count int64
	ln, mn := len(ng), len(ps)
	// fmt.Println(ln, mn)
	for i := 0; i < min(ln, mn); i++ {
		// fmt.Println(min(ln, mn) - i)
		count += (elem[ps[i]] + elem[ng[i]])
		// fmt.Println(elem[ps[i]], elem[ng[min(ln, mn)-i]])
	}
	if ln > mn {
		count += (elem[ng[ln-mn-1]])
	} else if mn > ln {
		count += (elem[ps[ln]])
	}
	fmt.Println(count)
}

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

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

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

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(reader, &n)

	var ps, ng []int
	elem := make(map[int]int)
	for i := 0; i < n; i++ {
		var x, y int
		fmt.Fscan(reader, &x, &y)
		elem[x] = y

		if x > 0 {
			ps = append(ps, x)
		} else {
			ng = append(ng, x)
		}
	}

	sort.Ints(ps)
	sort.Ints(ng)
	var count int
	ln, mn := len(ng), len(ps)
	fmt.Println(ln, mn)
	for i := 0; i < min(ln, mn); i++ {
		// fmt.Println(min(ln, mn) - i)
		count += elem[ps[i]] + elem[ng[max(ln, mn)-min(ln, mn)-i]]
		// fmt.Println(elem[ps[i]], elem[ng[min(ln, mn)-i]])
	}
	if ln > mn {
		count += elem[ng[ln-mn-1]]
	} else if mn > ln {
		count += elem[ps[ln]]
	}
	fmt.Println(count)
}

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

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

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(reader, &n)

	var ps, ng []int64
	elem := make(map[int64]int64)
	for i := 0; i < n; i++ {
		var x, y int64
		fmt.Fscan(reader, &x, &y)
		elem[x] = y

		if x > 0 {
			ps = append(ps, x)
		} else {
			ng = append(ng, x)
		}
	}
	sort.Slice(ps, func(i, j int) bool { return ps[i] < ps[j] })
	sort.Slice(ng, func(i, j int) bool { return ng[i] < ng[j] })
	var count int64
	ln, mn := len(ng), len(ps)
	// fmt.Println(ln, mn)
	for i := 0; i < min(ln, mn); i++ {
		// fmt.Println(min(ln, mn) - i)
		count += (elem[ps[i]] + elem[ng[abs(max(ln, mn)-min(ln, mn)-i)]])
		// fmt.Println(elem[ps[i]], elem[ng[min(ln, mn)-i]])
	}
	if ln > mn {
		count += (elem[ng[ln-mn-1]])
	} else if mn > ln {
		count += (elem[ps[ln]])
	}
	fmt.Println(count)
}

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

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

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


package main

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

//func max(a, b int) int {if a > b {return a} else {return b}}
var r = bufio.NewReader(os.Stdin)
var w = bufio.NewWriter(os.Stdout)
func slove() {
	defer w.Flush()
	var n, k int
	fmt.Fscan(r, &n, &k)
	var s string
	var b []byte
	fmt.Fscan(r, &s)
	b = []byte(s)
	max_toa := 0
	change := make([]int, 26)
	for i := range change {
		change[i] = -1
	}
	change[0] = 'a'
	for i := range b {
		if change[b[i]-'a'] != -1 {
			b[i] = byte(change[b[i]-'a'])
		} else {
			if int(b[i] - 'a') - (max_toa) <= (k) {
				for j:=max_toa+1;j<=int(b[i]-'a');j++ {
					change[j] = 'a'
				}
				k -= int(b[i]-'a') - (max_toa)
				max_toa = int(b[i]-'a')
				b[i] = 'a'
			} else {
				for j:=int(b[i]-'a');j>int(b[i]-'a')-k;j-- {
					change[j] = int(b[i])-k
				}
				b[i] = b[i]-byte(k)
				k = 0
			}
		}
	}
	fmt.Fprintln(w, string(b))
}

func main() {
	var n int
	fmt.Fscan(r, &n)
	for i:=1;i<=n;i++ {
		slove()
	}
}

package main

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

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, k int
		Fscan(in, &n, &k)
		var s string
		Fscan(in, &s)

		ans := make([]byte, len(s))

		cur := uint8('a')

		cur2 := cur
		curCh := uint8('a')

		for i, ch := range s {
			ans[i] = s[i]
			if uint8(ch) <= cur {
				ans[i] = 'a'
			} else if uint8(ch) <= cur2 && ans[i] > curCh {
				ans[i] = curCh
			} else if k > 0 {
				need := int(uint8(ch) - cur)
				if k >= need {
					k -= need
					cur += uint8(need)
					ans[i] = 'a'
				} else {
					cur2 = uint8(ch)
					curCh = s[i] - uint8(k)
					k = 0
					ans[i] = curCh
				}
			}
		}
		Fprintln(out, string(ans))

	}

}

func MakeGrid(h, w int) [][]Int {
	index := make([][]Int, h)
	data := make([]Int, h*w)
	for i := 0; i < h; i++ {
		index[i] = data[i*w : (i+1)*w]
	}
	return index
}

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

func Min(nums ...Int) Int {
	return nums[MinIdx(nums...)]
}

func MinIdx(nums ...Int) Int {
	maxNumIdx := L0
	for i, num := range nums {
		if num < nums[maxNumIdx] {
			maxNumIdx = Int(i)
		}
	}
	return maxNumIdx
}

func Max(nums ...Int) Int {
	return nums[MaxIdx(nums...)]
}

func MaxIdx(nums ...Int) Int {
	maxNumIdx := L0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = Int(i)
		}
	}
	return maxNumIdx
}

var (
	mod  Int
	fmod func(Int) Int = doNothing
)

// SetMod sets the mod. It must be called first.
func SetMod(newMod Int) {
	mod = newMod
	fmod = dynamicMod
}

func dynamicMod(m Int) Int {
	m %= mod
	if m < 0 {
		return m + mod
	}
	return m
}

func doNothing(m Int) Int {
	return m
}

// Mod returns m % mod.
func (m Int) Mod() Int {
	return fmod(m)
}

// Inv returns modular multiplicative inverse
func (m Int) Inv() Int {
	return m.Pow(Int(0).Sub(2))
}

// Pow returns m^n
func (m Int) Pow(n Int) Int {
	p := Int(1)
	for n > 0 {
		if n&1 == 1 {
			p.MulAs(m)
		}
		m.MulAs(m)
		n >>= 1
	}
	return p
}

// Add returns m+x
func (m Int) Add(x Int) Int {
	return (m + x).Mod()
}

// Sub returns m-x
func (m Int) Sub(x Int) Int {
	return (m - x).Mod()
}

// Mul returns m*x
func (m Int) Mul(x Int) Int {
	return (m * x).Mod()
}

// Div returns m/x
func (m Int) Div(x Int) Int {
	return m.Mul(x.Inv())
}

// AddAs assigns *m + x to *m and returns m
func (m *Int) AddAs(x Int) *Int {
	*m = m.Add(x)
	return m
}

// SubAs assigns *m - x to *m and returns m
func (m *Int) SubAs(x Int) *Int {
	*m = m.Sub(x)
	return m
}

// MulAs assigns *m * x to *m and returns m
func (m *Int) MulAs(x Int) *Int {
	*m = m.Mul(x)
	return m
}

// DivAs assigns *m / x to *m and returns m
func (m *Int) DivAs(x Int) *Int {
	*m = m.Div(x)
	return m
}

func (m *Int) MaxAs(x ...Int) *Int {
	*m = Max(append(x, *m)...)
	return m
}

func (m *Int) MinAs(x ...Int) *Int {
	*m = Min(append(x, *m)...)
	return m
}

package main

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

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

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

type Key struct {
	n int
	k int
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var niter int
	fmt.Fscan(in, &niter)
	for iiter := 0; iiter < niter; iiter++ {
		var n, k int
		fmt.Fscan(in, &n, &k)
		var s string
		fmt.Fscan(in, &s)
		ms := 'a'
		rem := -1
		lrem := 'a'
		for _, l := range s {
			if l > ms {
				if int(l-ms) <= k {
					k -= int(l - ms)
					ms = l
				} else {
					rem = k
					lrem = l
					break
				}
			}
		}
		if rem == -1 {
			for i := 0; i < n; i++ {
				fmt.Fprintf(out, "%c", 'a')
			}
			fmt.Fprintln(out)
		} else {
			for _, l := range s {
				if l <= ms {
					fmt.Fprintf(out, "%c", 'a')
				} else {
					if l <= lrem && l >= rune(int(lrem)-rem) {
						fmt.Fprintf(out, "%c", rune(int(lrem)-rem))
					} else {
						fmt.Fprintf(out, "%c", l)
					}
				}
			}
			fmt.Fprintln(out)
		}
	}
}

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1675E(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var T, n, k int
	var s []byte
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &k, &s)
		if k > 24 {
			Fprintln(out, strings.Repeat("a", n))
			continue
		}
		var mx, up, low byte
		mx = 'a'
		for _, b := range s {
			if b > mx {
				if k := byte(k) - (mx - 'a'); b-k > mx {
					up, low = b, b-k
					break
				}
				mx = b
			}
		}
		for i, b := range s {
			if b <= mx {
				s[i] = 'a'
			} else if low <= b && b <= up {
				s[i] = low
			}
		}
		Fprintf(out, "%s\n", s)
	}
}

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

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)
var wrtr = bufio.NewWriterSize(os.Stdout, 10_000_000)
var rdr = bufio.NewScanner(os.Stdin)
func gs() string  { rdr.Scan(); return rdr.Text() }
func gi() int     { i,e := strconv.Atoi(gs()); if e != nil {panic(e)}; return i }
func main() {
	//f1, _ := os.Create("cpu.prof"); pprof.StartCPUProfile(f1); defer pprof.StopCPUProfile()
	defer wrtr.Flush()
	infn := ""; if infn == "" && len(os.Args) > 1 {	infn = os.Args[1] }
	if infn != "" {	f, e := os.Open(infn); if e != nil { panic(e) }; rdr = bufio.NewScanner(f) }
	rdr.Split(bufio.ScanWords); rdr.Buffer(make([]byte,1024),1_000_000_000)
	// PROGRAM STARTS HERE
	T := gi()
	for tt:=1;tt<=T;tt++ {
		N := gi()
		K := gi()
		S := gs()
		lookup := make([]int,26); for i:=0;i<26;i++ { lookup[i] = i }; base := 0
		for _,c := range S {
			if lookup[c-'a'] == 0 { continue }
			if int(c-'a') < K  { for b:=base+1;b<=int(c-'a');b++ { lookup[b] = 0 }; base = int(c-'a'); continue }
			if int(c-'a') == K { for b:=base+1;b<=int(c-'a');b++ { lookup[b] = 0 }; break }
			movesLeft := K - base; targLetter := int(c-'a')-movesLeft; for b:=targLetter;b<=int(c-'a');b++ { lookup[b] = targLetter }; break
		}
		ansarr := make([]byte,N); for i,c := range S { ansarr[i] = 'a' + byte(lookup[int(c-'a')]) }
		fmt.Fprintln(wrtr,string(ansarr))
	}
}

package main

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

var wr = bufio.NewWriter(os.Stdout)
var rd = bufio.NewScanner(os.Stdin)

func nextInt() int {
	rd.Scan()
	if n, err := strconv.Atoi(rd.Text()); err == nil {
		return n
	}
	return 0
}
func Max(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}
func main() {
	defer wr.Flush()
	rd.Buffer(make([]byte, 0), 1000000009)
	rd.Split(bufio.ScanWords)
	T := nextInt()
	for Case := 0; Case < T; Case++ {
		solve()
	}
}
func solve() {
	n, k := nextInt(), nextInt()
	rd.Scan()
	s := rd.Text()
	maxc := byte('a')
	l, r := byte('z'), byte('z')
	var builder strings.Builder
	builder.Grow(n)
	for _, val := range s {
		if k == 0 {
			if byte(val) <= maxc {
				builder.WriteByte('a')
			} else if byte(val) <= r && byte(val) >= l {
				builder.WriteByte(l)
			} else {
				builder.WriteByte(byte(val))
			}
		} else {
			if byte(val) <= maxc {
				builder.WriteByte('a')
			} else {
				if k >= int(byte(val)-maxc) {
					k -= int(byte(val) - maxc)
					maxc = byte(val)
					builder.WriteByte('a')
				} else {
					l = byte(val) - byte(k)
					r = byte(val)
					k = 0
					builder.WriteByte(l)
				}
			}
		}
	}
	fmt.Fprint(wr, builder.String(),"\n")
}

package main

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

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()
	var n, k int
	Fscan(r, &n)
	t := 0
	var p int
	var ss string
	for t < n {
		t++
		Fscan(r, &p, &k)
		Fscan(r, &ss)
		if k > 25 {
			k = 25
		}
		s := []byte(ss)
		if s[0] - byte(k) > 'a'{
			ss := s[0]
			for i := range s{
				if s[i] <= ss && s[i] >= ss - byte(k){
					s[i] = ss - byte(k)
				}
			}
			Fprintln(w, string(s))
			continue
		}
		high := byte(0)
		high2 := byte(0)
		for i := 0; i < len(s); i++{
			if int(s[i] - 'a') > k{
				high = s[i]
				break
			}
			if s[i] > high2{
				high2 = s[i]
			}
		}
		l := k - int(high2 - 'a')
		for i := range s{
			if s[i] <= high2{
				s[i] = byte(int(s[i]) - k)
			}else if s[i] <= high && s[i] >= high - byte(l){
				s[i] = high - byte(l)
			}
			if s[i] < 'a'{
				s[i] = 'a'
			}
		}
		Fprintln(w, string(s))
	}
}

package main

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

func main() {
	in, out := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)

	for ii := 0; ii < t; ii++ {
		var n, k int
		fmt.Fscan(in, &n, &k)
		var s string
		fmt.Fscan(in, &s)
		ans := make([]byte, n)
		dic := make(map[byte]byte)
		for i := 0; i < n; i++ {
			ans[i] = s[i]
			if ans[i] == 'a' {
				continue
			}
			if dic[ans[i]] > 0 {
				ans[i] -= dic[ans[i]]
			}
			if k > 0 {
				ori := ans[i]
				for ans[i] > 'a' && k > 0 {
					k--
					ans[i]--
					if dic[ans[i]] > 0 {
						ans[i] -= dic[ans[i]]
					}
				}
				for ; ori > ans[i]; ori-- {
					dic[ori] = ori - ans[i]
				}
			}
		}
		fmt.Fprintln(out, string(ans))
	}
}

package main

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

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, k int
		Fscan(in, &n, &k)
		var s string
		Fscan(in, &s)

		ans := make([]byte, len(s))

		cur := uint8('a')
		curCh := uint8('a')

		cur2 := cur
		curCh2 := curCh

		for i, ch := range s {
			ans[i] = s[i]
			if uint8(ch) <= cur && ans[i] > curCh {
				ans[i] = curCh
			} else if uint8(ch) <= cur2 && ans[i] > curCh2 {
				ans[i] = curCh2
			} else if k > 0 {
				need := int(uint8(ch) - cur)
				if k >= need {
					k -= need
					cur += uint8(need)
					ans[i] = curCh
				} else {
					cur2 = uint8(ch)
					curCh2 = s[i] - uint8(k)
					k = 0
					ans[i] = curCh2
				}
			}
		}
		Fprintln(out, string(ans))

	}

}

func MakeGrid(h, w int) [][]Int {
	index := make([][]Int, h)
	data := make([]Int, h*w)
	for i := 0; i < h; i++ {
		index[i] = data[i*w : (i+1)*w]
	}
	return index
}

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

func Min(nums ...Int) Int {
	return nums[MinIdx(nums...)]
}

func MinIdx(nums ...Int) Int {
	maxNumIdx := L0
	for i, num := range nums {
		if num < nums[maxNumIdx] {
			maxNumIdx = Int(i)
		}
	}
	return maxNumIdx
}

func Max(nums ...Int) Int {
	return nums[MaxIdx(nums...)]
}

func MaxIdx(nums ...Int) Int {
	maxNumIdx := L0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = Int(i)
		}
	}
	return maxNumIdx
}

var (
	mod  Int
	fmod func(Int) Int = doNothing
)

// SetMod sets the mod. It must be called first.
func SetMod(newMod Int) {
	mod = newMod
	fmod = dynamicMod
}

func dynamicMod(m Int) Int {
	m %= mod
	if m < 0 {
		return m + mod
	}
	return m
}

func doNothing(m Int) Int {
	return m
}

// Mod returns m % mod.
func (m Int) Mod() Int {
	return fmod(m)
}

// Inv returns modular multiplicative inverse
func (m Int) Inv() Int {
	return m.Pow(Int(0).Sub(2))
}

// Pow returns m^n
func (m Int) Pow(n Int) Int {
	p := Int(1)
	for n > 0 {
		if n&1 == 1 {
			p.MulAs(m)
		}
		m.MulAs(m)
		n >>= 1
	}
	return p
}

// Add returns m+x
func (m Int) Add(x Int) Int {
	return (m + x).Mod()
}

// Sub returns m-x
func (m Int) Sub(x Int) Int {
	return (m - x).Mod()
}

// Mul returns m*x
func (m Int) Mul(x Int) Int {
	return (m * x).Mod()
}

// Div returns m/x
func (m Int) Div(x Int) Int {
	return m.Mul(x.Inv())
}

// AddAs assigns *m + x to *m and returns m
func (m *Int) AddAs(x Int) *Int {
	*m = m.Add(x)
	return m
}

// SubAs assigns *m - x to *m and returns m
func (m *Int) SubAs(x Int) *Int {
	*m = m.Sub(x)
	return m
}

// MulAs assigns *m * x to *m and returns m
func (m *Int) MulAs(x Int) *Int {
	*m = m.Mul(x)
	return m
}

// DivAs assigns *m / x to *m and returns m
func (m *Int) DivAs(x Int) *Int {
	*m = m.Div(x)
	return m
}

func (m *Int) MaxAs(x ...Int) *Int {
	*m = Max(append(x, *m)...)
	return m
}

func (m *Int) MinAs(x ...Int) *Int {
	*m = Min(append(x, *m)...)
	return m
}

package main

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

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, k int
		Fscan(in, &n, &k)
		var s string
		Fscan(in, &s)

		ans := make([]byte, len(s))

		cur := uint8('a')
		curCh := uint8('a')

		cur2 := cur
		curCh2 := curCh

		for i, ch := range s {
			ans[i] = s[i]
			if uint8(ch) <= cur && s[i] > curCh {
				ans[i] = curCh
			} else if uint8(ch) <= cur2 && s[i] > curCh2 {
				ans[i] = curCh2
			} else if k > 0 {
				need := int(uint8(ch) - cur)
				if k >= need {
					k -= need
					cur += uint8(need)
					ans[i] = curCh
				} else {
					cur2 = uint8(ch)
					curCh2 = s[i] - uint8(k)
					k = 0
					ans[i] = curCh2
				}
			}
		}
		Fprintln(out, string(ans))

	}

}

func MakeGrid(h, w int) [][]Int {
	index := make([][]Int, h)
	data := make([]Int, h*w)
	for i := 0; i < h; i++ {
		index[i] = data[i*w : (i+1)*w]
	}
	return index
}

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

func Min(nums ...Int) Int {
	return nums[MinIdx(nums...)]
}

func MinIdx(nums ...Int) Int {
	maxNumIdx := L0
	for i, num := range nums {
		if num < nums[maxNumIdx] {
			maxNumIdx = Int(i)
		}
	}
	return maxNumIdx
}

func Max(nums ...Int) Int {
	return nums[MaxIdx(nums...)]
}

func MaxIdx(nums ...Int) Int {
	maxNumIdx := L0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = Int(i)
		}
	}
	return maxNumIdx
}

var (
	mod  Int
	fmod func(Int) Int = doNothing
)

// SetMod sets the mod. It must be called first.
func SetMod(newMod Int) {
	mod = newMod
	fmod = dynamicMod
}

func dynamicMod(m Int) Int {
	m %= mod
	if m < 0 {
		return m + mod
	}
	return m
}

func doNothing(m Int) Int {
	return m
}

// Mod returns m % mod.
func (m Int) Mod() Int {
	return fmod(m)
}

// Inv returns modular multiplicative inverse
func (m Int) Inv() Int {
	return m.Pow(Int(0).Sub(2))
}

// Pow returns m^n
func (m Int) Pow(n Int) Int {
	p := Int(1)
	for n > 0 {
		if n&1 == 1 {
			p.MulAs(m)
		}
		m.MulAs(m)
		n >>= 1
	}
	return p
}

// Add returns m+x
func (m Int) Add(x Int) Int {
	return (m + x).Mod()
}

// Sub returns m-x
func (m Int) Sub(x Int) Int {
	return (m - x).Mod()
}

// Mul returns m*x
func (m Int) Mul(x Int) Int {
	return (m * x).Mod()
}

// Div returns m/x
func (m Int) Div(x Int) Int {
	return m.Mul(x.Inv())
}

// AddAs assigns *m + x to *m and returns m
func (m *Int) AddAs(x Int) *Int {
	*m = m.Add(x)
	return m
}

// SubAs assigns *m - x to *m and returns m
func (m *Int) SubAs(x Int) *Int {
	*m = m.Sub(x)
	return m
}

// MulAs assigns *m * x to *m and returns m
func (m *Int) MulAs(x Int) *Int {
	*m = m.Mul(x)
	return m
}

// DivAs assigns *m / x to *m and returns m
func (m *Int) DivAs(x Int) *Int {
	*m = m.Div(x)
	return m
}

func (m *Int) MaxAs(x ...Int) *Int {
	*m = Max(append(x, *m)...)
	return m
}

func (m *Int) MinAs(x ...Int) *Int {
	*m = Min(append(x, *m)...)
	return m
}

package main

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

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, k int
		Fscan(in, &n, &k)
		var s string
		Fscan(in, &s)

		ans := make([]byte, len(s))

		cur := uint8('a')
		curCh := uint8('a')
		for i, ch := range s {
			need := int(uint8(ch) - cur)
			ans[i] = s[i]
			if uint8(ch) <= cur && s[i] > curCh {
				ans[i] = curCh
			} else if k > 0 {
				if k >= need {
					k -= need
					cur += uint8(need)
					ans[i] = curCh
				} else {
					cur = uint8(ch)
					curCh = s[i] - uint8(k)
					k = 0
					ans[i] = curCh
				}
			}
		}
		Fprintln(out, string(ans))

	}

}

func MakeGrid(h, w int) [][]Int {
	index := make([][]Int, h)
	data := make([]Int, h*w)
	for i := 0; i < h; i++ {
		index[i] = data[i*w : (i+1)*w]
	}
	return index
}

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

func Min(nums ...Int) Int {
	return nums[MinIdx(nums...)]
}

func MinIdx(nums ...Int) Int {
	maxNumIdx := L0
	for i, num := range nums {
		if num < nums[maxNumIdx] {
			maxNumIdx = Int(i)
		}
	}
	return maxNumIdx
}

func Max(nums ...Int) Int {
	return nums[MaxIdx(nums...)]
}

func MaxIdx(nums ...Int) Int {
	maxNumIdx := L0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = Int(i)
		}
	}
	return maxNumIdx
}

var (
	mod  Int
	fmod func(Int) Int = doNothing
)

// SetMod sets the mod. It must be called first.
func SetMod(newMod Int) {
	mod = newMod
	fmod = dynamicMod
}

func dynamicMod(m Int) Int {
	m %= mod
	if m < 0 {
		return m + mod
	}
	return m
}

func doNothing(m Int) Int {
	return m
}

// Mod returns m % mod.
func (m Int) Mod() Int {
	return fmod(m)
}

// Inv returns modular multiplicative inverse
func (m Int) Inv() Int {
	return m.Pow(Int(0).Sub(2))
}

// Pow returns m^n
func (m Int) Pow(n Int) Int {
	p := Int(1)
	for n > 0 {
		if n&1 == 1 {
			p.MulAs(m)
		}
		m.MulAs(m)
		n >>= 1
	}
	return p
}

// Add returns m+x
func (m Int) Add(x Int) Int {
	return (m + x).Mod()
}

// Sub returns m-x
func (m Int) Sub(x Int) Int {
	return (m - x).Mod()
}

// Mul returns m*x
func (m Int) Mul(x Int) Int {
	return (m * x).Mod()
}

// Div returns m/x
func (m Int) Div(x Int) Int {
	return m.Mul(x.Inv())
}

// AddAs assigns *m + x to *m and returns m
func (m *Int) AddAs(x Int) *Int {
	*m = m.Add(x)
	return m
}

// SubAs assigns *m - x to *m and returns m
func (m *Int) SubAs(x Int) *Int {
	*m = m.Sub(x)
	return m
}

// MulAs assigns *m * x to *m and returns m
func (m *Int) MulAs(x Int) *Int {
	*m = m.Mul(x)
	return m
}

// DivAs assigns *m / x to *m and returns m
func (m *Int) DivAs(x Int) *Int {
	*m = m.Div(x)
	return m
}

func (m *Int) MaxAs(x ...Int) *Int {
	*m = Max(append(x, *m)...)
	return m
}

func (m *Int) MinAs(x ...Int) *Int {
	*m = Min(append(x, *m)...)
	return m
}

package main

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

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, k int
		Fscan(in, &n, &k)
		var s string
		Fscan(in, &s)

		ans := make([]byte, len(s))

		cur := uint8('a')
		curCh := uint8('a')
		for i, ch := range s {
			need := int(uint8(ch) - cur)
			ans[i] = s[i]
			if uint8(ch) <= cur && s[i] > curCh {
				ans[i] = curCh
			} else if k > 0 {
				if k >= need {
					k -= need
					cur += uint8(need)
					ans[i] = curCh
				} else {
					cur = uint8(ch)
					curCh = s[i] - uint8(k)
					k = 01
					ans[i] = curCh
				}
			}
		}
		Fprintln(out, string(ans))

	}

}

func MakeGrid(h, w int) [][]Int {
	index := make([][]Int, h)
	data := make([]Int, h*w)
	for i := 0; i < h; i++ {
		index[i] = data[i*w : (i+1)*w]
	}
	return index
}

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

func Min(nums ...Int) Int {
	return nums[MinIdx(nums...)]
}

func MinIdx(nums ...Int) Int {
	maxNumIdx := L0
	for i, num := range nums {
		if num < nums[maxNumIdx] {
			maxNumIdx = Int(i)
		}
	}
	return maxNumIdx
}

func Max(nums ...Int) Int {
	return nums[MaxIdx(nums...)]
}

func MaxIdx(nums ...Int) Int {
	maxNumIdx := L0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = Int(i)
		}
	}
	return maxNumIdx
}

var (
	mod  Int
	fmod func(Int) Int = doNothing
)

// SetMod sets the mod. It must be called first.
func SetMod(newMod Int) {
	mod = newMod
	fmod = dynamicMod
}

func dynamicMod(m Int) Int {
	m %= mod
	if m < 0 {
		return m + mod
	}
	return m
}

func doNothing(m Int) Int {
	return m
}

// Mod returns m % mod.
func (m Int) Mod() Int {
	return fmod(m)
}

// Inv returns modular multiplicative inverse
func (m Int) Inv() Int {
	return m.Pow(Int(0).Sub(2))
}

// Pow returns m^n
func (m Int) Pow(n Int) Int {
	p := Int(1)
	for n > 0 {
		if n&1 == 1 {
			p.MulAs(m)
		}
		m.MulAs(m)
		n >>= 1
	}
	return p
}

// Add returns m+x
func (m Int) Add(x Int) Int {
	return (m + x).Mod()
}

// Sub returns m-x
func (m Int) Sub(x Int) Int {
	return (m - x).Mod()
}

// Mul returns m*x
func (m Int) Mul(x Int) Int {
	return (m * x).Mod()
}

// Div returns m/x
func (m Int) Div(x Int) Int {
	return m.Mul(x.Inv())
}

// AddAs assigns *m + x to *m and returns m
func (m *Int) AddAs(x Int) *Int {
	*m = m.Add(x)
	return m
}

// SubAs assigns *m - x to *m and returns m
func (m *Int) SubAs(x Int) *Int {
	*m = m.Sub(x)
	return m
}

// MulAs assigns *m * x to *m and returns m
func (m *Int) MulAs(x Int) *Int {
	*m = m.Mul(x)
	return m
}

// DivAs assigns *m / x to *m and returns m
func (m *Int) DivAs(x Int) *Int {
	*m = m.Div(x)
	return m
}

func (m *Int) MaxAs(x ...Int) *Int {
	*m = Max(append(x, *m)...)
	return m
}

func (m *Int) MinAs(x ...Int) *Int {
	*m = Min(append(x, *m)...)
	return m
}

package main

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

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

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

type Key struct {
	n int
	k int
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var niter int
	fmt.Fscan(in, &niter)
	for iiter := 0; iiter < niter; iiter++ {
		var n, k int
		fmt.Fscan(in, &n, &k)
		var s string
		fmt.Fscan(in, &s)
		ms := 'a'
		rem := -1
		lrem := 'a'
		for _, l := range s {
			if l > ms {
				if int(l-ms) <= k {
					k -= int(l - ms)
					ms = l
				} else {
					rem = k
					lrem = l
					break
				}
			}
		}
		if rem == -1 {
			for i := 0; i < n; i++ {
				fmt.Fprintf(out, "%c", 'a')
			}
			fmt.Fprintln(out)
		} else {
			for _, l := range s {
				if l <= ms {
					fmt.Fprintf(out, "%c", 'a')
				} else {
					if l <= lrem {
						fmt.Fprintf(out, "%c", rune(int(lrem)-rem))
					} else {
						fmt.Fprintf(out, "%c", l)
					}
				}
			}
			fmt.Fprintln(out)
		}
	}
}

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1675E(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var T, n, k int
	var s []byte
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &k, &s)
		if k > 24 {
			Fprintln(out, strings.Repeat("a", n))
			continue
		}
		var mx, up, low byte
		mx = 'a'
		for _, b := range s {
			if b > mx {
				if k := byte(k) - (mx - 'a'); b-k > 'a' {
					up, low = b, b-k
					break
				}
				mx = b
			}
		}
		for i, b := range s {
			if b <= mx {
				s[i] = 'a'
			} else if low <= b && b <= up {
				s[i] = low
			}
		}
		Fprintf(out, "%s\n", s)
	}
}

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


package main

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

// github.com/EndlessCheng/codeforces-go
func CF486D(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	var d, n, v, w, rt, min int
	Fscan(in, &d, &n)
	a := make([]int, n)
	for i := range a {
		Fscan(in, &a[i])
	}
	g := make([][]int, n)
	for i := 1; i < n; i++ {
		Fscan(in, &v, &w)
		v--
		w--
		g[v] = append(g[v], w)
		g[w] = append(g[w], v)
	}

	const mod int64 = 1e9 + 7
	var f func(v, fa int) int64
	f = func(v, fa int) int64 {
		s := int64(1)
		for _, w := range g[v] {
			if w != fa && (w > rt && a[w] == min || min < a[w] && a[w] <= min+d) {
				s = s * (f(w, v) + 1) % mod
			}
		}
		return s
	}
	ans := int64(0)
	for rt, min = range a {
		ans += f(rt, -1)
	}
	Fprint(out, ans%mod)
}

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

package main

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

// github.com/EndlessCheng/codeforces-go
func main() {
	in := bufio.NewReader(os.Stdin)
	var d, n, v, w, rt, min int
	Fscan(in, &d, &n)
	a := make([]int, n)
	for i := range a {
		Fscan(in, &a[i])
	}
	g := make([][]int, n)
	for i := 1; i < n; i++ {
		Fscan(in, &v, &w)
		v--
		w--
		g[v] = append(g[v], w)
		g[w] = append(g[w], v)
	}

	const mod int64 = 1e9 + 7
	var f func(v, fa int) int64
	f = func(v, fa int) int64 {
		s := int64(1)
		for _, w := range g[v] {
			if w != fa && (w > rt && a[w] == min || min < a[w] && a[w] <= min+d) {
				s = s * (f(w, v) + 1) % mod
			}
		}
		return s
	}
	ans := int64(0)
	for rt, min = range a {
		ans += f(rt, -1)
	}
	Print(ans % mod)
}

package main

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

// github.com/EndlessCheng/codeforces-go
func CF486D(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	var d, n, v, w, min int
	Fscan(in, &d, &n)
	a := make([]int, n)
	for i := range a {
		Fscan(in, &a[i])
	}
	g := make([][]int, n)
	for i := 1; i < n; i++ {
		Fscan(in, &v, &w)
		v--
		w--
		g[v] = append(g[v], w)
		g[w] = append(g[w], v)
	}

	const mod int64 = 1e9 + 7
	vis := make([]bool, n)
	var f func(v, fa int) int64
	f = func(v, fa int) int64 {
		if a[v] == min {
			vis[v] = true
		}
		s := int64(1)
		for _, w := range g[v] {
			if w != fa && (a[w] == min && !vis[w] || min < a[w] && a[w] <= min+d) {
				s = s * (f(w, v) + 1) % mod
			}
		}
		return s
	}
	ans := int64(0)
	for v, min = range a {
		ans += f(v, -1)
	}
	Fprint(out, ans%mod)
}

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