Alice and Bob received $$$n$$$ candies from their parents. Each candy weighs either 1 gram or 2 grams. Now they want to divide all candies among themselves fairly so that the total weight of Alice's candies is equal to the total weight of Bob's candies.Check if they can do that.Note that candies are not allowed to be cut in half.

The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of candies that Alice and Bob received. The next line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ — the weights of the candies. The weight of each candy is either $$$1$$$ or $$$2$$$. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^5$$$.

For each test case, output on a separate line:    "YES", if all candies can be divided into two sets with the same weight;  "NO" otherwise.  You can output "YES" and "NO" in any case (for example, the strings yEs, yes, Yes and YES will be recognized as positive).

NoteIn the first test case, Alice and Bob can each take one candy, then both will have a total weight of $$$1$$$.In the second test case, any division will be unfair.In the third test case, both Alice and Bob can take two candies, one of weight $$$1$$$ and one of weight $$$2$$$.In the fourth test case, it is impossible to divide three identical candies between two people.In the fifth test case, any division will also be unfair.

package main

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

var reader = bufio.NewReader(os.Stdin)
var 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 main() {
	defer writer.Flush()

	var t, n, x int
	var arr [3]int

	scanf("%d\n", &t)

	for i := 0; i < t; i++ {
		scanf("%d\n", &n)
		for j := 0; j < n; j++ {
			scanf("%d", &x)
			arr[x]++
		}
		scanf("\n")
		if (arr[1]+2*arr[2])%2 != 0 {
			printf("NO\n")
		} else {
			p := (arr[1] + 2*arr[2]) / 2
			if p%2 == 0 || (p%2 != 0 && arr[1] != 0) {
				printf("YES\n")
			} else {
				printf("NO\n")
			}
		}
		arr[1] = 0
		arr[2] = 0
	}
}

package main

import (
	"fmt"
)

func solve(n int, s []int) bool {
	M := make(map[int]int, 2)
	var A, B, sum int

	for _, i := range s {
		M[i]++
		sum += i
	}
	if sum%2 != 0 {
		return false
	}
	for _, i := range [2]int{2, 1} {
		for ; M[i] > 0; M[i]-- {
			if A >= B {
				B += i
			} else {
				A += i
			}
		}
	}

	return A == B
}
func main() {
	var t int
	fmt.Scan(&t)
	for T := 0; T < t; T++ {
		var n int
		fmt.Scan(&n)
		s := make([]int, n)
		for i := range s {
			fmt.Scan(&s[i])
		}
		if solve(n, s) {
			fmt.Println("yes")
		} else {
			fmt.Println("No")
		}
	}
}

package main

import (
	"fmt"
)

func solve(n int, s []int) bool {
	M := make(map[int]int, 2)
	var A, B, sum int

	for _, i := range s {
		M[i]++
		sum += i
	}
	if sum%2 != 0 {
		return false
	}
	keys := [2]int{2, 1}
	for _, i := range keys {
		for ; M[i] > 0; M[i]-- {
			if A >= B {
				B += i
			} else {
				A += i
			}
		}
	}

	return A == B
}
func main() {
	var t int
	fmt.Scan(&t)
	for T := 0; T < t; T++ {
		var n int
		fmt.Scan(&n)
		s := make([]int, n)
		for i := range s {
			fmt.Scan(&s[i])
		}
		if solve(n, s) {
			fmt.Println("yes")
		} else {
			fmt.Println("No")
		}
	}
}

package main

import (
	"fmt"
)

func solve(n int, s []int) bool {
	M := make(map[int]int, 2)
	var A, B, sum int

	for _, i := range s {
		M[i]++
		sum += i
	}
	if sum%2 != 0 {
		return false
	}
	keys := [2]int{2, 1}
	for len(M) > 0 {
		for _, i := range keys {
			for ; M[i] > 0; M[i]-- {
				if A >= B {
					B += i
				} else {
					A += i
				}
			}
			delete(M, i)
		}
	}
	return A == B
}
func main() {
	var t int
	fmt.Scan(&t)
	for T := 0; T < t; T++ {
		var n int
		fmt.Scan(&n)
		s := make([]int, n)
		for i := range s {
			fmt.Scan(&s[i])
		}
		if solve(n, s) {
			fmt.Println("yes")
		} else {
			fmt.Println("No")
		}
	}
}

package main

import (
	"fmt"
	"sort"
)

func solve(n int, s []int) bool {
	M := make(map[int]int, 2)
	var A, B, sum int

	for _, i := range s {
		M[i]++
		sum += i
	}
	if sum%2 != 0 {
		return false
	}
	keys := []int{2, 1}
	sort.Slice(keys, func(i, j int) bool {
		return keys[i] > keys[j]
	})
	for len(M) > 0 {
		for _, i := range keys {
			for ; M[i] > 0; M[i]-- {
				if A >= B {
					B += i
				} else {
					A += i
				}
			}
			delete(M, i)
		}
	}
	return A == B
}
func main() {
	var t int
	fmt.Scan(&t)
	for T := 0; T < t; T++ {
		var n int
		fmt.Scan(&n)
		s := make([]int, n)
		for i := range s {
			fmt.Scan(&s[i])
		}
		if solve(n, s) {
			fmt.Println("yes")
		} else {
			fmt.Println("No")
		}
	}
}

package main

import (
	"fmt"
	"sort"
)

func solve(n int, s []int) bool {
	M := make(map[int]int, 2)
	var A, B, sum int

	for _, i := range s {
		M[i]++
		sum += i
	}
	if sum%2 != 0 {
		return false
	}
	keys := []int{}
	for i := range M {
		keys = append(keys, i)
	}
	sort.Slice(keys, func(i, j int) bool {
		return keys[i] > keys[j]
	})
	for len(M) > 0 {
		for _, i := range keys {
			for ; M[i] > 0; M[i]-- {
				if A >= B {
					B += i
				} else {
					A += i
				}
			}
			delete(M, i)
		}
	}
	return A == B
}
func main() {
	var t int
	fmt.Scan(&t)
	for T := 0; T < t; T++ {
		var n int
		fmt.Scan(&n)
		s := make([]int, n)
		for i := range s {
			fmt.Scan(&s[i])
		}
		if solve(n, s) {
			fmt.Println("yes")
		} else {
			fmt.Println("No")
		}
	}
}

package main

import (
	"fmt"
	"sort"
)

func solve(n int, s []int) bool {
	M := make(map[int]int)
	var A, B, sum int

	for _, i := range s {
		M[i]++
		sum += i
	}
	if sum%2 != 0 {
		return false
	}
	keys := []int{}
	for i := range M {
		keys = append(keys, i)
	}
	sort.Slice(keys, func(i, j int) bool {
		return keys[i] > keys[j]
	})
	for len(M) > 0 {
		for _, i := range keys {
			for ; M[i] > 0; M[i]-- {
				if A >= B {
					B += i
				} else {
					A += i
				}
			}
			delete(M, i)
		}
	}
	return A == B
}
func main() {
	var t int
	fmt.Scan(&t)
	for T := 0; T < t; T++ {
		var n int
		fmt.Scan(&n)
		s := make([]int, n)
		for i := range s {
			fmt.Scan(&s[i])
		}
		if solve(n, s) {
			fmt.Println("yes")
		} else {
			fmt.Println("No")
		}
	}
}

package main

import (
	"fmt"
	"sort"
)

func solve(n int, s []int) bool {
	M := make(map[int]int)
	A := 0
	B := 0
	sum := 0
	for _, i := range s {
		M[i]++
		sum += i
	}
	if sum%2 != 0 {
		return false
	}
	keys := []int{}
	for i := range M {
		keys = append(keys, i)
	}
	sort.Slice(keys, func(i, j int) bool {
		return keys[i] > keys[j]
	})
	// fmt.Println(keys)
	for len(M) > 0 {
		for _, i := range keys {
			for M[i] > 0 {
				// fmt.Println(A, B, M)
				if A >= B {
					B += i
					M[i]--
				} else {
					A += i
					M[i]--
				}
			}
			delete(M, i)
		}
	}
	// fmt.Println(A, B, M)
	return A == B
}
func main() {
	// fmt.Println(solve(7, []int{1, 2, 1, 2, 1, 2, 1}))
	var t int
	fmt.Scan(&t)
	for T := 0; T < t; T++ {
		var n int
		fmt.Scan(&n)
		s := make([]int, n)
		for i := range s {
			fmt.Scan(&s[i])
		}
		if solve(n, s) {
			fmt.Println("yes")
		} else {
			fmt.Println("No")
		}
	}
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	test := parseInt(getString(reader))
	for ; test > 0; test-- {
		n := parseInt(getString(reader))
		candies := getIntln(reader)
		if n == 1 {
			writer.WriteString("NO\n")
			continue
		}
		totalWeight := sum(candies)
		if totalWeight%2 == 0 {
			if (n%2 == 1) && alltwo(candies) {
				writer.WriteString("NO\n")
			} else {
				writer.WriteString("YES\n")
			}
		} else {
			writer.WriteString("NO\n")
		}
	}
	writer.Flush()
}

func alltwo(A []int) bool {
	for _, a := range A {
		if a == 1 {
			return false
		}
	}
	return true
}

func sum(A []int) int {
	var res int
	for _, a := range A {
		res += a
	}
	return res
}

func getIntln(in *bufio.Reader) []int {
	b := strings.Split(getString(in), " ")
	res := make([]int, len(b))
	for k, v := range b {
		res[k] = parseInt(v)
	}
	return res
}

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

func parseInt(str string) int {
	var res int
	size := len(str)
	for i := 0; i < size; i++ {
		digit := int(str[i] - '0')
		for j := (i + 1); j < size; j++ {
			digit = digit<<3 + digit<<1
		}
		res += digit
	}
	return res
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	test := parseInt(getString(reader))
	for ; test > 0; test-- {
		n := parseInt(getString(reader))
		candies := getIntln(reader)
		if n == 1 {
			writer.WriteString("NO\n")
			continue
		}
		totalWeight := sum(candies)
		if totalWeight%2 == 0 {
			if (n%2 == 1) && alltwo(candies) {
				writer.WriteString("NO\n")
			} else {
				writer.WriteString("YES\n")
			}
		} else {
			writer.WriteString("NO\n")
		}
		writer.Flush()
	}
}

func alltwo(A []int) bool {
	for _, a := range A {
		if a == 1 {
			return false
		}
	}
	return true
}

func sum(A []int) int {
	var res int
	for _, a := range A {
		res += a
	}
	return res
}

func getIntln(in *bufio.Reader) []int {
	b := strings.Split(getString(in), " ")
	res := make([]int, len(b))
	for k, v := range b {
		res[k] = parseInt(v)
	}
	return res
}

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

func parseInt(str string) int {
	var res int
	size := len(str)
	for i := 0; i < size; i++ {
		digit := int(str[i] - '0')
		for j := (i + 1); j < size; j++ {
			digit = digit<<3 + digit<<1
		}
		res += digit
	}
	return res
}

package main

import (
    "fmt"
)

func main() {
   var t int
   fmt.Scan(&t)
   for k := 0; k < t; k++ {
       var n int
       fmt.Scan(&n)
       a := make([]int, n)
       count := make([]int, 3)
       for i := 0; i < n; i++ {
           fmt.Scan(&a[i])
           count[a[i]]++
       }
       if count[1] % 2 == 1 {
           fmt.Println("NO")
       } else if count[1] % 2 == 0 && count[2] % 2 == 0{
           fmt.Println("YES")
       } else if count[2] % 2 == 1 && count[1] % 2 == 0 && count[1] != 0{
           fmt.Println("YES")
       } else {
           fmt.Println("NO")
       }
   }
}

package main

import (
    "fmt"
)

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

    for ; t > 0; t-- {
        var n int

        fmt.Scan(&n)

        w, ones, twos := 0, 0, 0
        for i := 0; i < n; i++ {
            var x int
            fmt.Scan(&x)

            w += x
            if x == 1 {
                ones++
            } else {
                twos++
            }
        }

        if w % 2 == 1 {
            fmt.Println("NO")
            continue
        }

        if twos % 2 == 0 || ones >= 2 {
            fmt.Println("YES")
        } else {
            fmt.Println("NO")
        }

    }
}

package main

import "fmt"

func main() {
    var j,i,t,n,k int
    var a [2]int
    fmt.Scanf("%d\n", &t)
    for i=0;i<t;i++ {
        fmt.Scanf("%d\n", &n)
        a[0]=0
        a[1]=0
        for j=0;j<n;j++ {
            if j == n-1 {
                fmt.Scanf("%d\n", &k)
            } else {
                fmt.Scanf("%d", &k)
            }
            a[k-1]++
        }
//        fmt.Scanf("\n")
//        fmt.Println(a)
        if a[0]%2 != 0 {
            fmt.Println("NO")
        } else if a[1]%2 == 0 {
            fmt.Println("YES")
        } else if a[0]==0 {
            fmt.Println("NO")
        } else {
            fmt.Println("YES")
        }
    }
}

package main

import "fmt"

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

	for T > 0 {
		var n int
		var ans int
		fmt.Scan( &n)

		var flag bool
		flag = false
		for n > 0 {
			var num int
			n--
			if n == 0 {
				fmt.Scan(&num)
			} else {
				fmt.Scan(&num)
			}
			ans += num
			if num == 1 {
				flag = true
			}

		}

		if ans%4 == 0 || (ans%2 == 0 && flag) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
		T--

	}
}

package main

import "fmt"

func main() {
	var t,n int
	fmt.Scan(&t)
	for t>0 {
		fmt.Scan(&n)
		var a,b,k int64
		a=0;b=0
		for i:=0; i<n; i++ {
			fmt.Scan(&k)
			if k==1 {
				a++
			} else {
				b++
			}
		}
		k = a + 2*b
		if k % 2 == 0{
			if b % 2 == 0 || ( b % 2 != 0 && a != 0 ){
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		} else {
			fmt.Println("NO")
		}
		t--
	}
}

package main

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

func main() {
	var (
		t  int
		n  int
		a1 int
		a2 int
	)
	buffer := bufio.NewReader(os.Stdin)
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		a1, a2 = 0, 0
		ns, _, _ := buffer.ReadLine()
		n, _ = strconv.Atoi(string(ns))
		s, _, _ := buffer.ReadLine()
		for j := 0; j < 2*n-1; j++ {
			if s[j] == '1' {
				a1++
			}
			if s[j] == '2' {
				a2++
			}
		}
		if a1%2 == 1 {
			fmt.Println("NO")
		} else if a1%2 == 0 && a2%2 == 1 {
			if a1 == 0 {
				fmt.Println("NO")
			} else {
				fmt.Println("YES")
			}
		} else {
			fmt.Println("YES")
		}
	}
}

package main
import (
	"fmt"
)
func main() {
	var n,x,y int
	fmt.Scan(&n)
	for i:=0;i<n;i++{
		fmt.Scan(&x)
		var tally_1,tally_2 int
		for j:=0;j<x;j++{
			fmt.Scan(&y)
			if y == 1 {
				tally_1++
			} else {
				tally_2++
			}
		}
		if tally_1 % 2 != 0 {
			fmt.Println("NO")
		} else if tally_2 % 2 != 0 {
			if tally_1 == 0 {
				fmt.Println("NO")
			} else {
				fmt.Println("YES")
			}
		} else {
			fmt.Println("YES")
		}
	}
}

package main

import "fmt"

func main() {
	var n int32
	fmt.Scan(&n)
	for n > 0 {
		solve()
		n--
	}

}
func solve() {
	var (
		sum  int32
		n    int
		cnt1 int32
		cnt2 int32
	)
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var read int32
		fmt.Scan(&read)
		if read == 1 {
			cnt1++
		} else {
			cnt2++
		}
	}
	if (cnt1+2*cnt2)%2 != 0 {
		fmt.Println("NO")
	} else {
		sum = (cnt1 + 2*cnt2) / 2
		if sum%2 == 0 || (sum%2 == 1 && cnt1 != 0) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}

}

package main

import "fmt"

func main() {
	var n int32
	fmt.Scan(&n)
	for n > 0 {
		var m int32
		fmt.Scan(&m)
		a := make([]int32, m)
		for i := range a {
			fmt.Scan(&a[i])
		}
		fmt.Println(solve(a))
		n--
	}

}
func solve(a []int32) string {
	var sum int32 = 0
	for i := range a {
		sum += a[i]
	}
	if sum%2 != 0 {
		return "NO"
	}
	f := make([][]bool, len(a)+1)
	for i := range f {
		f[i] = make([]bool, sum/2+1)
	}
	f[0][0] = true
	for i := 1; i < len(f); i++ {
		for j := 0; j < len(f[i]); j++ {
			f[i][j] = f[i-1][j]
			if int32(j)-a[i-1] >= 0 {
				f[i][j] = f[i][j] || f[i-1][int32(j)-a[i-1]]
			}
		}
	}
	if f[len(f)-1][sum/2] == true {
		return "YES"
	}
	return "NO"
}

package main

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

func Solve() {
	n := ri()
	a := make([]int, 2)
	for i := 1; i <= n; i++ {
		a[ri()-1]++
	}
	for a[0] > 2 {
		a[0] -= 2
		a[1] += 2
	}
	switch {
	case a[0]%2 == 0 && a[1]%2 == 0:
		println("YES")
	case a[1]%2 == 1 && a[0] == 2:
		println("YES")
	default:
		println("NO")
	}
}

func main() {
	T := 0 // 如果是多组样例，请讲 T := 1 改为 T := 0
	in, out = bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	if T == 0 {
		scan(&T)
	}
	for t := 0; t < T; t++ {
		Solve()
	}
	out.Flush()
}

var in *bufio.Reader
var out *bufio.Writer

// ri 将直接读入并返回一个 int
func ri() (x int) {
	scan(&x)
	return x
}

// ri64 将直接读入并返回一个 int64
func ri64() (x int64) {
	scan(&x)
	return x
}

//rs 将直接读入并返回一个 string
func rs() (s string) {
	scan(&s)
	return s
}

//scan 用法与 fmt.scan() 相似，可以传入多个变量的地址进行读入操作
func scan(a ...interface{}) { Fscan(in, a...) }

//print 用法与 fmt.print() 相似，可以传入多个变量进行输出。
//注意，这个函数不会换行，多个变量之间有空格
func print(a ...interface{}) { Fprint(out, a...) }

//println 用法与 fmt.println() 相似，可以传入多个变量进行输出。
//这个函数会换行，多个变量之间有空格
func println(a ...interface{}) { Fprintln(out, a...) }

//min 可以传入多个 int 变量，求出这些变量的最小值
func min(a ...int) int {
	ans := a[0]
	for i := 1; i < len(a); i++ {
		if a[i] < ans {
			ans = a[i]
		}
	}
	return ans
}

//min64 可以传入多个 int64 变量，求出这些变量的最小值
func min64(a ...int64) int64 {
	ans := a[0]
	for i := 1; i < len(a); i++ {
		if a[i] < ans {
			ans = a[i]
		}
	}
	return ans
}

//max 可以传入多个 int 变量，求出这些变量的最大值
func max(a ...int) int {
	ans := a[0]
	for i := 1; i < len(a); i++ {
		if a[i] > ans {
			ans = a[i]
		}
	}
	return ans
}

//max64 可以传入多个 int64 变量，求出这些变量的最大值
func max64(a ...int64) int64 {
	ans := a[0]
	for i := 1; i < len(a); i++ {
		if a[i] > ans {
			ans = a[i]
		}
	}
	return ans
}

//sum 可以传入多个 int 变量，求出这些变量的总和，并返回总和。
//你可以使用 ... 运算符打散数组，使得 sum 函数可以求出数组的和。
func sum(a ...int) int {
	ans := 0
	for _, x := range a {
		ans += x
	}
	return ans
}

//sum64 可以传入多个 int64 变量，求出这些变量的总和，并返回总和。
//你可以使用 ... 运算符打散数组，使得 sum 函数可以求出数组的和。
func sum64(a ...int64) int64 {
	ans := int64(0)
	for _, x := range a {
		ans += x
	}
	return ans
}

//reverse 用于翻转 int 切片，所有元素将会变成原切片的倒序
func reverse(a []int) {
	for l, r := 0, len(a)-1; l < r; l, r = l+1, r-1 {
		a[l], a[r] = a[r], a[l]
	}
}

//reverse64 用于翻转 int64 切片，所有元素将会变成原切片的倒序
func reverse64(a []int64) {
	for l, r := 0, len(a)-1; l < r; l, r = l+1, r-1 {
		a[l], a[r] = a[r], a[l]
	}
}

//lowerBound 类似于 C++ 中的 lower_bound。
//用于二分查找 int 切片中，第一个大于等于 k 的元素在切片中的位置。
//如果元素不存在，则返回切片的长度。
//注意，lowerBound 作用的 int 切片必须升序。
func lowerBound(a []int, k int) int {
	l, r, pos := 0, len(a)-1, len(a)
	for l <= r {
		mid := (l + r) >> 1
		if a[mid] < k {
			l = mid + 1
		} else {
			pos, r = mid, mid-1
		}
	}
	return pos
}

//lowerBound64 类似于 C++ 中的 lower_bound。
//用于二分查找 int64 切片中，第一个大于等于 k 的元素在切片中的位置。
//如果元素不存在，则返回切片的长度。
//注意，lowerBound 作用的 int64 切片必须升序。
func lowerBound64(a []int64, k int64) int {
	l, r, pos := 0, len(a)-1, len(a)
	for l <= r {
		mid := (l + r) >> 1
		if a[mid] < k {
			l = mid + 1
		} else {
			pos, r = mid, mid-1
		}
	}
	return pos
}

//upperBound 类似于 C++ 中的 upper_bound。
//用于二分查找 int 切片中，第一个大于 k 的元素在切片中的位置。
//如果元素不存在，则返回切片的长度。
//注意，upperBound 作用的 int 切片必须升序。
func upperBound(a []int, k int) int {
	l, r, pos := 0, len(a)-1, len(a)
	for l <= r {
		mid := (l + r) >> 1
		if a[mid] <= k {
			l = mid + 1
		} else {
			pos, r = mid, mid-1
		}
	}
	return pos
}

//upperBound64 类似于 C++ 中的 upper_bound。
//用于二分查找 int64 切片中，第一个大于 k 的元素在切片中的位置。
//如果元素不存在，则返回切片的长度。
//注意，upperBound 作用的 int64 切片必须升序。
func upperBound64(a []int64, k int64) int {
	l, r, pos := 0, len(a)-1, len(a)
	for l <= r {
		mid := (l + r) >> 1
		if a[mid] <= k {
			l = mid + 1
		} else {
			pos, r = mid, mid-1
		}
	}
	return pos
}

type Stack struct {
	s []int
}

func (st *Stack) top() int   { return st.s[len(st.s)-1] }
func (st *Stack) size() int  { return len(st.s) }
func (st *Stack) pop()       { st.s = st.s[:len(st.s)-1] }
func (st *Stack) push(x int) { st.s = append(st.s, x) }

type Queue struct {
	que chan int
}

func MakeQueue(size int) Queue {
	var q Queue
	q.que = make(chan int, size)
	return q
}

package main
import (
"bufio"
"fmt"
"os"
)
var reader *bufio.Reader=bufio.NewReader(os.Stdin)
var writer *bufio.Writer=bufio.NewWriter(os.Stdout)
func scanf(f string,a ...interface{}) { fmt.Fscanf(reader,f,a...) }
func printf(f string,a ...interface{}) { fmt.Fprintf(writer,f,a...) }
func main(){
defer writer.Flush()
var t int
scanf("%d\n",&t)
for tt:=0;tt<t;tt++ {
var n int
scanf("%d\n",&n)
oc:=0
tc:=0
var x int
for i:=0;i<n;i++ {
scanf("%d",&x)
if x==1 {
oc++
} else {
tc++
}
}
scanf("\n")
if tc%2!=0 && oc>=2 {
oc=oc-2
tc--
}
if oc%2==0 && tc%2==0 {
printf("YES\n")
} else {
printf("NO\n")
}
}
}

package main

import (
	"fmt"
)

func solve() {
	var n int
	fmt.Scan(&n)
	nums := readIntN(n)
	s := sum(nums)
	if s%2 == 0 && (n%2 == 0 || (n%2 == 1 && s != n*2)) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

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

func readIntN(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&arr[i])
	}
	return arr
}

func readIntNN(n, m int) [][]int {
	arr := make([][]int, n)
	for i := 0; i < n; i++ {
		arr[i] = readIntN(m)
	}
	return arr
}

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

func minMax(a ...int) (min int, max int) {
	min, max = a[0], a[0]
	for _, v := range a {
		if v < min {
			min = v
		}
		if v > max {
			max = v
		}
	}
	return
}

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

func avg(x ...int) int {
	var sum int
	for _, v := range x {
		sum += v
	}
	return sum / len(x)
}

func sum(x []int) int {
	var sum int
	for _, v := range x {
		sum += v
	}
	return sum
}

package main

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

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 print(a ...interface{})            { fmt.Fprint(writer, a...) }
func scan(a ...interface{})             { fmt.Fscan(reader, a...) }

func main() {
	defer writer.Flush()
	////////////////////
	var count int
	scan(&count)
	for count != 0 {
		solve()
		count--
	}

}

func solve() {
	c := 0
	a := 0
	b := 0
	scan(&c)
	m := make([]int, c)
	for i := 0; i < c; i++ {
		scan(&m[i])
	}
	sort.Ints(m)

	for i := c - 1; i >= 0; i-- {
		if a < b {
			a += m[i]
		} else {
			b += m[i]
		}
	}
	if a == b {
		print("Yes", "\n")
		return
	}
	print("No", "\n")
}

package main

import "fmt"

func main() {
	var setNum uint16
	fmt.Scan(&setNum)
	var weight uint8
	var amount uint8
	var oneGram uint8 = 0
	var twoGram uint8 = 0
	var res []string
	for i := setNum; i > 0; i-- {
		fmt.Scan(&amount)
		for j := amount; j > 0; j-- {
			fmt.Scan(&weight)
			if weight == 1 {
				oneGram++
			} else {
				twoGram++
			}
		}

		if oneGram%2 == 0 && twoGram%2 == 0 {
			res = append(res, "YES")
		} else if (oneGram == 0 || twoGram == 0) && amount%2 == 0 {
			res = append(res, "YES")
		} else if oneGram == twoGram && amount%4 == 0 {
			res = append(res, "YES")
		} else if oneGram%2 == 0 && twoGram%2 == 1 && oneGram != 0 {
			res = append(res, "YES")
		} else {
			res = append(res, "NO")
		}

		oneGram, twoGram = 0, 0
	}

	for _, val := range res {
		fmt.Println(val)
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var T, n1, n2, sum, num, this int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &num)
		for i := 0; i < num; i++ {
			Fscan(in, &this)
			if this == 1 {
				n1++
				sum += this
			} else {
				n2++
				sum += this
			}
		}
		if n1%2 != 0 {
			Fprintln(out, "NO")
		} else {
			if n2%2 != 0 {
				if n1 != 0 {
					Fprintln(out, "YES")
				} else {
					Fprintln(out, "NO")
				}
			} else {
				Fprintln(out, "YES")
			}
		}
		n1, n2, sum = 0, 0, 0
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	var n int
	arr := make([]int, 100)
	fmt.Scan(&t)
	for t > 0 {
		t--
		fmt.Scan(&n)
		even, odd := 0, 0
		for i := 0; i < n; i++ {
			fmt.Scan(&arr[i])
			if arr[i] % 2 == 0 {
				even++
			} else {
				odd++
			}
		}
		if odd % 2 == 1 {
			fmt.Printf("NO\n")
			continue
		}
		if even % 2 == 0 || odd > 1 {
			fmt.Printf("YES\n")
			continue
		}
		fmt.Printf("NO\n")
	}
}

package main

import (
  "fmt"
)

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

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

    o := 0
    t := 0
    for j:=0; j<c; j++ {
      var temp int
      fmt.Scan(&temp)
      if(temp == 1) {
        o++
      } else {
        t++
      }
    }

    if t % 2 != 0 {
      if(o < 2) { fmt.Println("NO"); continue }
    }

    if o % 2 == 0 {
      fmt.Println("YES")
    } else {
      fmt.Println("NO")
    }
  }
}

package main

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

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

	cc, _, _ := reader.ReadLine()

	//fmt.Println(cc)
	count, err := strconv.ParseInt(strings.Trim(string(cc), "\n"), 10, 64)
	if err != nil {
		os.Exit(-3)
	}

	for i := 0; i < int(count); i++ {
		_, _, _ = reader.ReadLine()
		//fmt.Println("Read:", v)
		//newCount, _ := strconv.ParseUint(strings.Trim(string(v), "\n"), 10, 64)

		cardV, _, _ := reader.ReadLine()
		var a uint64 = 0
		var b uint64 = 0
		cardList := strings.Split(string(cardV), " ")

		sort.Slice(cardList, func(i, j int) bool {
			return cardList[i] > cardList[j]
		})
		if len(cardList) < 2 {
			_, _ = os.Stdout.WriteString("no\n")
			continue
		}
		//sp:=len(cardList)-2
		//last := cardList[sp:]
		//first := cardList[:sp]
		//fmt.Println("ALLST",cardList)
		//fmt.Println("FIRST",first)
		//fmt.Println("LASTT",last)
		for _, card := range cardList {
			c, _ := strconv.ParseUint(card, 10, 64)
			if a < b {
				a += c
			} else {
				b += c
			}
		}

		//la, _ := strconv.ParseUint(last[0], 10, 64)
		//lb, _ := strconv.ParseUint(last[1], 10, 64)

		if a==b{
			_, _ = os.Stdout.WriteString("yes\n")
		} else {
			_, _ = os.Stdout.WriteString("no\n")
		}

	}

}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)

// var file, _ = os.Open("input")
// var reader *bufio.Reader = bufio.NewReader(file)
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 main() {
	var t int
	scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		var n int
		scanf("%d\n", &n)
		fmt.Println(process(reader, n))
	}
}

func process(reader *bufio.Reader, n int) string {
	isHave1 := false
	arr := make([]int, n)
	sum := 0
	for i := 0; i < n; i++ {
		if i != n-1 {
			scanf("%d", &arr[i])
		} else {
			scanf("%d\n", &arr[i])
		}
		sum += arr[i]
	}
	if sum%2 != 0 {
		return "NO"
	}
	target1 := sum / 2
	target2 := (sum / 2) + 1
	sum = 0
	isTar1 := false
	isTar2 := false
	for i := 0; i < n; i++ {
		sum += arr[i]
		if sum == target1 {
			isTar1 = true
		}
		if sum == target2 {
			isTar2 = true
		}
		if arr[i] == 1 {
			isHave1 = true
		}
	}
	if isTar1 {
		return "YES"
	}
	if isTar2 && isHave1 {
		return "YES"
	}
	return "NO"
}

package main

import "fmt"

func main() {
	var totalTests int
	_, _ = fmt.Scanf("%d\n", &totalTests)
	for i := 0; i < totalTests; i ++ {
		var n int
		count1, count2 := 0, 0
		_, _ = fmt.Scanf("%d\n", &n)
		for j := 0; j < n; j ++ {
			var candy int
			if j == n - 1 {
				_, _ = fmt.Scanf("%d\n", &candy)
			}else {
				_, _ = fmt.Scanf("%d", &candy)
			}
			if candy == 2 {
				count2 ++
			} else {
				count1 ++
			}
		}
		//fmt.Printf("%d %d ", count1, count2)

		if count1 % 2 == 1 {
			fmt.Printf("NO\n")
			continue
		}
		if count2 % 2 == 1 && count1 == 0 {
			fmt.Printf("NO\n")
			continue
		}

		fmt.Printf("YES\n")
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)
var (
    input = bufio.NewReader(os.Stdin)
    output = bufio.NewWriter(os.Stdout)
)

func assert(test bool) {
    if !test {panic("assertion!")}
}

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
func main() {
    var t int
	fmt.Fscan(input, &t)
    for t > 0 {
        t--
        solve()
    }
    output.Flush()
}

func solve() {
    var n, o, t int
    fmt.Fscan(input, &n)
    for i := 0; i < n; i++ {
        var tmp int
        fmt.Fscan(input, &tmp)
        if tmp == 1 {
            o++
        } else {
            t++
        }
    }
    t %= 2
    if o & 1 == 1 || o < t*2  {
        fmt.Fprintln(output, "No")
    } else {
        fmt.Fprintln(output, "Yes")
    }
}

package main

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

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

	var n, t, candy int
	for fmt.Fscan(r, &t); t > 0; t-- {
		n1 := 0
		n2 := 0
		for fmt.Fscan(r, &n); n > 0; n-- {
			fmt.Fscan(r, &candy)
			switch candy {
			case 1:
				n1++
			default:
				n2++
			}
		}
		//if n1 != 0 && n1%2 == 0 {
		//	fmt.Fprintln(w, "YES")
		//}
		if n1 > 0 {
			if n1%2 == 0 {
				fmt.Fprintln(w, "YES")
			} else {
				fmt.Fprintln(w, "NO")
			}
		} else {
			if n2%2 == 0 {
				fmt.Fprintln(w, "YES")
			} else {
				fmt.Fprintln(w, "NO")
			}
		}
	}
}

package main

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

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

	var t int;

	fmt.Fscan(reader, &t);

    var n, a int;

    var c [2]int;

    for i := 0; i < t; i++ {
        fmt.Fscan(reader, &n);

        c[0] = 0;
        c[1] = 0;

        for j := 0; j < n; j++ {
            fmt.Fscan(reader, &a);

            c[a - 1]++;
        }

        c[1] %= 2;

        c[0] -= (c[1] * 2);

        if (c[0] >= 0 && c[0] % 2 == 0) {
            fmt.Println("YES");
        } else {
            fmt.Println("NO");
        }
    }
}

package main

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

func main() {
	var n, t, w int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &n)
		sum := 0
		count2 := 0
		for j := 0; j < n; j++ {
			fmt.Fscan(in, &w)
			sum += w
			if w%2 == 0 {
				count2++
			}
		}
		if sum%2 == 0 {
			if count2%2 == 0 || count2 != n {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

func main() {

	bf := bufio.NewReader(os.Stdin)
	ln, _ := bf.ReadString('\n')
	n, _ := strconv.ParseInt(ln[:len(ln)-2], 10 , 32)
	for ; n > 0; n-- {
		ln, _ = bf.ReadString('\n')
		t, _ := strconv.ParseInt(ln[:len(ln)-2], 10 , 32)
		ln, _ = bf.ReadString('\n')
		values := strings.Split(ln[:len(ln)-2], " ")
		one, two := 0, 0
		for i:=0; t > 0; t--{
			num, _:= strconv.Atoi(values[i] )
			if num == 1 {
				one+= 1
			} else {
				two+= 1
			}
			i++
		}

		alice, bob := 0, 0

		for two > 0 {
			if alice <= bob {
				alice += 2
			} else {
				bob += 2
			}
			two--
		}

		for one > 0 {
			if alice <= bob {
				alice += 1
			} else {
				bob += 1
			}
			one--
		}

		if alice == bob {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}

	}

}

package main

// https://codeforces.com/problemset/problem/1472/B

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

func main() {

	buf := make([]byte, 0, 1000000)

	reader := bufio.NewScanner(os.Stdin)
	// lielaks buferis
	reader.Buffer(buf, 1000000)
	reader.Scan()

	//	m := reader.Text()

	for reader.Scan() {
		reader.Scan()
		queryLine := reader.Text()

		query := strings.Split(queryLine, " ")
		total1 := 0
		total2 := 0

		for _, candy := range query {

			i, _ := strconv.Atoi(string(candy))

			if i == 1 {
				total1++
			}
			if i == 2 {
				total2++
			}

		}

		if total1 == 0 {
			if total2%2 == 0 {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		} else {
			if total1%2 == 1 {
				fmt.Println("NO")
			} else {
				fmt.Println("YES")
			}
		}

		//		fmt.Println(total1, " : ", total2)
	}

}

package main

import "fmt"

func main() {
	var (
		n        int
		i        int
		k        int
		j        int
		weigh    int
		mapWeigh = map[int]int{1: 0, 2: 0}
	)

	fmt.Scan(&n)
	for i = 0; i < n; i++ {
		fmt.Scan(&k)
		mapWeigh[1] = 0
		mapWeigh[2] = 0
		for j = 0; j < k; j++ {
			fmt.Scan(&weigh)
			mapWeigh[weigh]++
		}
		if mapWeigh[1]%2 == 0 && mapWeigh[1] >= 2 || mapWeigh[2]%2 == 0 && mapWeigh[1]%2 == 0 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
	t   int16
	n   int8
)

func main() {
	defer out.Flush()

	fmt.Fscan(in, &t)

	for ; t > 0; t-- {

		fmt.Fscan(in, &n)

		a := make([]int16, n)

		one := int8(0)

		for i := range a {
			fmt.Fscan(in, &a[i])
			if a[i] == 1 {
				one++
			}
		}

		if n == 1 {
			fmt.Fprintln(out, "NO")
			continue
		}

		if one%2 == 1 {
			fmt.Fprintln(out, "NO")
			continue
		}

		two := n - one

		if two%2 == 0 {
			fmt.Fprintln(out, "YES")
			continue
		}

		if one >= 2 {
			fmt.Fprintln(out, "YES")
			continue
		}

		fmt.Fprintln(out, "NO")

	}
}

package main

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

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(input, &t)

	for o := 0; o < t; o++ {
		var n int
		fmt.Fscan(input, &n)
		Array := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(input, &Array[i])
		}
		Ones := 0
		TWos := 0
		for j := 0; j < len(Array); j++ {
			if Array[j] == 1 {
				Ones = Ones + 1
			}
			if Array[j] == 2 {
				TWos = TWos + 1
			}
		}
		if Ones%2 == 1 {
			fmt.Println("NO")
		} else {
			if TWos%2 == 0 {
				fmt.Println("YES")
			} else {
				if Ones > 0 {
					fmt.Println("YES")
				} else {
					fmt.Println("NO")
				}
			}
		}

	}
}

// 1472B. Fair Division
package main

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

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n, curr int
		fmt.Fscan(reader, &n)
		ones := 0
		twos := 0
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &curr)
			if curr == 1 {
				ones++
			} else {
				twos++
			}
		}
		if ones%2 == 1 {
			fmt.Println("NO")
		} else if ones == 0 && twos%2 == 1 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}
}

package main

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

var sc = bufio.NewScanner(os.Stdin)

func scan() string {
	for sc.Scan() {
		break
	}
	return sc.Text()
}

func scanInt() int {
	i, err := strconv.Atoi(scan())
	if err != nil {
		panic(err)
	}
	return i
}

func scanInt8() int8 {
	i, err := strconv.ParseInt(scan(), 10, 8)
	if err != nil {
		panic(err)
	}
	return int8(i)
}

func scanInt64() int64 {
	i, err := strconv.ParseInt(scan(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

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

func min(ints ...int) int {
	a := ints[0]
	n := len(ints)
	for i := 1; i < n; i++ {
		if ints[i] < a {
			a = ints[i]
		}
	}
	return a
}

func max(ints ...int) int {
	a := ints[0]
	n := len(ints)
	for i := 1; i < n; i++ {
		if ints[i] > a {
			a = ints[i]
		}
	}
	return a
}

type Noop struct{}

var noop = Noop{}

func proc() {
	n := scanInt()
	var x, a, b int
	for i := 0; i < n; i++ {
		x = scanInt()
		if x == 1 {
			a++
		} else {
			b++
		}
	}
	sum := a + b + b
	if sum%2 == 1 {
		fmt.Println("NO")
		return
	}
	if a > 0 || b%2 == 0 {
		fmt.Println("YES")
		return
	}
	fmt.Println("NO")
}

func main() {
	sc.Split(bufio.ScanWords)
	t := scanInt()
	for i := 0; i < t; i++ {
		proc()
	}
}

package main

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

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

func solve(n int, a []int) string {
	sum, n1 := 0, 0
	for _, x := range a {
		sum += x
		if x == 1 {
			n1++
		}
	}
	if sum%2 == 1 {
		return "NO"
	}
	if sum%4 == 2 && n1 == 0 {
		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"
)

func countNumber(n int32, arr []int32, search int32) int32 {
	count := int32(0)
	for i := int32(0); i < n; i++ {
		if arr[i] == search {
			count++
		}
	}
	return count
}

func solve(n int32, candies []int32) string {
	countOf1 := countNumber(n, candies, 1)
	countOf2 := countNumber(n, candies, 2)
	if countOf2%2 == 1 {
		countOf1 -= 2
	}
	if countOf1 < 0 || countOf1%2 == 1 {
		return "NO"
	} else {
		return "YES"
	}
}

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

	tt := int32(0)
	fmt.Fscanf(in, "%d\n", &tt)
	for tt > 0 {
		n := int32(0)
		m := int32(0)
		arr := []int32{}

		fmt.Fscanf(in, "%d\n", &n)
		for i := int32(0); i < n; i++ {
			if i > 0 {
				fmt.Fscanf(in, " ")
			}
			fmt.Fscanf(in, "%d", &m)
			arr = append(arr, m)
		}
		fmt.Fscanf(in, "\n")
		fmt.Fprintf(out, "%s\n", solve(n, arr))
		tt--
	}
	out.Flush()
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	for n != 0 {
		m := [2]int{0, 0}
		var a, b int
		fmt.Scan(&a)
		for a != 0 {
			fmt.Scan(&b)
			if b == 2 {
				m[1]++
			} else {
				m[0]++
			}
			a--
		}
		if m[1]%2 == 0 {
			if m[0]%2 == 0 {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		} else {
			if m[0] > 1 && m[0]%2 == 0 {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		}
		n--
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	var n int
	arr := make([]int, 100)
	fmt.Scan(&t)
	for t > 0 {
		t--
		fmt.Scan(&n)
		even, odd := 0, 0
		for i := 0; i < n; i++ {
			fmt.Scan(&arr[i])
			if arr[i] % 2 == 0 {
				even++
			} else {
				odd++
			}
		}
		if odd % 2 == 1 {
			fmt.Printf("NO\n")
			continue
		}
		if even % 2 == 0 || odd > 1 {
			fmt.Printf("YES\n")
			continue
		}
		fmt.Printf("NO\n")
	}
}

package main

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

var bytes []byte

func nextByte() byte {
	b := bytes[0]
	bytes = bytes[1:]
	return b
}

func scanInt64() int64 {
	var negative bool
	var result int64

	b := nextByte()

	for ; b < '0' || b > '9'; b = nextByte() {
		if b == '-' {
			negative = true
		}
	}

	for ; '0' <= b && b <= '9'; b = nextByte() {
		result = (result << 3) + (result << 1) + int64(b-'0')
	}

	if negative {
		return -result
	} else {
		return result
	}
}

func scanInt() int {
	return int(scanInt64())
}

func scanString() string {
	builder := strings.Builder{}

	for b := nextByte(); b != '\r'; b = nextByte() {
		if b != '\n' {
			builder.WriteByte(b)
		}
	}

	return builder.String()
}

func init() {
	f, err := os.Open("in.txt")

	if err == nil {
		defer f.Close()
	} else {
		f = os.Stdin
	}

	bytes, _ = ioutil.ReadAll(bufio.NewReader(f))
}

func main() {
	for t := scanInt(); t > 0; t-- {
		n := scanInt()
		a := make([]int, n)

		sum := 0
		hasOdd := false

		for i := 0; i < n; i++ {
			a[i] = scanInt()
			sum += a[i]

			if a[i]%2 == 1 {
				hasOdd = true
			}
		}

		switch {
		case n%2 == 0 && sum%2 == 0:
			fmt.Println("YES")
		case n%2 == 1 && sum%2 == 0 && hasOdd:
			fmt.Println("YES")
		default:
			fmt.Println("NO")
		}
	}
}

package main

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

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

func scan(a ...interface{}) (n int, err error)             { return fmt.Fscan(in, a...) }
func scanf(f string, a ...interface{}) (n int, err error)  { return fmt.Fscanf(in, f, a...) }
func printf(f string, a ...interface{}) (n int, err error) { return fmt.Fprintf(out, f, a...) }

//https://codeforces.com/problemset/problem/1472/B

func main() {
	defer out.Flush()

	var n int
	scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		var m, a, cnt1, cnt2 int
		scanf("%d\n", &m)
		for j := 0; j < m; j++ {
			scan(&a)
			if a == 1 {
				cnt1++
			} else {
				cnt2++
			}
			if j == m-1 {
				scanf("\n")
			}
		}
		if cnt1&1 == 1 || ((cnt2&1 == 1) && cnt1 < 2) {
			printf("NO\n")
		} else {
			printf("YES\n")
		}
	}
}

// Written by : Syed Mujtaba
// Seek knowledge from the cradle to the grave
package main

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

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 Abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}

func main() {
	defer writer.Flush()

	var t int
	fmt.Scanf("%d\n", &t)
	for T := 0; T < t; T++ {
		var n int
		scanf("%d\n", &n)
		x := 0
		a := 0
		b := 0
		for i := 0; i < n; i++ {
			scanf("%d", &x)
			if x == 1 {
				a++
			} else {
				b++
			}
			if i < n-1 {
				scanf(" ")
			} else {
				scanf("\n")
			}
		}
		var flag bool = false
		for i := 0; i <= a; i++ {
			if n+b-2*i >= 0 && (n+b-2*i)%4 == 0 {
				flag = true
				break
			}
		}
		if flag == true {
			printf("YES\n")
		} else {
			printf("NO\n")
		}
	}
}

package main

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

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

func init() {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1e6), 1e6)
}

func printf(f string, a ...interface{}) {
	fmt.Fprintf(writer, f, a...)
}

func sint64() int64 {
	scanner.Scan()
	bb := scanner.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func suint64() uint64 {
	scanner.Scan()
	bb := scanner.Bytes()
	i := uint64(0)
	for _, b := range bb {
		i *= 10
		i += uint64(b - '0')
	}
	return i
}

func sstring() string {
	scanner.Scan()
	return scanner.Text()
}

func sbytes() []byte {
	scanner.Scan()
	return scanner.Bytes()
}

func main() {
	defer writer.Flush()
	for t := sint64(); t > 0; t-- {
		c1 := int64(0)
		c2 := int64(0)
		for n := sint64(); n > 0; n-- {
			num := sint64()
			if num == 1 {
				c1++
			} else {
				c2++
			}
		}
		printf("%s\n", sol(c1, c2))
	}
}

func sol(c1, c2 int64) string {
	if (c1 == 0 && c2&1 == 1) || (c1&1 == 1) {
		return "NO"
	}
	return "YES"
}

package main

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

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

func scanf(f string, a ...interface{}) {
	fmt.Fscanf(reader, f, a...)
}

func printf(f string, a ...interface{}) {
	fmt.Fprintf(writer, f, a...)
}

func isEven(x int) bool {
	return x%2 == 0
}

func solve() {
	var n int
	scanf("%d\n", &n)

	a := make([]int, n)
	for i := 0; i < n; i++ {
		if i+1 != n {
			scanf("%d ", &a[i])
		} else {
			scanf("%d\n", &a[i])
		}
	}

	numOf1 := 0
	numOf2 := 0

	for _, x := range a {
		if x == 1 {
			numOf1++
		} else {
			numOf2++
		}
	}

	if isEven(numOf2) && isEven(numOf1) {
		printf("YES\n")
	} else if !isEven(numOf2) && numOf1 > 1 && isEven(numOf1-2) {
		printf("YES\n")
	} else {
		printf("NO\n")
	}
}

func main() {
	defer writer.Flush()
	tt := 1
	scanf("%d\n", &tt)

	for tt > 0 {
		solve()
		tt--
	}
}

package main

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

func main() {
	t := ReadInt()
	for i := 0; i < t; i++ {
		size := ReadInt()
		weights := ReadIntSliceln(size)
		fmt.Println(process(weights))
	}
}

func process(w []int) string {
	Ones, Twos := 0, 0
	for i := 0; i < len(w); i++ {
		if w[i] == 1 {
			Ones++
		}
		if w[i] == 2 {
			Twos++
		}
	}
	//fmt.Println("Ones and Twos", Ones, Twos)
	if isOdd(Twos) {
		if isOdd(Ones) {
			return "NO"
		}
		if Ones >= 2 {
			return "YES"
		}
	} else {
		if !isOdd(Ones) {
			return "YES"
		}
	}
	return "NO"
}

func isOdd(i int) bool {
	if i&1 != 0 {
		return true
	}
	return false
}

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

// ReadInt Read a single integer followed by a space
func ReadInt() (v int) {
	fmt.Fscan(reader, &v)
	return v
}

// ReadIntSliceln reads a line of integers into a slice.
func ReadIntSliceln(size int) []int {
	a := make([]int, size)
	for i := range a {
		fmt.Fscan(reader, &a[i])
	}
	//fmt.Scanf("\n")
	return a
}

package main

import "fmt"

func main() {
	test := 0
	fmt.Scan(&test)
	for tt := 0; tt < test; tt++ {
		n := 0
		fmt.Scan(&n)
		t := 0
		o := 0
		for i := 0; i < n; i++ {
			e := 0
			fmt.Scan(&e)

			if e == 2 {
				t++
			} else {
				o++
			}
		}

		if o%2 == 1 {
			fmt.Println("NO")
		} else if t%2 == 0 {
			fmt.Println("YES")
		} else if t%2 == 1 && o >= 2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}

}

package main

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

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 main() {
	var t int
	scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		solve()
	}
}
func solve() {
	var n int
	scanf("%d\n", &n)
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		scanf("%d ", &arr[i])
	}
	scanf("%d\n")
	s := 0
	for i := 0; i < len(arr); i++ {
		s += arr[i]
	}
	if s%2 != 0 {
		fmt.Println("NO")
	} else {
		t := s / 2
		ans := subset2(arr, t)
		if ans == true {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}
func subset2(arr []int, sum int) bool {
	matrix := [][]bool{}
	for i := 0; i <= len(arr); i++ {
		temp := make([]bool, sum+1)
		matrix = append(matrix, temp)
	}

	for i := 0; i < len(matrix); i++ {
		for j := 0; j <= sum; j++ {
			if j == 0 {
				matrix[i][j] = true
			} else if i == 0 {
				matrix[i][j] = false
			} else if j >= arr[i-1] {
				matrix[i][j] = matrix[i-1][j-arr[i-1]] || matrix[i-1][j]
			} else {
				matrix[i][j] = matrix[i-1][j]
			}
		}
	}
	return matrix[len(arr)][sum]
}

package main

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

func main() {
	sc := NewScanner()
	t := sc.NextInt()
	for i := 0; i < t; i++ {
		_ = sc.NextInt()
		a := sc.NextMap()
		fmt.Println(solve(a))
	}

}

func solve(a map[int]int) string {
	if a[1]%2 == 0 && a[2]%2 == 0 {
		return "YES"
	} else if a[1]%2 == 0 && a[2]%2 == 1 {
		if a[1] > 1 {
			return "YES"
		}
		return "NO"
	}
	return "NO"
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]int {
	s.pre()
	start := s.p
	mp := map[int]int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v]++
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v]++

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

package main

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

func main() {
	defer _w.Flush()
	t := ReadInt()
	for i := 0; i < t; i++ {
		n := ReadInt()
		if solve(ReadInts(n)) {
			println("YES")
		} else {
			println("NO")
		}
	}
}

func solve(a []int) bool {
	var odds, evens int
	for _, v := range a {
		if v == 1 {
			odds++
		} else {
			evens++
		}
	}

	if odds%2 == 1 {
		return false
	}

	if odds%2 == 0 && evens%2 == 0 {
		return true
	}

	if evens%2 == 1 && odds%2 == 0 && odds > 0 {
		return true
	}
	return false
}

var _r, _w = bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)

func print(a ...interface{})            { fmt.Fprint(_w, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(_w, f, a...) }
func println(a ...interface{})          { fmt.Fprintln(_w, a...) }
func printInts(a ...int)                { s := fmt.Sprint(a); println(s[1 : len(s)-1]) }
func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(_r, a...); err != nil {
		panic(err)
	}
}
func ReadString() (s string) { Scan(&s); return }
func ReadInt() (i int)       { Scan(&i); return }
func ReadInts(n int) (a []int) {
	for i := 0; i < n; i++ {
		a = append(a, ReadInt())
	}
	return
}
func ReadInt64() (i int64) { Scan(&i); return }
func ReadInt64s(n int) (a []int64) {
	for i := 0; i < n; i++ {
		a = append(a, ReadInt64())
	}
	return
}

package main

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

func main () {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t,n, a int
	Fscan(in, &t)
	for tt := 0; tt < t ; tt++ {
		Fscan(in, &n)
		p := make([]int, 2)
		for i := 0; i<n; i++ {
			Fscan(in, &a)
			if a == 1 {
				p[0]++
			} else {
				p[1]++
			}
		}
		ok := false

		if p[0] %2 == 0 {
			if p[0] >0 || p[1] %2 == 0 {
				ok = true
			}
		}

		ans := "NO\n"
		if ok {
			ans = "YES\n"
		}
		out.WriteString(ans)
	}
}

package main

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

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)

	fmt.Fscan(input, &t)

	for o := 0; o < t; o++ {
		var n int
		fmt.Fscan(input, &n)

		var one, two int
		for i := 0; i < n; i++ {
			var a int
			fmt.Fscan(input, &a)

			if a == 1 {
				one++
			} else {
				two++
			}
		}

		ok := false
		if two%2 == 0 {
			ok = true
		}

		if ok == true {
			if one%2 == 0 {
				ok = true
			} else {
				ok = false
			}
		} else {
			if (one-2) >= 0 && (one-2)%2 == 0 {
				ok = true
			} else {
				ok = false
			}
		}

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

package main

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

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

	solve := func(Case int) bool {
		var n int
		Fscan(in, &n)
		a := make([]int, n)
		s := 0
		c1,c2 := 0,0
		for i := range a {
			Fscan(in, &a[i])
			s+=a[i]
			if a[i]==1 {
				c1++
			} else {
				c2++
			}
		}

		if s&1==1 {
			return false
		}
		s/=2
		for i := 0; i <= c2; i++ {
			need := s-2*i
			if need < 0 {
				break
			}
			if need <= c1 {
				return true
			}
		}
		return false
	}

	var t int
	Fscan(in, &t)
	for Case := 1; Case <= t; Case++ {
		Fprintln(out, map[bool]string{true: "YES", false: "NO"}[solve(Case)])
	}

	_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"
)

var reader = bufio.NewReader(os.Stdin)
var 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 main() {
	defer writer.Flush()

	var t, n, x int
	var arr [3]int

	scanf("%d\n", &t)

	for i := 0; i < t; i++ {
		scanf("%d\n", &n)
		for j := 0; j < n; j++ {
			scanf("%d", &x)
			arr[x]++
		}
		scanf("\n")
		if (arr[1]+2*arr[2])%2 != 0 {
			printf("NO\n")
		} else if (arr[1]%2 == 0) && (arr[2]%2 == 0) {
			printf("YES\n")
		} else {
			p := (arr[1] + 2*arr[2]) / 2
			if p%2 == 0 {
				printf("YES\n")
			} else {
				arr[2] -= (p - 1) / 2
				arr[1] -= 1
				if arr[1] >= 0 && arr[2] >= 0 && (arr[1]+2*arr[2] == p) {
					printf("YES\n")
				} else {
					printf("NO\n")
				}
			}
		}
		arr[1] = 0
		arr[2] = 0
	}
}

package main

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

var reader = bufio.NewReader(os.Stdin)
var 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 main() {
	defer writer.Flush()

	var t, n, x int
	var arr [3]int

	scanf("%d\n", &t)

	for i := 0; i < t; i++ {
		scanf("%d\n", &n)
		for j := 0; j < n; j++ {
			scanf("%d", &x)
			arr[x]++
		}
		scanf("\n")
		if arr[1]%2 != 0 {
			printf("NO\n")
		} else if (arr[1]%2==0) && (arr[2]%2==0) {
			printf("YES\n")
		} else {
			p := (arr[1] + 2*arr[2]) / 2
			if p%2 == 0 {
				printf("YES\n")
			} else {
				arr[2] -= (p - 1) / 2
				arr[1] -= 1
				if arr[1] >= 0 && arr[2] >= 0 && (arr[1] + 2*arr[2] == p) {
					printf("YES\n")
				} else {
					printf("NO\n")
				}
			}
		}
		arr[1] = 0
		arr[2] = 0
	}
}

package main

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

var reader = bufio.NewReader(os.Stdin)
var 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 main() {
	defer writer.Flush()

	var t, n, x int
	var arr [3]int

	scanf("%d\n", &t)

	for i := 0; i < t; i++ {
		scanf("%d\n", &n)
		for j := 0; j < n; j++ {
			scanf("%d", &x)
			arr[x]++
		}
		scanf("\n")
		if arr[1]%2 != 0 {
			printf("NO\n")
		} else {
			p := (arr[1] + 2*arr[2]) / 2
			if p%2 == 0 {
				printf("YES\n")
			} else {
				arr[2] -= (p - 1) / 2
				arr[1] -= 1
				if arr[1] < 0 || arr[2] < 0 || (arr[1] + 2*arr[2] != p) {
					printf("NO\n")
				} else {
					printf("YES\n")
				}
			}
		}
		arr[1] = 0
		arr[2] = 0
	}
}

package main

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

var reader = bufio.NewReader(os.Stdin)
var 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 main() {
	defer writer.Flush()

	var t, n, x int
	var arr [3]int

	scanf("%d\n", &t)

	for i := 0; i < t; i++ {
		scanf("%d\n", &n)
		for j := 0; j < n; j++ {
			scanf("%d", &x)
			arr[x]++
		}
		scanf("\n")
		if arr[1]%2 != 0 {
			printf("NO\n")
		} else {
			p := (arr[1] + 2*arr[2]) / 2
			if p%2 == 0 {
				printf("YES\n")
			} else {
				arr[2] -= (p - 1) / 2
				arr[1] -= 1
				if arr[2] < 0 || arr[1] < 0 || (arr[1] + 2*arr[2]) != p {
					printf("NO\n")
				} else {
					printf("YES\n")
				}
			}
		}
		arr[1] = 0
		arr[2] = 0
	}
}

package main

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

var reader = bufio.NewReader(os.Stdin)
var 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 main() {
	defer writer.Flush()

	var t, n, x int
	var arr [3]int

	scanf("%d\n", &t)

	for i := 0; i < t; i++ {
		scanf("%d\n", &n)
		for j := 0; j < n; j++ {
			scanf("%d", &x)
			arr[x]++
		}
		scanf("\n")
		if arr[1]%2 != 0 {
			printf("NO\n")
		} else {
			if arr[1] % 2 == 0 && arr[2] % 2 == 0 {
				printf("YES\n")
			} else if arr[1] == 2*arr[2] {
				printf("YES\n")
			} else {
				p := (arr[1] + 2*arr[2]) / 2
				arr[2] -= (p-1)/2
				arr[1] -= 1
				if arr[2] < 0 || arr[1] < 0 {
					printf("NO\n")
				} else if (arr[1] + 2*arr[2]) != p {
					printf("NO\n")
				} else {
					printf("YES\n")
				}
			}
		}
		arr[1] = 0
		arr[2] = 0
	}
}

package main

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

var reader = bufio.NewReader(os.Stdin)
var 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 main() {
	defer writer.Flush()

	var t, n, x int
	var arr [3]int

	scanf("%d\n", &t)

	for i := 0; i < t; i++ {
		scanf("%d\n", &n)
		for j := 0; j < n; j++ {
			scanf("%d", &x)
			arr[x]++
		}
		scanf("\n")
		if arr[1]%2 != 0 {
			printf("NO\n")
		} else {
			if arr[1] % 2 == 0 && arr[2] % 2 == 0 {
				printf("YES\n")
			} else {
				p := (arr[1] + 2*arr[2]) / 2
				arr[2] -= (p-1)/2
				arr[1] -= 1
				if arr[2] < 0 || arr[1] < 0 {
					printf("NO\n")
				} else if (arr[1] + 2*arr[2]) != p {
					printf("NO\n")
				} else {
					printf("YES\n")
				}
			}
		}
		arr[1] = 0
		arr[2] = 0
	}
}

package main

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

var reader = bufio.NewReader(os.Stdin)
var 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 main() {
	defer writer.Flush()

	var t, n, x int
	var arr [3]int

	scanf("%d\n", &t)

	for i := 0; i < t; i++ {
		scanf("%d\n", &n)
		for j := 0; j < n; j++ {
			scanf("%d", &x)
			arr[x]++
		}
		scanf("\n")
		if arr[1]%2 != 0 {
			printf("NO\n")
		} else {
			p := (arr[1] + 2*arr[2]) / 2
			arr[2] -= (p-1)/2
			arr[1] -= 1
			if arr[2] < 0 || arr[1] < 0 {
				printf("NO\n")
			} else if (arr[1] + 2*arr[2]) != p {
				printf("NO\n")
			} else {
				printf("YES\n")
			}
		}
		arr[1] = 0
		arr[2] = 0
	}
}

package main

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

var reader = bufio.NewReader(os.Stdin)
var 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 isEven(n int) bool {
	return n % 2 == 0
}

func isOdd(n int) bool {
	return n % 2 != 0
}

func main() {
	defer writer.Flush()

	var t, n, x int
	var arr [3]int

	scanf("%d\n", &t)

	for i := 0; i < t; i++ {
		scanf("%d\n", &n)
		for j := 0; j < n; j++ {
			scanf("%d", &x)
			arr[x]++
		}
		scanf("\n")
		if (isOdd(arr[1]) && isOdd(arr[2])) || (isOdd(arr[1]) && isEven(arr[2])) || (isEven(arr[1]) && isOdd(arr[2]) && arr[2] > arr[1]) {
			printf("NO\n")
		} else {
			printf("YES\n")
		}
		arr[1] = 0
		arr[2] = 0
	}
}

package main

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

var reader = bufio.NewReader(os.Stdin)
var 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 main() {
	defer writer.Flush()

	var t, n, x int
	var arr [3]int

	scanf("%d\n", &t)

	for i := 0; i < t; i++ {
		scanf("%d\n", &n)
		for j := 0; j < n; j++ {
			scanf("%d", &x)
			arr[x]++
		}
		scanf("\n")
		if arr[1] % 2 == 0 && arr[2] % 2==0 {
			printf("YES\n")
		} else {
			printf("NO\n")
		}
		arr[1] = 0
		arr[2] = 0
	}
}

package main

import (
	"fmt"
	"sort"
)

func solve(n int, s []int) bool {
	M := make(map[int]int)
	A := 0
	B := 0
	sum := 0
	for _, i := range s {
		M[i]++
		sum += i
	}
	if sum%2 != 0 {
		return false
	}
	keys := []int{}
	for i := range M {
		keys = append(keys, i)
	}
	sort.Slice(keys, func(i, j int) bool {
		return keys[i] > keys[j]
	})
	// fmt.Println(keys)
	for len(M) > 0 {
		for _, i := range keys {
			for M[i] > 0 {
				// fmt.Println(A, B, M)
				if A >= B {
					B += i
					M[i]--
				} else {
					A += i
					M[i]--
				}
			}
			delete(M, i)
		}
	}
	// fmt.Println(A, B, M)
	return A == B
}
func main() {
	fmt.Println(solve(7, []int{1, 2, 1, 2, 1, 2, 1}))
	var t int
	fmt.Scan(&t)
	for T := 0; T < t; T++ {
		var n int
		fmt.Scan(&n)
		s := make([]int, n)
		for i := range s {
			fmt.Scan(&s[i])
		}
		if solve(n, s) {
			fmt.Println("yes")
		} else {
			fmt.Println("No")
		}
	}
}

package main

import "fmt"

func solve(n int, s []int) bool {
	M := make(map[int]int)
	A := 0
	B := 0
	sum := 0
	for _, i := range s {
		M[i]++
		sum += i
	}
	if sum%2 != 0 {
		return false
	}
	for len(M) > 0 {
		for i := range M {
			for M[i] > 0 {
				// fmt.Println(A, B, M)
				if A >= B {
					B += i
					M[i]--
				} else {
					A += i
					M[i]--
				}
			}
			delete(M, i)
		}
	}
	// fmt.Println(A, B, M)
	return A == B
}
func main() {
	var t int
	fmt.Scan(&t)
	for T := 0; T < t; T++ {
		var n int
		fmt.Scan(&n)
		s := make([]int, n)
		for i := range s {
			fmt.Scan(&s[i])
		}
		if solve(n, s) {
			fmt.Println("yes")
		} else {
			fmt.Println("No")
		}
	}
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	test := parseInt(getString(reader))
	for ; test > 0; test-- {
		n := parseInt(getString(reader))
		candies := getIntln(reader)
		if n == 1 {
			writer.WriteString("NO\n")
		}
		totalWeight := sum(candies)
		if totalWeight%2 == 0 {
			if (n%2 == 1) && alltwo(candies) {
				writer.WriteString("NO\n")
			} else {
				writer.WriteString("YES\n")
			}
		} else {
			writer.WriteString("NO\n")
		}
		writer.Flush()
	}
}

func alltwo(A []int) bool {
	for _, a := range A {
		if a == 1 {
			return false
		}
	}
	return true
}

func sum(A []int) int {
	var res int
	for _, a := range A {
		res += a
	}
	return res
}

func getIntln(in *bufio.Reader) []int {
	b := strings.Split(getString(in), " ")
	res := make([]int, len(b))
	for k, v := range b {
		res[k] = parseInt(v)
	}
	return res
}

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

func parseInt(str string) int {
	var res int
	size := len(str)
	for i := 0; i < size; i++ {
		digit := int(str[i] - '0')
		for j := (i + 1); j < size; j++ {
			digit = digit<<3 + digit<<1
		}
		res += digit
	}
	return res
}

package main

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

func main() {
	var test int
	fmt.Scanln(&test)
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	for ; test > 0; test-- {
		n := parseInt(getString(reader))
		candies := getIntln(reader)
		if n == 1 {
			writer.WriteString("NO\n")
		}
		totalWeight := sum(candies)
		if totalWeight%2 == 0 {
			if (n%2 == 1) && alltwo(candies) {
				writer.WriteString("NO\n")
			} else {
				writer.WriteString("YES\n")
			}
		} else {
			writer.WriteString("NO\n")
		}
	}
	writer.Flush()
}

func alltwo(A []int) bool {
	for _, a := range A {
		if a == 1 {
			return false
		}
	}
	return true
}

func sum(A []int) int {
	var res int
	for _, a := range A {
		res += a
	}
	return res
}

func getIntln(in *bufio.Reader) []int {
	b := strings.Split(getString(in), " ")
	res := make([]int, len(b))
	for k, v := range b {
		res[k] = parseInt(v)
	}
	return res
}

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

func parseInt(str string) int {
	var res int
	size := len(str)
	for i := 0; i < size; i++ {
		digit := int(str[i] - '0')
		for j := (i + 1); j < size; j++ {
			digit = digit<<3 + digit<<1
		}
		res += digit
	}
	return res
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	test := parseInt(getString(reader))
	for ; test > 0; test-- {
		n := parseInt(getString(reader))
		candies := getIntln(reader)
		if n == 1 {
			writer.WriteString("NO\n")
		}
		totalWeight := sum(candies)
		if totalWeight%2 == 0 {
			if n%2 == 1 && alltwo(candies) {
				writer.WriteString("NO\n")
			} else {
				writer.WriteString("YES\n")
			}
		} else {
			writer.WriteString("NO\n")
		}
	}
	writer.Flush()
}

func alltwo(A []int) bool {
	for _, a := range A {
		if a == 1 {
			return false
		}
	}
	return true
}

func sum(A []int) int {
	var res int
	for _, a := range A {
		res += a
	}
	return res
}

func getIntln(in *bufio.Reader) []int {
	b := strings.Split(getString(in), " ")
	res := make([]int, len(b))
	for k, v := range b {
		res[k] = parseInt(v)
	}
	return res
}

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

func parseInt(str string) int {
	var res int
	size := len(str)
	for i := 0; i < size; i++ {
		digit := int(str[i] - '0')
		for j := (i + 1); j < size; j++ {
			digit = digit<<3 + digit<<1
		}
		res += digit
	}
	return res
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	test := parseInt(getString(reader))
	for ; test > 0; test-- {
		n := parseInt(getString(reader))
		candies := getIntln(reader)
		if n == 1 {
			writer.WriteString("NO\n")
		}
		totalWeight := sum(candies)
		if totalWeight%2 == 0 {
			if n%2 == 1 && areAlleven(candies) {
				writer.WriteString("NO\n")
			} else {

				writer.WriteString("YES\n")
			}
		} else {
			writer.WriteString("NO\n")
		}
	}
	writer.Flush()
}

func areAlleven(A []int) bool {
	for _, a := range A {
		if a%2 == 1 {
			return false
		}
	}
	return true
}

func sum(A []int) int {
	var res int
	for _, a := range A {
		res += a
	}
	return res
}

func getIntln(in *bufio.Reader) []int {
	b := strings.Split(getString(in), " ")
	res := make([]int, len(b))
	for k, v := range b {
		res[k] = parseInt(v)
	}
	return res
}

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

func parseInt(str string) int {
	var res int
	size := len(str)
	for i := 0; i < size; i++ {
		digit := int(str[i] - '0')
		for j := (i + 1); j < size; j++ {
			digit = digit<<3 + digit<<1
		}
		res += digit
	}
	return res
}

package main

import (
    "fmt"
)

func main() {
   var t int
   fmt.Scan(&t)
   for k := 0; k < t; k++ {
       var n int
       fmt.Scan(&n)
       a := make([]int, n)
       count := make([]int, 3)
       for i := 0; i < n; i++ {
           fmt.Scan(&a[i])
           count[a[i]]++
       }
       if count[2] % 2 == 1 {
           fmt.Println("NO")
       } else if count[1] % 2 == 0 && count[2] % 2 == 0{
           fmt.Println("YES")
       } else {
           fmt.Println("NO")
       }
   }
}

package main

import (
    "fmt"
)

func main() {
   var t int
   fmt.Scan(&t)
   for k := 0; k < t; k++ {
       var n int
       fmt.Scan(&n)
       a := make([]int, n)
       count := make([]int, 3)
       for i := 0; i < n; i++ {
           fmt.Scan(&a[i])
           count[a[i]]++
       }
       if count[1] % 2 == 0 && count[2] % 2 == 0{
           fmt.Println("YES")
       } else if count[1] % 2 == 1 && count[2] % 2 == 0{
           fmt.Println("YES")
       } else {
           fmt.Println("NO")
       }
   }
}

package main

import (
    "fmt"
)

func main() {
   var t int
   fmt.Scan(&t)
   for k := 0; k < t; k++ {
       var n int
       fmt.Scan(&n)
       a := make([]int, n)
       count := make([]int, 3)
       for i := 0; i < n; i++ {
           fmt.Scan(&a[i])
           count[a[i]]++
       }
       if count[1] % 2 == 0 && count[2] % 2 == 0{
           fmt.Println("YES")
       } else {
           fmt.Println("NO")
       }
   }
}

package main

import (
    "fmt"
    "sort"
)

func main() {
   var t int
   fmt.Scan(&t)
   for k := 0; k < t; k++ {
       var n int
       fmt.Scan(&n)
       a := make([]int, n)
       for i := 0; i < n; i++ {
           fmt.Scan(&a[i])
       }
       sort.Ints(a)
       Alice := 0
       Bob := 0
       for i := 0; i < len(a); i++ {
           if Alice > Bob {
                Bob += a[i]
           } else {
                Alice += a[i]
           }
       }
       if Alice == Bob {
           fmt.Println("YES")
       } else {
           fmt.Println("NO")
       }
   }
}

package main

import (
    "fmt"
    "sort"
)

func main() {
   var t int
   fmt.Scan(&t)
   for k := 0; k < t; k++ {
       var n int
       fmt.Scan(&n)
       a := make([]int, n)
       for i := 0; i < n; i++ {
           fmt.Scan(&a[i])
       }
       sort.Ints(a)
       Alice := 0
       Bob := 0
       for i := 0; i < len(a); i += 2 {
           Alice += a[i]
       }
       for i := 1; i < len(a); i += 2 {
           Bob += a[i]
       }
       if Alice == Bob {
           fmt.Println("YES")
       } else {
           fmt.Println("NO")
       }
   }
}

package main

import (
    "fmt"
)

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

    for ; t > 0; t-- {
        var n int

        fmt.Scan(&n)

        w, ones, twos := 0, 0, 0
        for i := 0; i < n; i++ {
            var x int
            fmt.Scan(&x)

            w += x
            if x == 1 {
                ones++
            } else {
                twos++
            }
        }

        if w % 2 == 1 {
            fmt.Println("NO")
            continue
        }

        if twos % 2 == 1 {
            fmt.Println("NO")
        } else {
            fmt.Println("YES")
        }

    }
}

package main

import (
    "fmt"
)

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

    for ; t > 0; t-- {
        var n int

        fmt.Scan(&n)

        w, ones, twos := 0, 0, 0
        for i := 0; i < n; i++ {
            var x int
            fmt.Scan(&x)

            w += x
            if x == 1 {
                ones++
            } else {
                twos++
            }
        }

        if w % 2 == 1 {
            fmt.Println("NO")
            return
        }

        if twos % 2 == 1 {
            fmt.Println("NO")
        } else {
            fmt.Println("YES")
        }

    }
}

package main

import (
    "fmt"
)

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

    for ; t > 0; t-- {
        var n int

        fmt.Scan(&n)

        w, ones, twos := 0, 0, 0
        for i := 0; i < n; i++ {
            var x int
            fmt.Scan(&x)

            w += x
            if x == 1 {
                ones++
            } else {
                twos++
            }
        }

        if w % 2 == 1 {
            fmt.Println("NO")
        }

        if twos % 2 == 1 {
            fmt.Println("NO")
        } else {
            fmt.Println("YES")
        }

    }
}

package main

import (
    "fmt"
)

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

    for ; t > 0; t-- {
        var n int
        arr := [3]int{}

        fmt.Scan(&n)

        for i := 0; i < n; i++ {
            var x int
            fmt.Scan(&x)
            if x == 1 {
                arr[1]++
            } else {
                arr[2]++
            }
        }

        if arr[1] == 0 && arr[2] % 2 == 1 {
            fmt.Println("NO")
        } else if arr[2] == 0 && arr[1] % 2 == 1{
            fmt.Println("YES")
        } else if arr[1] % 2 == 0 && arr[2] % 2 == 0 {
            fmt.Println("YES")
        } else if arr[1] % 2 == 1 && arr[2] % 2 == 1 {
            fmt.Println("NO")
        } else if arr[1] % 2 == 1 && arr[2] % 2 == 0 {
            fmt.Println("NO")
        } else {
            fmt.Println("YES")
        }
    }
}

package main

import (
    "fmt"
)

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

    for ; t > 0; t-- {
        var n int
        arr := [3]int{}

        fmt.Scan(&n)

        for i := 0; i < n; i++ {
            var x int
            fmt.Scan(&x)
            if x == 1 {
                arr[1]++
            } else {
                arr[2]++
            }
        }

        if arr[1] % 2 == 0 && arr[2] % 2 == 0 {
            fmt.Println("YES")
        } else {
            fmt.Println("NO")
        }
    }
}

package main

import "fmt"

func main() {
	var T int
	fmt.Scanf("%d ", &T)
	for T > 0 {
		var n int
		var ans int
		fmt.Scanf("%d ", &n)
		var flag bool
		flag = false
		for n > 0 {
			var num int
			fmt.Scanf("%d ", &num)
			ans += num
			if num == 1 {
				flag = true
			}
			n--
		}
		fmt.Println(ans)
		fmt.Println(flag)
		if ans%4 == 0 || (ans%2 == 0 && flag) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
		T--

	}
}

package main

import "fmt"

func main() {
	var T int
	fmt.Scanf("%d",&T)
	for T>0 {
		T--

		var n int
		var ans int
		fmt.Scanf("%d",&n)
		var flag bool
		flag = false
		for n>0 {
			var num int
			fmt.Scanf("%d",&num)
			ans += num
			if num==1 {
				flag =true
			}
			n--
		}
		fmt.Println(ans)
		fmt.Println(flag)
		if ans%4==0 || (ans%2==0&&flag) {
			fmt.Println("YES")
		}else{
			fmt.Println("NO")
		}

	}
}

package main

import "fmt"

func main() {
	var T int
	fmt.Scanf("%d",&T)
	for T>0 {
		T--

		var n int
		var ans int
		fmt.Scanf("%d",&n)
		var flag bool
		flag = false
		for n>0 {
			var num int
			fmt.Scanf("%d",&num)
			ans += num
			if num==1 {
				flag =true
			}
			n--
		}
		if ans%4==0 || (ans%2==0&&flag) {
			fmt.Println("YES")
		}else{
			fmt.Println("NO")
		}

	}
}

package main

import "fmt"

func main() {
	var T int32
	fmt.Scanf("%d",&T)
	for T>0 {
		T--

		var n int32
		var ans int32
		fmt.Scanf("%d",&n)
		var flag bool
		flag = false
		for n>0 {
			var num int32
			fmt.Scanf("%d",&num)
			ans += num
			if num==1 {
				flag =true
			}
			n--
		}
		if ans%4==0 || (ans%2==0&&flag) {
			fmt.Println("YES")
		}else{
			fmt.Println("NO")
		}

	}
}

package main

import "fmt"

func main() {
	var t,n int
	fmt.Scan(&t)
	for t>0 {
		fmt.Scan(&n)
		var a,b,k int64
		a=0;b=0
		for i:=0; i<n; i++ {
			fmt.Scan(&k)
			if k==1 {
				a++
			} else {
				b++
			}
		}
		k = a + 2*b
		if k % 2 == 0{
			if b % 2 == 0 || ( b % 2 != 0 && a % 2 == 0 ){
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		} else {
			fmt.Println("NO")
		}
		t--
	}
}

package main

import "fmt"

func main() {
	var t,n int
	fmt.Scan(&t)
	for t>0 {
		fmt.Scan(&n)
		var a,b,k int64
		a = 0
		for i:=0; i<n; i++ {
			fmt.Scan(&k)
			if k==1 {
				a++
			} else {
				b++
			}
		}
		k = a + b
		if k % 2 == 0{
			if b % 2 == 0 {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		} else {
			fmt.Println("NO")
		}
		t--
	}
}

package main

import "fmt"

func main(){
	var t,n int
	fmt.Scan(&t)
	for t>0{
		fmt.Scan(&n)
		s := make([]int, n)
		a := 0
		for i:=0; i<n; i++ {
			fmt.Scan(&s[i])
			a += s[i]
		}
		if (a % 2 != 0 || n % 2 !=0){
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
		t--
	}
}

package main

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

func main() {
	var (
		t  int
		n  int
		a1 int
		a2 int
	)
	buffer := bufio.NewReader(os.Stdin)
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		a1, a2 = 0, 0
		ns, _, _ := buffer.ReadLine()
		n, _ = strconv.Atoi(string(ns))
		s, _, _ := buffer.ReadLine()
		for j := 0; j < 2*n-1; j++ {
			if s[j] == '1' {
				a1++
			}
			if s[j] == '2' {
				a2++
			}
		}
		if a1%2 == 1 {
			fmt.Println("NO")
		} else if (a1%2 + a2%2) == 0 {
			fmt.Println("YES")
		} else if (a1/2+a2)%2 == 1 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}
}

package main
import (
	"fmt"
)
func main() {
	var n,x,y int
	fmt.Scan(&n)
	for i:=0;i<n;i++{
		fmt.Scan(&x)
		var tally_1,tally_2 int
		for j:=0;j<x;j++{
			fmt.Scan(&y)
			if y == 1 {
				tally_1++
			} else {
				tally_2++
			}
		}
		if tally_1 % 2 != 0 {
			fmt.Println("NO")
		} else if tally_2 % 2 != 0 {
			if tally_1 < tally_2 {
				fmt.Println("NO")
			} else {
				fmt.Println("YES")
			}
		} else {
			fmt.Println("YES")
		}
	}
}

package main
import (
	"fmt"
)
func main() {
	var n,x,y int
	fmt.Scan(&n)
	for i:=0;i<n;i++{
		fmt.Scan(&x)
		var tally_1,tally_2 int
		for j:=0;j<x;j++{
			fmt.Scan(&y)
			if y == 1 {
				tally_1++
			} else {
				tally_2++
			}
		}
		if tally_1 % 2 != 0 || tally_2 % 2 != 0 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}
}

package main

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

func Solve() {
	n := ri()
	a := make([]int, 3)
	for i := 1; i <= n; i++ {
		a[ri()]++
	}
	for a[0] > 2 {
		a[0] -= 2
		a[1] += 2
	}
	switch {
	case a[0]%2 == 0 && a[1]%2 == 0:
		println("YES")
	case a[1]%2 == 1 && a[0] == 2:
		println("YES")
	default:
		println("NO")
	}
}

func main() {
	T := 0 // 如果是多组样例，请讲 T := 1 改为 T := 0
	in, out = bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	if T == 0 {
		scan(&T)
	}
	for t := 0; t < T; t++ {
		Solve()
	}
	out.Flush()
}

var in *bufio.Reader
var out *bufio.Writer

// ri 将直接读入并返回一个 int
func ri() (x int) {
	scan(&x)
	return x
}

// ri64 将直接读入并返回一个 int64
func ri64() (x int64) {
	scan(&x)
	return x
}

//rs 将直接读入并返回一个 string
func rs() (s string) {
	scan(&s)
	return s
}

//scan 用法与 fmt.scan() 相似，可以传入多个变量的地址进行读入操作
func scan(a ...interface{}) { Fscan(in, a...) }

//print 用法与 fmt.print() 相似，可以传入多个变量进行输出。
//注意，这个函数不会换行，多个变量之间有空格
func print(a ...interface{}) { Fprint(out, a...) }

//println 用法与 fmt.println() 相似，可以传入多个变量进行输出。
//这个函数会换行，多个变量之间有空格
func println(a ...interface{}) { Fprintln(out, a...) }

//min 可以传入多个 int 变量，求出这些变量的最小值
func min(a ...int) int {
	ans := a[0]
	for i := 1; i < len(a); i++ {
		if a[i] < ans {
			ans = a[i]
		}
	}
	return ans
}

//min64 可以传入多个 int64 变量，求出这些变量的最小值
func min64(a ...int64) int64 {
	ans := a[0]
	for i := 1; i < len(a); i++ {
		if a[i] < ans {
			ans = a[i]
		}
	}
	return ans
}

//max 可以传入多个 int 变量，求出这些变量的最大值
func max(a ...int) int {
	ans := a[0]
	for i := 1; i < len(a); i++ {
		if a[i] > ans {
			ans = a[i]
		}
	}
	return ans
}

//max64 可以传入多个 int64 变量，求出这些变量的最大值
func max64(a ...int64) int64 {
	ans := a[0]
	for i := 1; i < len(a); i++ {
		if a[i] > ans {
			ans = a[i]
		}
	}
	return ans
}

//sum 可以传入多个 int 变量，求出这些变量的总和，并返回总和。
//你可以使用 ... 运算符打散数组，使得 sum 函数可以求出数组的和。
func sum(a ...int) int {
	ans := 0
	for _, x := range a {
		ans += x
	}
	return ans
}

//sum64 可以传入多个 int64 变量，求出这些变量的总和，并返回总和。
//你可以使用 ... 运算符打散数组，使得 sum 函数可以求出数组的和。
func sum64(a ...int64) int64 {
	ans := int64(0)
	for _, x := range a {
		ans += x
	}
	return ans
}

//reverse 用于翻转 int 切片，所有元素将会变成原切片的倒序
func reverse(a []int) {
	for l, r := 0, len(a)-1; l < r; l, r = l+1, r-1 {
		a[l], a[r] = a[r], a[l]
	}
}

//reverse64 用于翻转 int64 切片，所有元素将会变成原切片的倒序
func reverse64(a []int64) {
	for l, r := 0, len(a)-1; l < r; l, r = l+1, r-1 {
		a[l], a[r] = a[r], a[l]
	}
}

//lowerBound 类似于 C++ 中的 lower_bound。
//用于二分查找 int 切片中，第一个大于等于 k 的元素在切片中的位置。
//如果元素不存在，则返回切片的长度。
//注意，lowerBound 作用的 int 切片必须升序。
func lowerBound(a []int, k int) int {
	l, r, pos := 0, len(a)-1, len(a)
	for l <= r {
		mid := (l + r) >> 1
		if a[mid] < k {
			l = mid + 1
		} else {
			pos, r = mid, mid-1
		}
	}
	return pos
}

//lowerBound64 类似于 C++ 中的 lower_bound。
//用于二分查找 int64 切片中，第一个大于等于 k 的元素在切片中的位置。
//如果元素不存在，则返回切片的长度。
//注意，lowerBound 作用的 int64 切片必须升序。
func lowerBound64(a []int64, k int64) int {
	l, r, pos := 0, len(a)-1, len(a)
	for l <= r {
		mid := (l + r) >> 1
		if a[mid] < k {
			l = mid + 1
		} else {
			pos, r = mid, mid-1
		}
	}
	return pos
}

//upperBound 类似于 C++ 中的 upper_bound。
//用于二分查找 int 切片中，第一个大于 k 的元素在切片中的位置。
//如果元素不存在，则返回切片的长度。
//注意，upperBound 作用的 int 切片必须升序。
func upperBound(a []int, k int) int {
	l, r, pos := 0, len(a)-1, len(a)
	for l <= r {
		mid := (l + r) >> 1
		if a[mid] <= k {
			l = mid + 1
		} else {
			pos, r = mid, mid-1
		}
	}
	return pos
}

//upperBound64 类似于 C++ 中的 upper_bound。
//用于二分查找 int64 切片中，第一个大于 k 的元素在切片中的位置。
//如果元素不存在，则返回切片的长度。
//注意，upperBound 作用的 int64 切片必须升序。
func upperBound64(a []int64, k int64) int {
	l, r, pos := 0, len(a)-1, len(a)
	for l <= r {
		mid := (l + r) >> 1
		if a[mid] <= k {
			l = mid + 1
		} else {
			pos, r = mid, mid-1
		}
	}
	return pos
}

type Stack struct {
	s []int
}

func (st *Stack) top() int   { return st.s[len(st.s)-1] }
func (st *Stack) size() int  { return len(st.s) }
func (st *Stack) pop()       { st.s = st.s[:len(st.s)-1] }
func (st *Stack) push(x int) { st.s = append(st.s, x) }

type Queue struct {
	que chan int
}

func MakeQueue(size int) Queue {
	var q Queue
	q.que = make(chan int, size)
	return q
}

package main
import (
"bufio"
"fmt"
"os"
)
var reader *bufio.Reader=bufio.NewReader(os.Stdin)
var writer *bufio.Writer=bufio.NewWriter(os.Stdout)
func scanf(f string,a ...interface{}) { fmt.Fscanf(reader,f,a...) }
func printf(f string,a ...interface{}) { fmt.Fprintf(writer,f,a...) }
func main(){
defer writer.Flush()
var t int
scanf("%d\n",&t)
for tt:=0;tt<t;tt++ {
var n int
scanf("%d\n",&n)
oc:=0
tc:=0
var x int
for i:=0;i<n;i++ {
scanf("%d",&x)
if x==1 {
oc++
} else {
tc++
}
}
scanf("\n")
ans:=oc-2*tc
if oc%2==0 && tc%2==0 {
printf("YES\n")
} else if ans>0 && oc%2==0 {
printf("YES\n")
} else {
printf("NO\n")
}
}
}

package main
import (
"bufio"
"fmt"
"os"
)
var reader *bufio.Reader=bufio.NewReader(os.Stdin)
var writer *bufio.Writer=bufio.NewWriter(os.Stdout)
func scanf(f string,a ...interface{}) { fmt.Fscanf(reader,f,a...) }
func printf(f string,a ...interface{}) { fmt.Fprintf(writer,f,a...) }
func main(){
defer writer.Flush()
var t int
scanf("%d\n",&t)
for tt:=0;tt<t;tt++ {
var n int
scanf("%d\n",&n)
oc:=0
tc:=0
var x int
for i:=0;i<n;i++ {
scanf("%d",&x)
if x==1 {
oc++
} else {
tc++
}
}
scanf("\n")
if oc%2==0 && tc%2==0 {
printf("YES\n")
} else {
printf("NO\n")
}
}
}

package main

import (
	"fmt"
)

func solve() {
	var n int
	fmt.Scan(&n)
	nums := readIntN(n)
	if n%2 == 0 && sum(nums)%2 == 0 ||
		n%2 == 1 && sum(nums)%4 == 0 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

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

func readIntN(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&arr[i])
	}
	return arr
}

func readIntNN(n, m int) [][]int {
	arr := make([][]int, n)
	for i := 0; i < n; i++ {
		arr[i] = readIntN(m)
	}
	return arr
}

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

func minMax(a ...int) (min int, max int) {
	min, max = a[0], a[0]
	for _, v := range a {
		if v < min {
			min = v
		}
		if v > max {
			max = v
		}
	}
	return
}

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

func avg(x ...int) int {
	var sum int
	for _, v := range x {
		sum += v
	}
	return sum / len(x)
}

func sum(x []int) int {
	var sum int
	for _, v := range x {
		sum += v
	}
	return sum
}

package main

import (
	"fmt"
)

func solve() {
	var n int
	fmt.Scanf("%d", &n)
	nums := readIntN(n)
	if n%2 == 0 && sum(nums)%2 == 0 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

func main() {
	var n int
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		solve()
	}
}

func readIntN(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &arr[i])
	}
	return arr
}

func readIntNN(n, m int) [][]int {
	arr := make([][]int, n)
	for i := 0; i < n; i++ {
		arr[i] = readIntN(m)
	}
	return arr
}

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

func minMax(a ...int) (min int, max int) {
	min, max = a[0], a[0]
	for _, v := range a {
		if v < min {
			min = v
		}
		if v > max {
			max = v
		}
	}
	return
}

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

func avg(x ...int) int {
	var sum int
	for _, v := range x {
		sum += v
	}
	return sum / len(x)
}

func sum(x []int) int {
	var sum int
	for _, v := range x {
		sum += v
	}
	return sum
}

package main

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

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 print(a ...interface{})            { fmt.Fprint(writer, a...) }
func scan(a ...interface{})             { fmt.Fscan(reader, a...) }

func main() {
	defer writer.Flush()
	////////////////////
	var count int
	scan(&count)
	for count != 0 {
		solve()
		count--
	}

}

func solve() {
	c := 0
	tw := 0
	on := 0
	scan(&c)
	for i := 0; i < c; i++ {
		t := 0
		scan(&t)
		if t == 1 {
			on++
			continue
		}
		tw++
	}
	if on/2 == tw {
		print("Yes", "\n")
		return
	}
	if on%2 != 0 {
		print("No", "\n")
		return
	}
	if (tw+on)%2 == 0 {
		print("Yes", "\n")
	} else {
		print("No", "\n")
	}

}

package main

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

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 print(a ...interface{})            { fmt.Fprint(writer, a...) }
func scan(a ...interface{})             { fmt.Fscan(reader, a...) }

func main() {
	defer writer.Flush()
	////////////////////
	var count int
	scan(&count)
	for count != 0 {
		solve()
		count--
	}

}

func solve() {
	c := 0
	f := 0
	scan(&c)
	for i := 0; i < c; i++ {
		t := 0
		scan(&t)
		f += t
	}
	if c%2 != 0 {
		print("No", "\n")
		return
	}
	if f%2 == 0 {
		print("Yes", "\n")
	} else {
		print("No", "\n")
	}
}

package main

import "fmt"

func main() {
	var setNum uint16
	fmt.Scan(&setNum)
	var weight uint8
	var amount uint8
	var oneGram uint8 = 0
	var twoGram uint8 = 0
	var res []string
	for i := setNum; i > 0; i-- {
		fmt.Scan(&amount)
		for j := amount; j > 0; j-- {
			fmt.Scan(&weight)
			if weight == 1 {
				oneGram++
			} else {
				twoGram++
			}
		}

		if oneGram%2 == 0 && twoGram%2 == 0 {
			res = append(res, "YES")
		} else if (oneGram == 0 || twoGram == 0) && amount%2 == 0 {
			res = append(res, "YES")
		} else if oneGram == twoGram && amount%4 == 0 {
			res = append(res, "YES")
		} else if oneGram%2 == 0 && twoGram%2 == 1 {
			res = append(res, "YES")
		} else {
			res = append(res, "NO")
		}

		oneGram, twoGram = 0, 0
	}

	for _, val := range res {
		fmt.Println(val)
	}
}

package main

import "fmt"

func main() {
	var setNum uint16
	fmt.Scan(&setNum)
	var weight uint8
	var amount uint8
	var oneGram uint8 = 0
	var twoGram uint8 = 0
	var res []string
	for i := setNum; i > 0; i-- {
		fmt.Scan(&amount)
		for j := amount; j > 0; j-- {
			fmt.Scan(&weight)
			if weight == 1 {
				oneGram++
			} else {
				twoGram++
			}
		}

		if (oneGram % 2 == 0 && twoGram % 2 == 0) || (oneGram == 2 * twoGram) {
			res = append(res, "YES")
		} else if (oneGram == 0 || twoGram == 0) && amount % 2 == 0 {
			res = append(res, "YES")
		} else if oneGram == twoGram && amount % 4 == 0 {
			res = append(res, "YES")
		} else {
			res = append(res, "NO")
		}

		oneGram, twoGram = 0, 0
	}

	for _, val := range res {
		fmt.Println(val)
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var T, n1, n2, sum, num, this int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &num)
		for i := 0; i < num; i++ {
			Fscan(in, &this)
			if this == 1 {
				n1++
				sum += this
			} else {
				n2++
				sum += this
			}
		}
		if n1%2 != 0 {
			Fprintln(out, "NO")
		} else {
			if n2%2 != 0 {
				if (n1/2+n2)%2 == 0 {
					Fprintln(out, "YES")
				} else {
					Fprintln(out, "NO")
				}
			} else {
				Fprintln(out, "YES")
			}
		}
		n1, n2, sum = 0, 0, 0
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var T, n1, n2, sum, this int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &sum)
		for i := 0; i < sum; i++ {
			Fscan(in, &this)
			if this == 1 {
				n1++
			} else {
				n2++
			}
		}
		if n1%2 != 0 {
			Fprintln(out, "NO")

		} else {
			if n1 == 2 {
				Fprintln(out, "YES")
			} else if (n2+n1/2)%2 != 0 {
				Fprintln(out, "NO")
			} else {
				Fprintln(out, "YES")
			}
		}
		n1, n2 = 0, 0
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	var n int
	arr := make([]int, 100)
	fmt.Scanf("%d", &t)
	for t > 0 {
		t--
		fmt.Scanf("%d", &n)
		even, odd := 0, 0
		for i := 0; i < n; i++ {
			fmt.Scanf("%d", &arr[i])
			if arr[i] % 2 == 0 {
				even++
			} else {
				odd++
			}
		}
		if odd % 2 == 1 {
			fmt.Printf("NO\n")
			continue
		}
		if even % 2 == 0 || odd > 1 {
			fmt.Printf("YES\n")
			continue
		}
		fmt.Printf("NO\n")
	}
}

package main

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

func main() {
	var t int
	var n int
	arr := make([]int, 100)
	in, out := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	fmt.Fscanf(in, "%d\n", &t)
	for t > 0 {
		t--
		fmt.Fscanf(in, "%d\n", &n)
		even, odd := 0, 0
		for i := 0; i < n; i++ {
			fmt.Scanf("%d", &arr[i])
			if arr[i] % 2 == 0 {
				even++
			} else {
				odd++
			}
		}
		if odd % 2 == 1 {
			fmt.Fprintf(out, "NO\n")
			continue
		}
		if even % 2 == 0 || odd > 1 {
			fmt.Fprintf(out, "YES\n")
			continue
		}
		fmt.Fprintf(out, "NO\n")
	}
	out.Flush()
}

package main

import (
  "fmt"
)

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

  for i:=0; i<tc; i++ {
    var c int
    fmt.Scanf("%d\n", &c)

    o := 0
    t := 0
    for j:=0; j<c; j++ {
      var temp int
      fmt.Scan(&temp)
      if(temp == 1) {
        o++
      } else {
        t++
      }
    }

    if t % 2 != 0 {
      if(o < 2) { fmt.Println("NO"); continue }
    }

    if o % 2 == 0 {
      fmt.Println("YES")
    } else {
      fmt.Println("NO")
    }
  }
}

package main

import (
  "fmt"
)

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

  for i:=0; i<tc; i++ {
    var c int
    fmt.Scanf("%d\n", &c)

    o := 0
    t := 0
    for j:=0; j<c; j++ {
      var temp int
      fmt.Scanf("%d", &temp)
      if(temp == 1) {
        o++
      } else {
        t++
      }
    }

    if t % 2 != 0 {
      if(o < 2) { fmt.Println("NO"); continue }
    }

    if o % 2 == 0 {
      fmt.Println("YES")
    } else {
      fmt.Println("NO")
    }
  }
}

package main

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

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

	cc, _, _ := reader.ReadLine()

	//fmt.Println(cc)
	count, err := strconv.ParseInt(strings.Trim(string(cc), "\n"), 10, 64)
	if err != nil {
		os.Exit(-3)
	}

	for i := 0; i < int(count); i++ {
		_, _, _ = reader.ReadLine()
		//fmt.Println("Read:", v)
		//newCount, _ := strconv.ParseUint(strings.Trim(string(v), "\n"), 10, 64)

		cardV, _, _ := reader.ReadLine()
		var a uint64 = 0
		var b uint64 = 0
		cardList := strings.Split(string(cardV), " ")

		if len(cardList) < 2 {
			_, _ = os.Stdout.WriteString("no\n")
			continue
		}
		sp:=len(cardList)-2
		last := cardList[sp:]
		first := cardList[:sp]
		//fmt.Println("ALLST",cardList)
		//fmt.Println("FIRST",first)
		//fmt.Println("LASTT",last)
		for _, card := range first {
			c, _ := strconv.ParseUint(card, 10, 64)
			if a < b {
				a += c
			} else {
				b += c
			}
		}

		la, _ := strconv.ParseUint(last[0], 10, 64)
		lb, _ := strconv.ParseUint(last[1], 10, 64)

		if a+la == b+lb || a+lb == b+la || a+la+lb == b || a == b+la+lb {
			_, _ = os.Stdout.WriteString("yes\n")
		} else {
			_, _ = os.Stdout.WriteString("no\n")
		}

	}

}

package main

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

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

	cc, _, _ := reader.ReadLine()

	//fmt.Println(cc)
	count, err := strconv.ParseInt(strings.Trim(string(cc), "\n"), 10, 64)
	if err != nil {
		os.Exit(-3)
	}

	for i := 0; i < int(count); i++ {
		_, _, _ = reader.ReadLine()
		//fmt.Println("Read:", v)
		//newCount, _ := strconv.ParseUint(strings.Trim(string(v), "\n"), 10, 64)

		cardV, _, _ := reader.ReadLine()

		var a uint64 = 0
		var b uint64 = 0
		cardList := strings.Split(string(cardV), " ")
		for _, card := range cardList {
			c, _ := strconv.ParseUint(card, 10, 64)
			if a < b {
				a += c
			} else {
				b += c
			}
		}

		if a == b {
			_, _ = os.Stdout.WriteString("yes\n")
		} else {
			_, _ = os.Stdout.WriteString("no\n")
		}

	}

}

package main

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

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 main() {
	var t int
	scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		var n int
		scanf("%d\n", &n)
		fmt.Println(process(reader, n))
	}
}

func process(reader *bufio.Reader, n int) string {
	isHave1 := false
	arr := make([]int, n)
	sum := 0
	for i := 0; i < n; i++ {
		scanf("%d", &arr[i])
		sum += arr[i]
	}
	if sum%2 != 0 {
		return "NO"
	}
	target1 := sum / 2
	target2 := (sum / 2) + 1
	sum = 0
	isTar1 := false
	isTar2 := false
	for i := 0; i < n; i++ {
		sum += arr[i]
		if sum == target1 {
			isTar1 = true
		}
		if sum == target2 {
			isTar2 = true
		}
		if arr[i] == 1 {
			isHave1 = true
		}
	}
	if isTar1 {
		return "YES"
	}
	if isTar2 && isHave1 {
		return "YES"
	}
	return "NO"
}

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 main() {
	preCalc := make([]int, int(10e4)+1)
	for i := 1; i < len(preCalc); i++ {
		a := i
		pieces := 1
		preCalc[i] = 1
		for a%2 == 0 {
			preCalc[i] += pieces
			a = a / 2
			pieces *= 2
		}
	}
	line, _ := reader.ReadString('\n')
	line = strings.ReplaceAll(line, "\n", "")
	line = strings.ReplaceAll(line, "\r", "")
	t, err := strconv.Atoi(line)
	if err != nil {
		fmt.Println(err)
	}
	for i := 0; i < t; i++ {
		line, _ := reader.ReadString('\n')
		line = strings.ReplaceAll(line, "\n", "")
		line = strings.ReplaceAll(line, "\r", "")
		n, _ := strconv.Atoi(line)
		fmt.Println(process(reader, n))
	}
}

func process(reader *bufio.Reader, n int) string {
	isHave1 := false
	arr := make([]int, n)
	sum := 0
	for i := 0; i < n; i++ {
		scanf("%d", arr[i])
		sum += arr[i]
	}
	if sum%2 != 0 {
		return "NO"
	}
	target1 := sum / 2
	target2 := (sum / 2) + 1
	sum = 0
	isTar1 := false
	isTar2 := false
	for i := 0; i < n; i++ {
		sum += arr[i]
		if sum == target1 {
			isTar1 = true
		}
		if sum == target2 {
			isTar2 = true
		}
		if arr[i] == 1 {
			isHave1 = true
		}
	}
	if isTar1 {
		return "YES"
	}
	if isTar2 && isHave1 {
		return "YES"
	}
	return "NO"
}

package main

import "fmt"

func main() {
	var totalTests int
	_, _ = fmt.Scanf("%d\n", &totalTests)
	for i := 0; i < totalTests; i ++ {
		var n int
		count1, count2 := 0, 0
		_, _ = fmt.Scanf("%d\n", &n)
		for j := 0; j < n; j ++ {
			var candy int
			if j == n - 1 {
				_, _ = fmt.Scanf("%d\n", &candy)
			}else {
				_, _ = fmt.Scanf("%d", &candy)
			}
			if candy == 2 {
				count2 ++
			} else {
				count1 ++
			}
		}
		fmt.Printf("%d %d ", count1, count2)

		if count1 % 2 == 1 {
			fmt.Printf("NO\n")
			continue
		}
		if count2 % 2 == 1 && count1 == 0 {
			fmt.Printf("NO\n")
			continue
		}

		fmt.Printf("YES\n")
	}
}

package main

import "fmt"

func main() {
	var totalTests int
	_, _ = fmt.Scanf("%d\n", &totalTests)
	for i := 0; i < totalTests; i ++ {
		var n int
		count1, count2 := 0, 0
		_, _ = fmt.Scanf("%d\n", &n)
		for j := 0; j < n; j ++ {
			var candy int
			_, _ = fmt.Scanf("%d", &candy)
			if candy == 2 {
				count2 ++
			} else {
				count1 ++
			}
		}
		fmt.Printf("%d %d ", count1, count2)

		if count1 % 2 == 1 {
			fmt.Printf("NO\n")
			continue
		}
		if count2 % 2 == 1 && count1 == 0 {
			fmt.Printf("NO\n")
			continue
		}

		fmt.Printf("YES\n")
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)
var (
    input = bufio.NewReader(os.Stdin)
    output = bufio.NewWriter(os.Stdout)
)

func assert(test bool) {
    if !test {panic("assertion!")}
}

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
func main() {
    var t int
	fmt.Fscan(input, &t)
    for t > 0 {
        t--
        solve()
    }
    output.Flush()
}

func solve() {
    var n, o, t int
    fmt.Fscan(input, &n)
    for i := 0; i < n; i++ {
        var tmp int
        fmt.Fscan(input, &tmp)
        if tmp == 1 {
            o++
        } else {
            t++
        }
    }
    t %= 2
    if o & 1 == 1 || o <= t*2  {
        fmt.Fprintln(output, "No")
    } else {
        fmt.Fprintln(output, "Yes")
    }
}

package main

import (
	"bufio"
	"fmt"
	"os"
)
var (
    input = bufio.NewReader(os.Stdin)
    output = bufio.NewWriter(os.Stdout)
)

func assert(test bool) {
    if !test {panic("assertion!")}
}

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
func main() {
    var t int
	fmt.Fscan(input, &t)
    for t > 0 {
        t--
        solve()
    }
    output.Flush()
}

func solve() {
    var n, o, t int
    fmt.Fscan(input, &n)
    for i := 0; i < n; i++ {
        var tmp int
        fmt.Fscan(input, &tmp)
        if tmp == 1 {
            o++
        } else {
            t++
        }
    }
    if o & 1 == 1 || t & 1 == 1 {
        fmt.Fprintln(output, "No")
    } else {
        fmt.Fprintln(output, "Yes")
    }
}

package main

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

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

	var n, t, candy int
	for fmt.Fscan(r, &t); t > 0; t-- {
		n1 := 0
		n2 := 0
		for fmt.Fscan(r, &n); n > 0; n-- {
			fmt.Fscan(r, &candy)
			switch candy {
			case 1:
				n1++
			default:
				n2++
			}
		}
		if n1%2 == 0 && n2%2 == 0 {
			fmt.Fprintln(w, "YES")
		} else {
			fmt.Fprintln(w, "NO")
		}
	}
}

package main

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

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

	var t int;

	fmt.Fscan(reader, &t);

    var n, a int;

    var c [2]int;

    for i := 0; i < t; i++ {
        fmt.Fscan(reader, &n);

        c[0] = 0;
        c[1] = 0;

        for j := 0; j < n; j++ {
            fmt.Fscan(reader, &a);

            c[a - 1]++;
        }

        c[1] %= 2;

        c[0] -= (c[1] * 2);

        if (c[0] > 0 && c[0] % 2 == 0) {
            fmt.Println("YES");
        } else {
            fmt.Println("NO");
        }
    }
}

package main

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

func main() {
	var n, t, w int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &n)
		sum := 0
		for j := 0; j < n; j++ {
			fmt.Fscan(in, &w)
			sum += w
		}
		if sum%2 == 0 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

func main() {
	bf := bufio.NewReader(os.Stdin)
	ln, _ := bf.ReadString('\n')
	n, _ := strconv.ParseInt(ln[:len(ln)-1], 10 , 32)
	for ; n > 0; n-- {
		ln, _ = bf.ReadString('\n')
		t, _ := strconv.ParseInt(ln[:len(ln)-1], 10 , 32)
		ln, _ = bf.ReadString('\n')
		values := strings.Split(ln[:len(ln)-1], " ")
		one, two := 0, 0
		for i:=0; t > 0; t--{
			num, _:= strconv.Atoi(values[i] )
			if num == 1 {
				one+= 1
			} else {
				two+= 1
			}
			i++
		}

		alice, bob := 0, 0

		for two > 0 {
			if alice <= bob {
				alice += 2
			} else {
				bob += 2
			}
			two--
		}

		for one > 0 {
			if alice <= bob {
				alice += 1
			} else {
				bob += 1
			}
			one--
		}

		if alice == bob {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}

	}

}

package main

// https://codeforces.com/problemset/problem/1472/B

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

func main() {

	buf := make([]byte, 0, 1000000)

	reader := bufio.NewScanner(os.Stdin)
	// lielaks buferis
	reader.Buffer(buf, 1000000)
	reader.Scan()

	//	m := reader.Text()

	for reader.Scan() {
		reader.Scan()
		queryLine := reader.Text()

		query := strings.Split(queryLine, " ")
		total1 := 0
		total2 := 0

		for _, candy := range query {

			i, _ := strconv.Atoi(string(candy))

			if i == 1 {
				total1++
			}
			if i == 2 {
				total2++
			}

		}

		if total1 == 0 {
			if total2%2 == 0 {
				fmt.Print("YES")
			} else {
				fmt.Print("NO")
			}
		} else {
			if total1%2 == 1 {
				fmt.Println("NO")
			} else {
				fmt.Println("YES")
			}
		}

		//		fmt.Println(total1, " : ", total2)
	}

}

package main

import "fmt"

func main() {
	var (
		n        int
		i        int
		k        int
		j        int
		weigh    int
		mapWeigh = map[int]int{1: 0, 2: 0}
	)

	fmt.Scan(&n)
	for i = 0; i < n; i++ {
		fmt.Scan(&k)
		mapWeigh[1] = 0
		mapWeigh[2] = 0
		for j = 0; j < k; j++ {
			fmt.Scan(&weigh)
			mapWeigh[weigh]++
		}
		if mapWeigh[1]%2 == 0 && mapWeigh[1] > 2 || mapWeigh[2]%2 == 0 && mapWeigh[1]%2 == 0 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
	t   int16
	n   int8
)

func main() {
	defer out.Flush()

	fmt.Fscan(in, &t)

	for ; t > 0; t-- {

		fmt.Fscan(in, &n)

		if n == 1 {
			fmt.Fprintln(out, "NO")
			continue
		}

		a := make([]int16, n)

		one := int8(0)

		for i := range a {
			fmt.Fscan(in, &a[i])
			if a[i] == 1 {
				one++
			}
		}

		if one%2 == 1 {
			fmt.Fprintln(out, "NO")
			continue
		}

		two := n - one

		if two%2 == 0 {
			fmt.Fprintln(out, "YES")
			continue
		}

		if one >= 2 {
			fmt.Fprintln(out, "YES")
			continue
		}

		fmt.Fprintln(out, "NO")

	}
}