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, 4096), 1e9)
}

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

func sint64() int64 {
	s := sstring()
	i := int64(0)
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int64(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int64(r - '0')
	}
	return i
}

func sint64s(n int64) []int64 {
	a := make([]int64, n)
	for i := range a {
		a[i] = sint64()
	}
	return a
}

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

func main() {
	defer writer.Flush()
	for t := sint64(); t > 0; t-- {
		n := sint64()
		a := sint64s(n * 2)
		printf("%s\n", sol(a))
	}
}

func sol(a []int64) string {
	p := [2]int64{0, 0}
	for i := range a {
		p[a[i]&1]++
	}
	if p[0] == p[1] {
		return "Yes"
	}
	return "No"
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		var n, curr, m int
		fmt.Scan(&n)
		for j := 0; j < 2*n; j++ {
			fmt.Scan(&curr)
			if curr%2 == 0 {
				m++
			} else {
				m--
			}
		}
		if m == 0 {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}

package main

import "fmt"

func solver() {
	var n = 0
	var x int
	fmt.Scan(&n)
	odd := 0
	for i := 0; i < 2*n; i++ {
		fmt.Scan(&x)
		if x % 2 == 1 {
			odd++
		}
	}

	if odd == n {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

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

package main

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

// четных и нечетных должно быть одинаково
// повторяющихся должно быть не больше количества пар
func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()

	testCount, _ := strconv.Atoi(scanner.Text())

	for i := 0; i < testCount; i++ {
		scanner.Scan()
		n, _ := strconv.Atoi(scanner.Text())

		scanner.Scan()
		input := scanner.Text()

		inputList := make([]int, 0, 100)
		for _, p := range strings.Split(input, " ") {
			o, _ := strconv.Atoi(p)
			inputList = append(inputList, o)
		}

		var sum, even, odd int
		var repeatedCount = make(map[int]int, len(inputList))
		for _, s := range inputList {
			sum += s
			if s%2 == 0 {
				odd++
			} else {
				even++
			}

			repeatedCount[s]++
		}
		var mostRepeated int
		for _, c := range repeatedCount {
			if c > mostRepeated {
				mostRepeated = c
			}
		}

		if mostRepeated > n || odd != even {
			fmt.Println("No")
			continue
		}

		if (n%2 == 0 && sum%2 != 0) || (n%2 != 0 && sum%2 == 0) {
			fmt.Println("No")
			continue
		}

		fmt.Println("Yes")
	}
}

package main

import "fmt"

func main() {
	var t int
	ans := []bool{}
	fmt.Scan(&t)
	for t > 0 {
		var n int
		fmt.Scan(&n)
		var read int
		even, odd := 0, 0
		for i := 0; i < 2*n; i++ {
			fmt.Scan(&read)
			if read%2 == 0 {
				even++
			} else {
				odd++
			}
		}
		if even == odd {
			ans = append(ans, true)
		} else {
			ans = append(ans, false)
		}
		t--
	}
	for _, v := range ans {
		if v {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}

package main

import "fmt"

func main(){
	tt := 0
	fmt.Scan(&tt)
	for j := 0; j < tt; j++ {
		n := 0
		fmt.Scan(&n)
		array := make([]int, n*2)
		chet := 0
		nechet := 0
		for i := 0; i < n*2; i++ {
			fmt.Scan(&array[i])
			if array[i] % 2 == 0 {
				chet++
			} else {
				nechet++
			}
		}
		if chet == nechet {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}

package main

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

func main() {
	io := NewIO(os.Stdin, os.Stdout)
	t := io.ReadInt()
	for ;t>0;t-- {
		nechet := 0
		n := io.ReadInt()
		a := io.ReadIntSlice(n * 2)
		for _, v := range a {
			if v % 2 == 1 {
				nechet++
			}
		}
		if nechet == n {
			io.Println("Yes")
		} else {
			io.Println("No")
		}
	}
}

package main

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

type Scanner struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) *Scanner {
	scanner := bufio.NewScanner(reader)
	scanner.Split(bufio.ScanWords)
	return &Scanner{scanner}
}

func (s *Scanner) Word() string {
	s.Scan()
	return s.Text()
}

func (s *Scanner) Int() int {
	s.Scan()
	n, _ := strconv.Atoi(s.Text())
	return n
}

func (s *Scanner) Int64() int64 {
	s.Scan()
	n, _ := strconv.ParseInt(s.Text(), 10, 64)
	return n
}

func (s *Scanner) Ints(count int) []int {
	ints := make([]int, count)
	for i := range ints {
		ints[i] = s.Int()
	}
	return ints
}

func (s *Scanner) Int64s(count int) []int64 {
	int64s := make([]int64, count)
	for i := range int64s {
		int64s[i] = s.Int64()
	}
	return int64s
}

func possible(nums []int) bool {
	even := 0
	odd := 0

	for _, num := range nums {
		if num%2 == 0 {
			even += 1
		} else {
			odd += 1
		}
	}
	return even == odd
}

func main() {
	stdin := NewWordScanner(os.Stdin)
	tests := stdin.Int()

	for i := 0; i < tests; i += 1 {
		n := stdin.Int()
		nums := stdin.Ints(2 * n)

		if possible(nums) {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}

package main

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

const N = int(1e5 + 10)

func main() {
	io := NewFastIO(os.Stdin, os.Stdout)
	defer io.Flush()
	t := 1
	t = io.NextInt()

	for tt := 0; tt < t; tt++ {
		solve := func() {
			n := io.NextInt()
			v := 0
			for i := 0; i < 2*n; i++ {
				x := io.NextInt()
				v += (x & 1)
			}
			if v == n {
				io.Println("Yes")
			} else {
				io.Println("No")
			}
		}
		solve()
	}
}

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

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

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

type FastIO struct {
	*bufio.Reader
	*bufio.Writer
	c [1]byte
}

func NewFastIO(r io.Reader, w io.Writer) *FastIO {
	return &FastIO{Reader: bufio.NewReader(r), Writer: bufio.NewWriter(w)}
}

func (f *FastIO) readC() byte {
	f.Read(f.c[:])
	return f.c[0]
}

func (f *FastIO) NextInt() int {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	neg := false
	if c == '-' {
		neg = true
		c = f.readC()
	}
	n := 0
	for ; '0' <= c && c <= '9'; c = f.readC() {
		n = n*10 + int(c) - '0'
	}
	if neg {
		return -n
	}
	return n
}

func (f *FastIO) NextInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = f.NextInt()
	}
	return a
}

func (f *FastIO) Next() string {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	var s []byte
	for ; c > ' '; c = f.readC() {
		s = append(s, f.c[0])
	}
	return string(s)
}

func (f *FastIO) Println(a ...interface{}) {
	fmt.Fprintln(f.Writer, a...)
}

func (f *FastIO) Print(a ...interface{}) {
	fmt.Fprint(f.Writer, a...)
}

func (f *FastIO) PrintInts(a ...int) {
	if len(a) > 0 {
		f.Print(a[0])
		for _, x := range a[1:] {
			f.Print(" ", x)
		}
	}
}

func (f *FastIO) PrintlnInts(a ...int) {
	f.PrintInts(a...)
	f.Println()
}

package main

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

func test() (a int)  {

	defer func() {
		a =+5
	}()

	a = 0

	return a
}

func binSearch(sim []int, findElement int) (int)  {

	low := 0
	hight := len(sim)

	for (low < hight) {
		mid := (low + hight)/2

		if sim[mid] == findElement {
			return sim[mid]
		}

		if findElement < sim[mid] {
			hight = mid
		}

		if findElement > sim[mid] {
			low = mid
		}

		fmt.Println("low ->", low)
		fmt.Println("hight ->", hight)
		fmt.Println("mid ->", mid)
		fmt.Println("------------")
	}

	return 0
}

func sortEasy(input []int, output *[]int)  {

	for i := 0; i < len(input); i++ {
		for j := 0; j < len(input)-1; j++ {
			if input[j] > input[j+1] {
				temp := input[j+1]
				input[j+1] = input[j]
				input[j] = temp
			}

			fmt.Println(input)
		}
	}

	copy(*output, input)
}

func main() {

	//simple := []int{5,100,2,94}

	//fmt.Println(binSearch(simple, 96))

	//sorted := make([]int, 100)
 	//sortEasy(simple, &sorted)
	//
	//fmt.Println(sorted)

 	scan := bufio.NewScanner(os.Stdin)

 	scan.Scan()

 	count, err := strconv.Atoi(scan.Text())

 	if err != nil {
 		log.Fatal(err)
	}

	for i := 0; i < count; i++ {
		scan.Scan()
		coup, err := strconv.Atoi(scan.Text())

		if err != nil {
			log.Fatal(err)
		}

		scan.Scan()

		elemets := strings.Split(scan.Text(), " ")

		an := 0

		for i := 0; i < coup * 2 ; i++ {
			t1 , _ := strconv.Atoi(elemets[i])

			if t1 % 2 == 0{
				an++
			} else {
				an--
			}

		}

		if an == 0 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}

	}
}

package main

import (
	"fmt"
)

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

	for i := 0; i < t; i++ {

		var n int
		_, err := fmt.Scan(&n)
		if err != nil {
			panic(err)
		}

		numbers := make([]int, 2*n)
		for i := 0; i < 2*n; i++ {
			_, err := fmt.Scan(&numbers[i])
			if err != nil {
				panic(err)
			}
		}

		if solve(numbers) {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}

func solve(numbers []int) bool {
	var odd = 0
	var not_odd = 0

	for _, v := range numbers {
		if v%2 == 0 {
			not_odd++
		} else {
			odd++
		}
	}

	return odd == not_odd
}

package main

import (
	"fmt"
)

func main() {
	var n, t, a, chc, nc int
	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		fmt.Scan(&n)
		for j := 0; j <= 2*n-1; j++ {
			fmt.Scan(&a)
			if a%2 == 0 {
				chc += 1
			} else {
				nc += 1
			}
		}
		if chc == nc {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
		chc = 0
		nc = 0
	}
}

package main

import (
	"fmt"
)

func main() {
	var n, t, a, chc, nc int
	fmt.Scan(&t)
	arr := make([]string, t)
	for i := 0; i < t; i++ {
		fmt.Scan(&n)
		for j := 0; j <= 2*n-1; j++ {
			fmt.Scan(&a)
			if a%2 == 0 {
				chc += 1
			} else {
				nc += 1
			}
		}
		if chc == nc {
			arr[i] = "Yes"
		} else {
			arr[i] = "No"
		}
		chc = 0
		nc = 0
	}
	for i := 0; i < t; i++ {
		fmt.Println(arr[i])
	}
}

package main
import(
    "fmt"
)
func main() {
	var t int
	fmt.Scan(&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Scan(&n)
		var odds,evens int
		for j:=0;j<n;j++{
			var x,y int
			fmt.Scan(&x,&y)
			if x%2==0{
				evens++
			} else {
				odds++
			}
			if y%2==0{
				evens++
			} else {
				odds++
			}
		}
		if odds == evens {
			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) (_b bool) {
		var n int
		Fscan(in, &n)
		a := make([]int, 2*n)
		c := [2]int{}
		for i := range a {
			Fscan(in, &a[i])
			c[a[i]&1]++
		}
		return c[0] == c[1]
	}

	var T int
	Fscan(in, &T)
	for Case := 1; Case <= T; Case++ {
		if solve(Case) {
			Fprintln(out, "Yes")
		} else {
			Fprintln(out, "No")
		}
	}

	_leftData, _ := ioutil.ReadAll(in)
	if _s := strings.TrimSpace(string(_leftData)); _s != "" {
		panic("有未读入的数据：\n" + _s)
	}
}

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

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

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

        var t int
        fmt.Fscan(in, &t)

        for i := 0; i < t; i++ {
                n := 0
                var x int
                fmt.Fscan(in, &n)
                odd := 0
                for i := 0; i < 2*n; i++ {
                        fmt.Fscan(in, &x)
                        if x%2 == 1 {
                                odd++
                        }
}
                        if odd == n {
                                fmt.Fprintln(out, "YES")
                        } else {
                                fmt.Fprintln(out, "NO")
                        }
        }
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scan(&t)
	for cas := 0; cas < t; cas++ {
		var n int
		fmt.Scan(&n)
		a := make([]int, 2*n)
		for i := 0; i < 2*n; i++ {
			fmt.Scan(&a[i])
		}
		cnt := 0
		for i := 0; i < 2*n; i++ {
			if a[i]&1 == 1 {
				cnt++
			}
		}
		if cnt == n {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	fmt.Scan(&t)
	for count := 0; count < t; count++ {
		var n int
		fmt.Scan(&n)
		n += n
		a, b := 0, 0
		var x int
		for i := 0; i < n; i++ {
			fmt.Scan(&x)
			if x%2 == 0 {
				a++
			} else {
				b++
			}
		}
		if a == b {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}

package main

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

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

	var tcs int
	_, _ = fmt.Fscan(in, &tcs)

	for tc := 0; tc < tcs; tc++ {
		var n int
		_, _ = fmt.Fscan(in, &n)

		var odd, even int
		for i := 0; i < 2*n; i++ {
			var temp int
			_, _ = fmt.Fscan(in, &temp)

			if temp%2 == 0 {
				even++
			} else {
				odd++
			}
		}

		if odd == even {
			_, _ = fmt.Fprintln(out, "Yes")
		} else {
			_, _ = fmt.Fprintln(out, "No")
		}
	}

	_ = out.Flush()
}

package main

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

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

package main

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

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

func readLineNumbs(in *bufio.Reader) []string {
	line, _ := in.ReadString('\n')
	line = strings.ReplaceAll(line, "\r", "")
	line = strings.ReplaceAll(line, "\n", "")
	numbs := strings.Split(line, " ")
	return numbs
}

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

func Solve(in []int) string {
	var even, odd int

	for _, v := range in {
		if v%2 == 0 {
			even++
		} else {
			odd++
		}
	}

	if even == odd {
		return "Yes"
	}

	return "No"
}

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

	for i := 0; i < n; i++ {
		_ = readInt(in)

		input := readArrInt(in)

		res := Solve(input)
		fmt.Printf("%s\n", res)
	}
}

package main

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

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

func main() {
	defer output.Flush()
	var t int
	fmt.Fscan(input, &t)
	for t > 0 {
		t--
		solve()
	}
}

func solve() {
	var n int
	fmt.Fscan(input, &n)
	odd := 0
	for i := 0; i < 2*n; i++ {
		var val int
		fmt.Fscan(input, &val)
		if val & 1 == 1 { odd++ }
	}
	if odd == n {
		fmt.Fprintln(output, "YES")
	} else {
		fmt.Fprintln(output, "NO")
	}
}

package main

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

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

func solve(n int, a []int) string {
	var e int
	for _, x := range a {
		if x%2 == 0 {
			e++
		}
	}
	if e == n {
		return "Yes"
	}
	return "No"
}

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

package main

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

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

	var buf bytes.Buffer

	tc := readNum(reader)

	for tc > 0 {
		tc--
		n := readNum(reader)
		A := readNNums(reader, 2*n)
		res := solve(A)
		if res {
			buf.WriteString("Yes\n")
		} else {
			buf.WriteString("No\n")
		}
	}

	fmt.Print(buf.String())
}

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

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

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

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

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

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

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

	return i
}

func solve(A []int) bool {
	var cnt int
	for i := 0; i < len(A); i++ {
		cnt += A[i] & 1
	}
	return cnt == len(A)/2
}

package main

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

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

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

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

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

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

/**
 Run solve the problem CF1542A
 Date: 21/08/21
 User: pepradere
 URL: https://codeforces.com/problemset/problem/1542/A
 Problem: CF1542A
**/
func (in *CF1542A) Run() {
	n := in.NextInt()
	for ; n > 0; n-- {
		t := in.NextInt()
		odd := 0
		even := 0
		for i := 0; i < 2*t; i++ {
			num := in.NextInt()
			if num %2 == 0{
				even++
			} else {
				odd++
			}
		}
		if odd == even && odd == t {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}

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

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

package main

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

func solve(n int32, arr []int32) string {
	evens := int32(0)
	for _, value := range arr {
		if value%2 == 0 {
			evens++
		}
	}
	if evens == n {
		return "YES"
	} else {
		return "NO"
	}
}

func arrayScanf(in *bufio.Reader, n int32, arr *[]int32) {
	m := int32(0)
	for i := int32(0); i < 2*n; i++ {
		if i > 0 {
			fmt.Fscanf(in, " ")
		}
		fmt.Fscanf(in, "%d", &m)
		*arr = append(*arr, m)
	}
	fmt.Fscanf(in, "\n")
}

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)
		arr := []int32{}
		fmt.Fscanf(in, "%d\n", &n)
		arrayScanf(in, n, &arr)
		fmt.Fprintf(out, "%s\n", solve(n, arr))
		tt--
	}
	out.Flush()
}

package main

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

// var m []int
// err = json.Unmarshal([]byte(r.FormValue("example")), &m)

// for i := 0; i < len(m); i++ {
// 	fmt.Println(m[i])
// }

// sort.Slice(arr, func(i, j int) bool {
// 	return arr[i] > arr[j]
// })

func MIN(x, y int64) int64 {
	if x > y {
		return y
	} else {
		return x
	}
}

func MKO(x, y int64) int64 {
	if x < y {
		return 0
	} else {
		return x - y + 1
	}
}

func MAX(x, y int64) int64 {
	if x > y {
		return x
	} else {
		return y
	}
}

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

func GCD(x, y int64) int64 {
	var l, q int64
	l = MAX(x, y)
	q = MIN(x, y)
	var m int64
	for l*q > 0 {
		a := l % q
		b := l - a
		cc := int64(b / q)
		remain := l - cc*q
		l = MAX(remain, q)
		q = MIN(remain, q)
		if l*q == 0 {
			m = l + q
			break
		}

	}
	return m
}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}
}

func PrimeFactorization(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

func NumberOfDivisors(n int) int {
	pfs := PrimeFactorization(n)

	num := 1
	for _, exponents := range pfs {
		num *= (exponents + 1)
	}

	return num
}

func KthPrime(x int) (y int) {
	if x == 1 {
		y = 2
	}
	if x == 2 {
		y = 3
	}
	if x > 2 {
		var sum int = 2
		begin := 5
		for sum < x+1 {
			if IsItPrime(begin) == true {
				sum++
			}
			if sum == x {
				y = begin
				break
			} else {
				if begin%6 == 1 {
					begin = begin + 4
				} else {
					begin = begin + 2
				}
			}
		}
	}
	return
}

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 odd, even int
		for i := 0; i < 2*n; i++ {
			var m int
			fmt.Fscan(input, &m)
			if m%2 == 0 {
				even++
			} else {
				odd++
			}
		}
		if even == odd {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}

	}

}

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)

		ARRAY := make([]int64, 2*n)

		for i := 0; i < 2*n; i++ {
			fmt.Fscan(input, &ARRAY[i])
		}

		var count int = 0

		for _, element := range ARRAY {
			if element % 2 == 0 {
				count += 1
			}
		}

		if count == n {
			fmt.Println("Yes")
		}else{
			fmt.Println("No")
		}

	}
}

package main

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

func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	solve := func() {
		var n int
		Fscan(in, &n)
		a := make([]int, n*2)
		cnt := 0
		for i := range a {
			Fscan(in, &a[i])
			if a[i]%2 == 1 {
				cnt++
			}
		}
		if cnt == n {
			Fprintln(out, "Yes")
		} else {
			Fprintln(out, "No")
		}
	}
	var T int
	Fscan(in, &T)
	for i := 0; i < T; i++ {
		solve()
	}
}

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

package main

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

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

	var t int
	fmt.Fscan(r, &t)

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

		a := make([]int, 2 * n)
		for j := 0; j < 2 * n; j++ {
			fmt.Fscan(r, &a[j])
		}

		solve(a, n)
	}
}

func solve(a []int, n int) {
	var odd int
	var even int

	for  i := 0; i < 2 * n; i++ {
		if a[i] % 2 == 0 {
			even++
		} else {
			odd++
		}
	}

	if odd == even {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

package main

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

func test() (a int)  {

	defer func() {
		a =+5
	}()

	a = 0

	return a
}

func binSearch(sim []int, findElement int) (int)  {

	low := 0
	hight := len(sim)

	for (low < hight) {
		mid := (low + hight)/2

		if sim[mid] == findElement {
			return sim[mid]
		}

		if findElement < sim[mid] {
			hight = mid
		}

		if findElement > sim[mid] {
			low = mid
		}

		fmt.Println("low ->", low)
		fmt.Println("hight ->", hight)
		fmt.Println("mid ->", mid)
		fmt.Println("------------")
	}

	return 0
}

func sortEasy(input []int, output *[]int)  {

	for i := 0; i < len(input); i++ {
		for j := 0; j < len(input)-1; j++ {
			if input[j] > input[j+1] {
				temp := input[j+1]
				input[j+1] = input[j]
				input[j] = temp
			}

			fmt.Println(input)
		}
	}

	copy(*output, input)
}

func main() {

	//simple := []int{5,100,2,94}

	//fmt.Println(binSearch(simple, 96))

	//sorted := make([]int, 100)
 	//sortEasy(simple, &sorted)
	//
	//fmt.Println(sorted)

 	scan := bufio.NewScanner(os.Stdin)

 	scan.Scan()

 	count, err := strconv.Atoi(scan.Text())

 	if err != nil {
 		log.Fatal(err)
	}

	for i := 0; i < count; i++ {
		scan.Scan()
		//coup, err := strconv.Atoi(scan.Text())

		if err != nil {
			log.Fatal(err)
		}

		scan.Scan()

		elemets := strings.Split(scan.Text(), " ")

		state := true
		for i := 0; i <= len(elemets)-1; i = i+2 {
			t1 , _ := strconv.Atoi(elemets[i])
			t2, _ := strconv.Atoi(elemets[i+1])

			sum := t1+t2

			if sum % 2 == 0 {
				fmt.Println("NO")
				state = false
				break
			}
		}

		if state {
			fmt.Println("YES")
		}

	}
}

package main

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

func test() (a int)  {

	defer func() {
		a =+5
	}()

	a = 0

	return a
}

func binSearch(sim []int, findElement int) (int)  {

	low := 0
	hight := len(sim)

	for (low < hight) {
		mid := (low + hight)/2

		if sim[mid] == findElement {
			return sim[mid]
		}

		if findElement < sim[mid] {
			hight = mid
		}

		if findElement > sim[mid] {
			low = mid
		}

		fmt.Println("low ->", low)
		fmt.Println("hight ->", hight)
		fmt.Println("mid ->", mid)
		fmt.Println("------------")
	}

	return 0
}

func sortEasy(input []int, output *[]int)  {

	for i := 0; i < len(input); i++ {
		for j := 0; j < len(input)-1; j++ {
			if input[j] > input[j+1] {
				temp := input[j+1]
				input[j+1] = input[j]
				input[j] = temp
			}

			fmt.Println(input)
		}
	}

	copy(*output, input)
}

func main() {

	//simple := []int{5,100,2,94}

	//fmt.Println(binSearch(simple, 96))

	//sorted := make([]int, 100)
 	//sortEasy(simple, &sorted)
	//
	//fmt.Println(sorted)

 	scan := bufio.NewScanner(os.Stdin)

 	scan.Scan()

 	count, err := strconv.Atoi(scan.Text())

 	if err != nil {
 		log.Fatal(err)
	}

	for i := 0; i < count; i++ {
		scan.Scan()
		coup, err := strconv.Atoi(scan.Text())

		if err != nil {
			log.Fatal(err)
		}

		scan.Scan()

		elemets := strings.Split(scan.Text(), " ")

		for i := 0; i <= coup; i = i+2 {
			t1 , _ := strconv.Atoi(elemets[i])
			t2, _ := strconv.Atoi(elemets[i+1])

			sum := t1+t2

			if sum % 2 == 0 {
				fmt.Println("NO")
				return
			}
		}

		fmt.Println("YES")

	}
}

package main

import (
	"fmt"
)

func main() {
	var n, t, a, chc, nc int
	fmt.Scanln(&t)
	arr := make([]string, t)
	for i := 0; i < t; i++ {
		fmt.Scanln(&n)
		for j := 0; j <= 2*n-1; j++ {
			fmt.Scan(&a)
			if a%2 == 0 {
				chc += 1
			} else {
				nc += 1
			}
		}
		if chc == nc {
			arr[i] = "Yes"
		} else {
			arr[i] = "No"
		}
		chc = 0
		nc = 0
	}
	for i := 0; i < t; i++ {
		fmt.Println(arr[i])
	}
}

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

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

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

        var t int
        fmt.Fscan(in, &t)

        for i := 0; i < t; i++ {
                n := 0
                var x int
                fmt.Fscan(in, &n)
                odd := 0
                for i := 0; i < 2*n; i++ {
                        fmt.Fscan(in, &x)
                        if x%2 == 1 {
                                odd++
                        }
                        if odd == n {
                                fmt.Fprintln(out, "YES")
                        } else {
                                fmt.Fprintln(out, "NO")
                        }
                }
        }
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scan(&t)
	for cas := 0; cas < t; cas++ {
		var n int
		fmt.Scan(n)
		a := make([]int, 2*n)
		for i := 0; i < 2*n; i++ {
			fmt.Scan(&a[i])
		}
		cnt := 0
		for i := 0; i < 2*n; i++ {
			if a[i]&1 == 1 {
				cnt++
			}
		}
		if cnt == n {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	fmt.Scan(&t)
	for count := 0; count < t; count++ {
		var n int
		fmt.Scan(&n)
		n += n
		a, b := 0, 0
		var x int
		for i := 0; i < n; i++ {
			fmt.Scan(&x)
			if x%2 == 0 {
				a++
			} else {
				b++
			}
		}
		if a == b {
			fmt.Println("Yes")
		} else {
			fmt.Print("No")
		}
	}
}

package main

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

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

	var tcs int
	_, _ = fmt.Fscan(in, &tcs)

	for tc := 0; tc < tcs; tc++ {
		var n int
		_, _ = fmt.Fscan(in, &n)

		var odd, even int
		for i := 0; i < n; i++ {
			var temp int
			_, _ = fmt.Fscan(in, &temp)

			if temp%2 == 0 {
				even++
			} else {
				odd++
			}
		}

		if odd == even {
			_, _ = fmt.Fprintln(out, "Yes")
		} else {
			_, _ = fmt.Fprintln(out, "No")
		}
	}

	_ = out.Flush()
}


package main

import (
	"bufio"
	"bytes"
	. "fmt"
	"io"
	"io/ioutil"
	"os"
	"sort"
	"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) {
		var s []byte
		var t string
		Fscan(in, &s, &t)
		if t == "abc" && bytes.Contains(s, []byte{'a'}) && bytes.Contains(s, []byte{'b'}) && bytes.Contains(s, []byte{'c'}) {
			sort.Slice(s, func(i, j int) bool {
				a, b := s[i], s[j]
				if a == 'b' && b == 'c' {
					return false
				}
				if a == 'c' && b == 'b' {
					return true
				}
				return a < b
			})
		} else {
			sort.Slice(s, func(i, j int) bool { return s[i] < s[j] })
		}
		Fprintf(out, "%s\n", s)
	}

	T := 1
	Fscan(in, &T)
	for Case := 1; Case <= T; Case++ {
		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"
	"sort"
	"strconv"
	"strings"
)

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

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

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

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

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

/**
Run solve the problem CF1617A
Date: 24/06/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1617/A
Problem: CF1617A
**/
func (in *CF1617A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		S := in.NextString()
		T := in.NextString()

		mapa := make(map[int]int)
		for i := 0; i < len(S); i++ {
			mapa[int(S[i])]++
		}

		key := make([]int, len(mapa))
		index := 0
		for k, _ := range mapa {
			key[index] = k
			index++
		}
		sort.Ints(key)

		ind := make([]int, 3)
		ind[0] = -1
		ind[1] = -1
		ind[2] = -1
		for i := 0; i < len(key); i++ {
			if key[i] == int(T[0]) {
				ind[0] = i
			}
			if key[i] == int(T[1]) {
				ind[1] = i
			}
			if key[i] == int(T[2]) {
				ind[2] = i
			}
		}

		if ind[1] < ind[2] && ind[1] != -1 && ind[2] != -1 && ind[0] != -1 && ind[0] < ind[1] {
			key[ind[1]], key[ind[2]] = key[ind[2]], key[ind[1]]
		}

		var str strings.Builder
		for i := 0; i < len(key); i++ {
			for j := 0; j < mapa[key[i]]; j++ {
				str.WriteString(string(rune(key[i])))
			}
		}

		fmt.Println(str.String())

	}
}

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

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

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var buf bytes.Buffer
	tc := readNum(reader)

	for tc > 0 {
		tc--
		S, _ := reader.ReadString('\n')
		T, _ := reader.ReadString('\n')
		res := solve(normalize(S), normalize(T))
		buf.WriteString(res)
		buf.WriteByte('\n')
	}
	fmt.Print(buf.String())
}

func normalize(s string) string {

	for i := len(s); i > 0; i-- {
		if s[i-1] >= 'a' && s[i-1] <= 'z' {
			return s[:i]
		}
	}
	return ""
}

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

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

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

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

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

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

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

	return i
}

func solve(S, T string) string {
	cnt := make([]int, 26)
	for i := 0; i < len(S); i++ {
		cnt[int(S[i]-'a')]++
	}
	var buf bytes.Buffer
	// only a, b, c matters
	var x int
	if cnt[0] > 0 && cnt[1] > 0 && cnt[2] > 0 {
		//abc => acb
		if T == "abc" {
			for cnt[0] > 0 {
				buf.WriteByte('a')
				cnt[0]--
			}
			for cnt[2] > 0 {
				buf.WriteByte('c')
				cnt[2]--
			}
			for cnt[1] > 0 {
				buf.WriteByte('b')
				cnt[1]--
			}
			x = 3
		}
	}

	for x < 26 {
		for cnt[x] > 0 {
			buf.WriteByte(byte(x + 'a'))
			cnt[x]--
		}
		x++
	}

	return buf.String()
}

package main

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

var (
	reader = bufio.NewReader(os.Stdin)
	t      int
	x, y   string
)

func solve(x, y string) string {
	var z = "abc"
	a := make(map[byte]int)
	for _, i := range x {
		a[byte(i)]++
	}

	if y == "abc" && a['a']*a['b']*a['c'] > 0 {
		z = "acb"
	}
	z += "defghijklmnopqrstuvwxyz"
	b := ""
	for _, i := range z {
		b += strings.Repeat(string(i), a[byte(i)])
	}
	return b
}

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

package main

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

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

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
// TODO***
// - read the statement carefully
// - get solution before coding
// - check the boundaries (int/int64)

func main() {
    defer output.Flush()
    //solve()
    //return
	var t int64
	fmt.Fscan(input, &t)
    for t > 0 {
        t--
        solve()
    }
}

type pair struct {a, b int}

func solve() {
    var s, t string
    fmt.Fscan(input, &s, &t)
    tab := make([]int, 256)
    for i := 0; i < len(s); i++ {
        tab[s[i]]++
    }

    ans := make([]byte, 0)
    if t == "abc" && (tab['a'] > 0 && tab['b'] > 0 && tab['c'] > 0) {
        for i := 0; i < len(tab); i++ {
            if tab[i] == 0 { continue }
            if byte(i) == 'b' {
                // append c
                for k := 0; k < tab['c']; k++ {
                    ans = append(ans, 'c')
                }
                continue
            }
            if byte(i) == 'c' {
                // append b
                for k := 0; k < tab['b']; k++ {
                    ans = append(ans, 'b')
                }
                continue
            }
            for k := 0; k < tab[i]; k++ {
                ans = append(ans, byte(i))
            }
        }
    } else {
        for i := 0; i < len(tab); i++ {
            for k := 0; k < tab[i]; k++ {
                ans = append(ans, byte(i))
            }
        }
    }

    fmt.Fprintln(output, string(ans))
}

func abs(x int) int {
    if x < 0 { return - x}
    return x
}
func max(a, b int) int {
    if a > b { return a}
    return b
}

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

func isPrime(v int) bool {
    if v == 1 { return false }
    for i := 2; i * i <= v; i++ {
        if v % i == 0 { return false }
    }
    return true
}

package main

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

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

func solve(s []byte, b string) string {
	var flag = b == "abc"
	flag = flag && bytes.ContainsRune(s, 'a') && bytes.ContainsRune(s, 'b') && bytes.ContainsRune(s, 'c')
	sort.Slice(s, func(i, j int) bool {
		if flag {
			if s[i] == 'c' && s[j] == 'b' {
				return true
			}
			if s[i] == 'b' && s[j] == 'c' {
				return false
			}
		}
		return s[i] < s[j]
	})
	return string(s)
}

func main() {
	var ntc int
	fmt.Fscan(in, &ntc)
	for t := 0; t < ntc; t++ {
		var a []byte
		var b string
		fmt.Fscan(in, &a, &b)
		fmt.Fprintf(out, "%s\n", solve(a, b))
	}
	out.Flush()
}

package main

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

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

func solve(a, b string) string {
	var s []rune = []rune(a)
	sort.Slice(s, func(i, j int) bool {
		return s[i] < s[j]
	})
	var n = len(s)
	var ai = sort.Search(n, func(i int) bool { return s[i] >= 'a' })
	var bi = sort.Search(n, func(i int) bool { return s[i] >= 'b' })
	var ci = sort.Search(n, func(i int) bool { return s[i] >= 'c' })
	var flag = b == "abc"
	flag = flag && ai < n && s[ai] == 'a'
	flag = flag && bi < n && s[bi] == 'b'
	flag = flag && ci < n && s[ci] == 'c'
	sort.Slice(s, func(i, j int) bool {
		if flag {
			if s[i] == 'c' && s[j] == 'b' {
				return true
			}
			if s[i] == 'b' && s[j] == 'c' {
				return false
			}
		}
		return s[i] < s[j]
	})
	return string(s)
}

func main() {
	var ntc int
	fmt.Fscan(in, &ntc)
	for t := 0; t < ntc; t++ {
		var a, b string
		fmt.Fscan(in, &a, &b)
		fmt.Fprintf(out, "%s\n", solve(a, b))
	}
	out.Flush()
}

package main

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

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

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

		chars := make([]int, 26)
		for i := 0; i < len(s); i++ {
			chars[s[i]-'a']++
		}

		var buf bytes.Buffer
		var start int
		if p == "abc" && chars[0] > 0 && chars[1] > 0 && chars[2] > 0 {
			start = 3
			for a := 0; a < chars[0]; a++ {
				buf.WriteRune('a')
			}
			for c := 0; c < chars[2]; c++ {
				buf.WriteRune('c')
			}
			for b := 0; b < chars[1]; b++ {
				buf.WriteRune('b')
			}
		}
		for i := start; i < 26; i++ {
			for j := 0; j < chars[i]; j++ {
				buf.WriteByte(byte(i + 'a'))
			}
		}

		fmt.Fprintln(out, buf.String())
	}
}

package main

import (
	"fmt"
	"sort"
)

type sortRunes struct {
	r []rune
}

func (s sortRunes) Less(i, j int) bool {
	return s.r[i] < s.r[j]
}

func (s sortRunes) Swap(i, j int) {
	s.r[i], s.r[j] = s.r[j], s.r[i]
}

func (s sortRunes) Len() int {
	return len(s.r)
}

func main() {

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

	for i := 0; i < int(testCases); i++ {
		var s string
		fmt.Scanf("%s\n", &s)
		sRunes := []rune(s)
		sort.Sort(sortRunes{sRunes})
		var t string
		fmt.Scanf("%s\n", &t)
		tRunes := []rune(t)
		sort.Sort(sortRunes{tRunes})
		if string(tRunes) != t || tRunes[0] != sRunes[0] {
			fmt.Println(string(sRunes))
		} else {
			result := make([]rune, 0, len(sRunes))
			goToEnd := tRunes[1]
			last := tRunes[2]
			counter := 0
			lastSeen := 0
			for _, rune := range sRunes {
				if rune == goToEnd {
					counter++
					continue
				}
				if rune == last {
					lastSeen = len(result)
				}
				result = append(result, rune)
			}
			for i := 0; i < counter; i++ {
				result = append(result, goToEnd)
			}
			sort.Sort(sortRunes{result[lastSeen+1:]})
			fmt.Println(string(result))
		}
	}
}

package main

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

func solve() {
	f := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	N := 0
	fmt.Fscan(f, &N)
	for i := 0; i < N; i++ {
		o, S, T := map[string]int{}, "", ""
		fmt.Fscan(f, &S, &T)
		S, T = strings.TrimSpace(S), strings.TrimSpace(T)
		ans, q, found := "", []rune(S), strings.Contains(S, "a") && strings.Contains(S, "b") && strings.Contains(S, "c")
		sort.Slice(q, func(i, j int) bool { return q[i] < q[j] })
		S = string(q)
		for j := 0; j < len(S); j++ {
			o[string(S[j])]++
		}
		if T == "abc" && found {
			T = "acb"
		} else {
			T = "abc"
		}
		for j := 0; j < 3; j++ {
			_, ok := o[string(T[j])]
			if ok {
				for l := 0; l < o[string(T[j])]; l++ {
					ans += string(T[j])
				}
			}
		}
		for j := 0; j < len(S); j++ {
			if string(S[j]) != "a" && string(S[j]) != "b" && string(S[j]) != "c" {
				ans += string(S[j])
			}
		}
		fmt.Fprintln(w, ans)
	}
	w.Flush()
}

func main() {
	solve()
}

package main

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

func solve() {
	f := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	N := 0
	fmt.Fscan(f, &N)
	for i := 0; i < N*2; i++ {
		o, S, T := map[string]int{}, "", ""
		fmt.Fscan(f, &S, &T)
		S, T = strings.TrimSpace(S), strings.TrimSpace(T)
		ans, q, found := "", []rune(S), strings.Contains(S, "a") && strings.Contains(S, "b") && strings.Contains(S, "c")
		sort.Slice(q, func(i, j int) bool { return q[i] < q[j] })
		S = string(q)
		for j := 0; j < len(S); j++ {
			o[string(S[j])]++
		}
		if T == "abc" && found {
			T = "acb"
		} else {
			T = "abc"
		}
		for j := 0; j < 3; j++ {
			_, ok := o[string(T[j])]
			if ok {
				for l := 0; l < o[string(T[j])]; l++ {
					ans += string(T[j])
				}
			}
		}
		for j := 0; j < len(S); j++ {
			if string(S[j]) != "a" && string(S[j]) != "b" && string(S[j]) != "c" {
				ans += string(S[j])
			}
		}
		fmt.Fprintln(w, ans)
	}
	w.Flush()
}

func main() {
	solve()
}

package main

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

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

func solve(a, b string) string {
	var s []rune = []rune(a)
	sort.Slice(s, func(i, j int) bool {
		if b == "abc" {
			if s[i] == 'c' && s[j] == 'b' {
				return true
			}
			if s[i] == 'b' && s[j] == 'c' {
				return false
			}
		}
		return s[i] < s[j]
	})
	return string(s)
}

func main() {
	var ntc int
	fmt.Fscan(in, &ntc)
	for t := 0; t < ntc; t++ {
		var a, b string
		fmt.Fscan(in, &a, &b)
		fmt.Fprintf(out, "%s\n", solve(a, b))
	}
	out.Flush()
}

package main

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

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

func solve(a, b string) string {
	var s []rune = []rune(a)
	sort.Slice(s, func(i, j int) bool {
		if b == "abc" {
			if s[i] == 'c' && s[j] == 'b' {
				return true
			}
		}
		return s[i] < s[j]
	})
	return string(s)
}

func main() {
	var ntc int
	fmt.Fscan(in, &ntc)
	for t := 0; t < ntc; t++ {
		var a, b string
		fmt.Fscan(in, &a, &b)
		fmt.Fprintf(out, "%s\n", solve(a, b))
	}
	out.Flush()
}

package main

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

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

func solve(a, b string) string {
	var s []rune = []rune(a)
	sort.Slice(s, func(i, j int) bool {
		return s[i] < s[j]
	})
	if b == "abc" {
		for i := 0; i < len(s); i++ {
			if s[i] == 'b' {
				s[i] = 'c'
			} else if s[i] == 'c' {
				s[i] = 'b'
			}
		}
	}
	return string(s)
}

func main() {
	var ntc int
	fmt.Fscan(in, &ntc)
	for t := 0; t < ntc; t++ {
		var a, b string
		fmt.Fscan(in, &a, &b)
		fmt.Fprintf(out, "%s\n", solve(a, b))
	}
	out.Flush()
}

package main

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

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

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

		chars := make([]int, 26)
		for i := 0; i < len(s); i++ {
			chars[s[i]-'a']++
		}

		var buf bytes.Buffer
		var start int
		if p == "abc" && chars[0] > 0 && chars[1] > 0 && chars[2] > 0 {
			start = 4
			for a := 0; a < chars[0]; a++ {
				buf.WriteRune('a')
			}
			for c := 0; c < chars[2]; c++ {
				buf.WriteRune('c')
			}
			for b := 0; b < chars[1]; b++ {
				buf.WriteRune('b')
			}
		}
		for i := start; i < 26; i++ {
			for j := 0; j < chars[i]; j++ {
				buf.WriteByte(byte(i + 'a'))
			}
		}

		fmt.Fprintln(out, buf.String())
	}
}

package main

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

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

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

		chars := make([]int, 26)
		for i := 0; i < len(s); i++ {
			chars[s[i]-'a']++
		}

		var buf bytes.Buffer
		for i := 0; i < 26; i++ {
			for j := 0; j < chars[i]; j++ {
				buf.WriteByte(byte(i + 'a'))
			}
		}

		if len(s) < 3 || p != "abc" {
			fmt.Fprintln(out, buf.String())
		} else {
			s := buf.String()
			bIdx := strings.IndexRune(s, 'b')
			cIdx := strings.IndexRune(s, 'c')
			if !strings.ContainsRune(s, 'a') || bIdx < 0 || cIdx < 0 {
				fmt.Fprintln(out, buf.String())
			} else {
				fmt.Fprintf(out, "%sc%sb%s\n", s[:bIdx], s[bIdx+1:cIdx], s[cIdx+1:])
			}
		}
	}
}

package main

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

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

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

		chars := make([]int, 26)
		for i := 0; i < len(s); i++ {
			chars[s[i]-'a']++
		}

		var buf bytes.Buffer
		for i := 0; i < 26; i++ {
			for j := 0; j < chars[i]; j++ {
				buf.WriteByte(byte(i + 'a'))
			}
		}

		if len(s) < 3 || p != "abc" {
			fmt.Fprintln(out, buf.String())
		} else {
			s := buf.String()
			bIdx := strings.IndexRune(s, 'b')
			cIdx := strings.IndexRune(s, 'c')
			if bIdx < 0 || cIdx < 0 {
				fmt.Fprintln(out, buf.String())
			} else {
				fmt.Fprintf(out, "%sc%sb%s\n", s[:bIdx], s[bIdx+1:cIdx], s[cIdx+1:])
			}
		}
	}
}

package main

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

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

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

		chars := make([]int, 26)
		for i := 0; i < len(s); i++ {
			chars[s[i]-'a']++
		}

		var buf bytes.Buffer
		for i := 0; i < 26; i++ {
			for j := 0; j < chars[i]; j++ {
				buf.WriteByte(byte(i + 'a'))
			}
		}

		if len(s) < 3 || p != "abc" {
			fmt.Fprintln(out, buf.String())
		} else {
			s := buf.String()
			if s[:3] == "abc" {
				fmt.Fprintf(out, "acb%s\n", s[3:])
			} else {
				fmt.Fprintf(out, "%sacb\n", s[:len(s)-3])
			}
		}
	}
}

package main

import (
	"fmt"
	"sort"
)

type sortRunes struct {
	r []rune
}

func (s sortRunes) Less(i, j int) bool {
	return s.r[i] < s.r[j]
}

func (s sortRunes) Swap(i, j int) {
	s.r[i], s.r[j] = s.r[j], s.r[i]
}

func (s sortRunes) Len() int {
	return len(s.r)
}

func main() {

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

	for i := 0; i < int(testCases); i++ {
		var s string
		fmt.Scanf("%s\n", &s)
		sRunes := []rune(s)
		sort.Sort(sortRunes{sRunes})
		var t string
		fmt.Scanf("%s\n", &t)
		tRunes := []rune(t)
		sort.Sort(sortRunes{tRunes})
		if string(tRunes) != t {
			fmt.Println(string(sRunes))
		} else {
			result := make([]rune, 0, len(sRunes))
			goToEnd := tRunes[1] // abc => b
			last := tRunes[2]    // abc => c
			counter := 0
			lastSeen := 0
			for _, rune := range sRunes { // s=> abracadabra aaaaabbcdrr aaaacbbdrr
				if rune == goToEnd {
					counter++
					continue
				}
				if rune == last {
					lastSeen = len(result)
				}
				result = append(result, rune)
			}
			for i := 0; i < counter; i++ {
				result = append(result, goToEnd)
			}
			sort.Sort(sortRunes{result[lastSeen+1:]})
			fmt.Println(string(result))
		}
	}
}

package main

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

func solve() {
	f := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	N, _ := 0, []string{"abc", "acb", "bac", "bca", "cab", "cba"}
	fmt.Fscan(f, &N)
	for i := 0; i < N*2; i++ {
		o, S, T := map[string]int{}, "", ""
		fmt.Fscan(f, &S, &T)
		ans, q, found := "", []rune(S), strings.Contains(S, "a") && strings.Contains(S, "b") && strings.Contains(S, "c")
		sort.Slice(q, func(i, j int) bool { return q[i] < q[j] })
		S = string(q)
		for j := 0; j < len(S); j++ {
			o[string(S[j])]++
		}
		if T == "abc" && found {
			T = "acb"
		} else {
			T = "abc"
		}
		for j := 0; j < 3; j++ {
			_, ok := o[string(T[j])]
			if ok {
				for l := 0; l < o[string(T[j])]; l++ {
					ans += string(T[j])
				}
			}
		}
		for k, v := range o {
			if k != "a" && k != "b" && k != "c" {
				for j := 0; j < v; j++ {
					ans += k
				}
			}
		}
		fmt.Fprintln(w, ans)
		w.Flush()
	}
}

func main() {
	solve()
}

package main

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

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

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

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

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

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

/**
Run solve the problem CF1617A
Date: 24/06/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1617/A
Problem: CF1617A
**/
func (in *CF1617A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		S := in.NextString()
		T := in.NextString()

		mapa := make(map[int]int)
		for i := 0; i < len(S); i++ {
			mapa[int(S[i])]++
		}

		key := make([]int, len(mapa))
		index := 0
		for k, _ := range mapa {
			key[index] = k
			index++
		}
		sort.Ints(key)

		ind := make([]int, 3)
		ind[0] = -1
		ind[1] = -1
		ind[2] = -1
		for i := 0; i < len(key); i++ {
			if key[i] == int(T[0]) {
				ind[0] = i
			}
			if key[i] == int(T[1]) {
				ind[1] = i
			}
			if key[i] == int(T[2]) {
				ind[2] = i
			}
		}

		if ind[1] < ind[2] && ind[1] != -1 && ind[2] != -1 && ind[0] != -1 {
			key[ind[1]], key[ind[2]] = key[ind[2]], key[ind[1]]
		}

		var str strings.Builder
		for i := 0; i < len(key); i++ {
			for j := 0; j < mapa[key[i]]; j++ {
				str.WriteString(string(rune(key[i])))
			}
		}

		fmt.Println(str.String())

	}
}

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

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


package main

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

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

func main() {
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		var n, k int
		fmt.Fscan(in, &n, &k)
		arr := make([]int, n)
		bits := make([]int, 32)

		for i := 0; i < n; i++ {
			fmt.Fscan(in, &arr[i])
			idx := 0
			for arr[i] > 0 {
				if (arr[i] % 2) == 1 {
					bits[idx]++
				}
				arr[i] /= 2
				idx++
			}
		}
		for i := 30; i >= 0; i-- {
			if bits[i]+k >= n {
				det := n - bits[i]
				if det <= 0 {
					det = 0
				}
				bits[i] = n
				k -= det
			}
		}
		res := 0
		cur := 1
		for i := 0; i < 32; i++ {
			if bits[i] == n {
				res += cur
			}
			cur *= 2
		}
		fmt.Fprintln(out, res)
	}
}

package main

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

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

func main() {
	defer out.Flush()
	var T int
	var N int
	var K int64
	var A [200001]int64
	fmt.Fscan(in, &T)
	and := func(v int64) (int64, int64) {
		ret := (int64(1) << 32) - 1
		var k int64
		for ii := 0; ii < N; ii++ {
			ret = ret & (A[ii] | v)
			if A[ii]|v != A[ii] {
				k++
			}
		}
		return ret, k
	}
	for i := 0; i < T; i++ {
		fmt.Fscan(in, &N, &K)
		for ii := 0; ii < N; ii++ {
			fmt.Fscan(in, &A[ii])
		}
		max, _ := and(0)
		//fmt.Fprintln(out, "Initial max ", max)
		var v, k int64
		for j := 30; j >= 0; j-- {
			v, k = and(1 << j)
			//fmt.Fprintln(out, "Flipping ", j, "th bit. Got ", v, " after ", k, " flips")
			if k <= K {
				max = v
				for ii := 0; ii < N; ii++ {
					A[ii] = A[ii] | (1 << j)
				}
				K -= k
				if K == 0 {
					break
				}
			}
		}
		fmt.Fprintln(out, max)
	}
}

package main

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

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

	var t int
	fmt.Fscan(in, &t)

	for ; t > 0; t-- {
		var n, k int
		fmt.Fscan(in, &n, &k)

		cnt := [31]int{}
		for i := 0; i < n; i++ {
			var num int
			fmt.Fscan(in, &num)

			for j := 0; j < 31; j++ {
				if num&(1<<j) != 0 {
					cnt[j]++
				}
			}
		}

		ans := 0
		for i := 30; i >= 0; i-- {
			required := n - cnt[i]
			if required <= k {
				k -= required
				ans += 1 << i
			}
		}

		fmt.Fprintln(out, ans)
	}
}

package main

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

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

	var t int
	fmt.Fscan(in, &t)

	for ; t > 0; t-- {
		var n, k int
		fmt.Fscan(in, &n, &k)

		cnt := [31]int{}
		for i := 0; i < n; i++ {
			var num int
			fmt.Fscan(in, &num)

			for j := 0; j < 31; j++ {
				if num&(1<<j) != 0 {
					cnt[j]++
				}
			}
		}

		ans := 0
		for i := 30; i >= 0; i-- {
			required := n - cnt[i]
			if required <= k {
				k -= required
				ans |= 1 << i
			}
		}

		fmt.Fprintln(out, ans)
	}
}

package main

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

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

func Scan(a ...interface{}) { fmt.Fscan(in, a...) }
func Scanln(s *string) {
	for *s, _ = in.ReadString('\n'); *s == "\n" || *s == "\r\n"; {
		*s, _ = in.ReadString('\n')
	}
	*s = strings.TrimSpace(*s)
}
func Print(a ...interface{})                 { fmt.Fprint(out, a...) }
func Printf(format string, a ...interface{}) { fmt.Fprintf(out, format, a...) }
func Log(a ...interface{}) {
	pc, _, line, _ := runtime.Caller(1)
	fmt.Fprint(out, "log ", runtime.FuncForPC(pc).Name(), ":", line, " ")
	fmt.Fprint(out, a...)
	fmt.Fprint(out, "\n")
}

const N = 2e5 + 10

var (
	a [N]int
)

func solve() {
	var (
		n, k int
		cnt  [32]int
	)
	Scan(&n, &k)
	for i := 0; i < n; i++ {
		Scan(&a[i])
		idx := 0
		for a[i] > 0 {
			if a[i]%2 == 1 {
				cnt[idx]++
			}
			a[i] >>= 1
			idx++
		}
	}
	sum, base := 0, 1<<30
	for i := 30; i >= 0; i-- {
		if k >= n-cnt[i] {
			sum += base
			k -= n - cnt[i]
		}
		base >>= 1
	}
	Print(sum, "\n")
}

func main() {
	defer out.Flush()

	T := 1
	Scan(&T)
	for t := 0; t < T; t++ {
		solve()
	}
}

package main

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

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

func out(x ...interface{}) {
	fmt.Fprint(wr, x...)
}

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

func nextInt64() int64 {
	i, e := strconv.ParseInt(next(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

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

func main() {
	defer wr.Flush()
	sc.Buffer(make([]byte, 0), 1000000009)
	sc.Split(bufio.ScanWords)

	T := nextInt()
	for Case := 1; Case <= T; Case++ {
		solve()
	}
}

func solve() {
	n:=nextInt()
	k:=nextInt()
	a:=make([]int,n,n)
	cnt:=make([]int,33,33)
	for i:=0;i<n;i++{
		a[i]=nextInt()
		for j:=0;j<32;j++{
			cnt[j]+=(a[i]>>j)&1
		}
	}
	var res int64 =0
	for i:=30;i>=0;i--{
		if(k>=n-cnt[i]){
			k-=n-cnt[i];
			res|=1<<i
		}
	}
	fmt.Printf("%v\n", res)
}

// @Title
// @Description
// @Author
// @Update
package main

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

func fun(in *bufio.Reader) {
        n, k := 1, 1
        fmt.Fscan(in, &n, &k)
        arr := make([]int, n)
        bit := make([]int, 32)
        for i := 0; i < n; i++ {
                fmt.Fscan(in, &arr[i])
                for j := 0; j < 31; j++ {
                        bit[j] += arr[i] >> j & 1
                }
        }
        ans := 0
        for i := 30; i >= 0; i-- {
                if bit[i]+k >= n {
                        if bit[i] < n {
                                k -= n - bit[i]
                        }
                        ans += 1 << i
                }
        }
        fmt.Println(ans)
}
func main() {
        t := 1
        fmt.Scan(&t)
        in := bufio.NewReader(os.Stdin)
        for i := 0; i < t; i++ {
                fun(in)
        }
}

package main

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

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

	var T int
	fmt.Fscan(in, &T)

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

		m := make([]int, 31)
		for i := 0; i < n; i++ {
			var v int
			fmt.Fscan(in, &v)

			var j int
			for v > 0 {
				if v%2 != 0 {
					m[j]++
				}
				v /= 2
				j++
			}
		}

		for i := 30; i >= 0; i-- {
			if m[i]+k >= n {
				k -= n - m[i]
				m[i] = n
			}
		}

		var d int
		z := 1
		for _, v := range m {
			if v == n {
				d += z
			}
			z *= 2
		}
		fmt.Fprintln(out, d)
	}
}

package main

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

/*

 */

//goland:noinspection GoUnhandledErrorResult
func solve() {
	var n, k uint
	scanf("%d %d\n", &n, &k)

	bitToCnt := make([]uint, 31)
	ans := maxUint

	for i := uint(0); i < n; i++ {
		var num uint
		scanf("%d", &num)

		ans &= num

		for j := 0; j < len(bitToCnt); j++ {
			if num&(1<<j) > 0 {
				bitToCnt[j]++
			}
		}
	}
	scanf("\n")

	for i := 30; i >= 0; i-- {
		if ans&(1<<i) == 0 && k >= (n-bitToCnt[i]) {
			ans |= 1 << i
			k -= n - bitToCnt[i]
		}
	}

	fmt.Fprintln(writer, ans)
}

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	t := 1
	scanf("%d\n", &t)

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

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

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

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func reversed(s string) string {
	input := []rune(s)
	li := len(input)
	ret := make([]rune, li)
	for i, r := range input {
		ret[li-i-1] = r
	}
	return string(ret)
}

//goland:noinspection GoUnusedFunction
func divCeil(num, div int64) int64 {
	quot := num / div
	if num%div > 0 {
		quot++
	} else if num%div < 0 {
		quot--
	}
	return quot
}

//goland:noinspection GoUnusedFunction
func min(nums ...int) int {
	return nums[minIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func minIdx(nums ...int) int {
	minNumIdx := 0
	for i, num := range nums {
		if num < nums[minNumIdx] {
			minNumIdx = i
		}
	}

	return minNumIdx
}

//goland:noinspection GoUnusedFunction
func max(nums ...int) int {
	return nums[maxIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func maxIdx(nums ...int) int {
	maxNumIdx := 0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = i
		}
	}

	return maxNumIdx
}

//goland:noinspection GoUnusedFunction
func abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

//goland:noinspection GoUnusedFunction
func isPrime(num int) bool {
	if num == 2 || num == 3 {
		return true
	}

	if num <= 1 || num%2 == 0 || num%3 == 0 {
		return false
	}

	for i := 5; i*i <= num; i += 6 {
		if num%i == 0 || num%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	if num == 0 {
		return 0
	}

	num = abs(num)

	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}

//goland:noinspection GoUnhandledErrorResult
func factorize(num int) []int {
	factors := []int{1}

	sqrtA := int(math.Sqrt(float64(num)))

	for ftr := 2; ftr <= sqrtA; ftr++ {
		for num%ftr == 0 {
			num /= ftr
			factors = append(factors, ftr)
		}
	}

	if num > sqrtA {
		factors = append(factors, num)
	}

	return factors
}

package main

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

const M = 31

func solve(cin *scanner, cout *writer, cerr *writer) {
	n, k := cin.NextInt(), cin.NextInt()
	a := cin.NextInts(n)
	cnt := make([]int, M)
	for _, v := range a {
		for j := range cnt {
			if v&(1<<uint(j)) == 0 {
				cnt[j]++
			}
		}
	}
	ans := 0
	for j := M - 1; j >= 0; j-- {
		if k >= cnt[j] {
			k -= cnt[j]
			ans |= 1 << uint(j)
		}
	}
	cout.Println(ans)
}

func main() {
	cin := NewScanner(os.Stdin)
	cout, cerr := NewWriter(os.Stdout), NewWriter(os.Stderr)
	defer cout.Flush()
	defer cerr.Flush()
	t := cin.NextInt()
	// t := 1
	for ti := 0; ti < t; ti++ {
		solve(cin, cout, cerr)
	}
}

// Template Bolierplate {{{
type scanner struct {
	*bufio.Scanner
}

func NewScanner(r io.Reader) *scanner {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	s.Buffer(nil, 1024*1024)
	return &scanner{s}
}

func (i *scanner) Next() string {
	i.Scan()
	return i.Text()
}

func (i *scanner) Nexts(n int) []string {
	res := make([]string, n)
	for j := range res {
		res[j] = i.Next()
	}
	return res
}

func (i *scanner) NextInt() int {
	v, _ := strconv.Atoi(i.Next())
	return v
}

func (i *scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(i.Next(), 10, 64)
	return v
}

func (i *scanner) NextInts(n int) []int {
	res := make([]int, n)
	for j := range res {
		res[j] = i.NextInt()
	}
	return res
}

func (i *scanner) NextInt64s(n int) []int64 {
	res := make([]int64, n)
	for j := range res {
		res[j] = i.NextInt64()
	}
	return res
}

type writer struct {
	w *bufio.Writer
}

func NewWriter(w io.Writer) *writer {
	return &writer{bufio.NewWriter(w)}
}

func (i *writer) Print(a ...interface{}) {
	fmt.Fprint(i.w, a...)
}

func (i *writer) Println(a ...interface{}) {
	fmt.Fprintln(i.w, a...)
}

func (i *writer) Printf(format string, a ...interface{}) {
	fmt.Fprintf(i.w, format, a...)
}

func (i *writer) Flush() {
	i.w.Flush()
}

// }}}

// vim: fdm=marker

package main

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

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

func isok(s string) bool {
	b := strings.Count(s, "B")
	rr := strings.Count(s, "R")
	if rr == 0 && b == 0 {
		return true
	} else if rr == 0 || b == 0 {
		return false
	} else {
		return true
	}
}

func slove() {
	defer w.Flush()
	var k, n int
	fmt.Fscan(r, &n, &k)
	nums := make([]int, n)
	cnt := make([]int, 31)
	for i := range nums {
		fmt.Fscan(r, &nums[i])
		for j := range cnt {
			cnt[j] += nums[i] >> j & 1
		}
	}
	ans := 0
	for j:=30;j>=0;j-- {
		if n - cnt[j] <= k {
			k -= n - cnt[j]
			ans = ans | (1 << j)
		}
	}
	fmt.Fprintln(w, ans)

}

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

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

package main

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

func main_div4_784_G() {
	_in, _out := os.Stdin, os.Stdout
	in, out := bufio.NewReader(_in), bufio.NewWriter(_out)
	defer out.Flush()
	var cas int = 1
	Fscan(in, &cas)
	var sol func()
	sol = func() {
		var n, k int
		Fscan(in, &n, &k)
		arr := make([]int, n)
		zero := make([]int, 32)
		for i := 0; i < n; i++ {
			Fscan(in, &arr[i])
			for j := 0; j <= 30; j++ {
				if (arr[i] & (1 << j)) == 0 {
					zero[j]++
				}
			}
		}
		for i := 30; i >= 0; i-- {
			if zero[i] != 0 {
				if zero[i] <= k {
					k -= zero[i]
					zero[i] = 0
				} else {
					;
				}
			}
		}
		var ans int
		for i := 0; i <= 30; i++ {
			if zero[i] == 0 {
				ans += (1 << i)
			} else {

			}
		}
		Fprintln(out, ans)
	}
	for i := 0; i < cas; i++ {
		sol()
	}
}

func main() {
	main_div4_784_G()
}

package main

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

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

	for ii := 0; ii < t; ii++ {
		var n, k int
		fmt.Fscan(in, &n, &k)
		//nums := make([]int, n)
		bits := make([]int, 31)
		for i := 0; i < n; i++ {
			num := 0
			fmt.Fscan(in, &num)
			for j := 0; j <= 30; j++ {
				if num&(1<<j) > 0 {
					bits[j]++
				}
			}
		}

		for i := 30; i >= 0 && k > 0; i-- {
			if bits[i] == n {
				continue
			}
			if k+bits[i] >= n {
				k -= n - bits[i]
				bits[i] = n
			}
		}
		//fmt.Println(bits)
		ans := 0
		for i := 0; i <= 30; i++ {
			if bits[i] == n {
				ans |= 1 << i
			}
		}
		fmt.Fprintln(out, ans)
	}
}

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(curCase int) {
		var n, left int
		Fscan(in, &n, &left)
		a := make([]int, n)
		need := [31]int{}
		for i := range a {
			Fscan(in, &a[i])
			for k := 30; k >= 0; k-- {
				if a[i]>>k&1 == 0 {
					need[k]++
				}
			}
		}
		ans := 0

		for k := 30; k >= 0; k-- {
			if left >= need[k] {
				ans |= 1<<k
				left -= need[k]
			}
		}

		Fprintln(out, ans)
	}

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

	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"
	"runtime"
	"strings"
)

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

func Scan(a ...interface{}) { fmt.Fscan(in, a...) }
func Scanln(s *string) {
	for *s, _ = in.ReadString('\n'); *s == "\n" || *s == "\r\n"; {
		*s, _ = in.ReadString('\n')
	}
	*s = strings.TrimSpace(*s)
}
func Print(a ...interface{})                 { fmt.Fprint(out, a...) }
func Printf(format string, a ...interface{}) { fmt.Fprintf(out, format, a...) }
func Log(a ...interface{}) {
	pc, _, line, _ := runtime.Caller(1)
	fmt.Fprint(out, "log ", runtime.FuncForPC(pc).Name(), ":", line, " ")
	fmt.Fprint(out, a...)
	fmt.Fprint(out, "\n")
}

const N = 2e5 + 10

var (
	a [N]int
)

func solve() {
	var (
		n, k int
		cnt  [32]int
	)
	Scan(&n, &k)
	for i := 0; i < n; i++ {
		Scan(&a[i])
		idx := 0
		for a[i] > 0 {
			if a[i]%2 == 1 {
				cnt[idx]++
			}
			a[i] >>= 1
			idx++
		}
	}
	sum, base := 0, 1<<30
	for i := 31; i >= 0; i-- {
		if k >= n-cnt[i] {
			sum += base
			k -= n - cnt[i]
		}
		base >>= 1
	}
	Print(sum, "\n")
}

func main() {
	defer out.Flush()

	T := 1
	Scan(&T)
	for t := 0; t < T; t++ {
		solve()
	}
}


package main

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

func main() {
	sc := NewScanner()
	N, K, M := sc.NextInt(), sc.NextInt(), sc.NextInt()
	A := sc.NextIntArray()

	b := make([][]int, M)
	for i := 0; i < M; i++ {
		b[i] = make([]int, 0)
	}
	for i := 0; i < N; i++ {
		b[A[i]%M] = append(b[A[i]%M], A[i])
		if len(b[A[i]%M]) >= K {
			fmt.Println("Yes")
			PrintI(b[A[i]%M]...)
			return
		}
	}
	fmt.Println("No")

}

func mapToString(arr []int) []string {
	ret := make([]string, len(arr))
	for i := 0; i < len(arr); i++ {
		ret[i] = strconv.Itoa(arr[i])
	}
	return ret
}

func PrintI(args ...int) {
	fmt.Println(strings.Join(mapToString(args), " "))
}

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) 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]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

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

/*
URL:
https://codeforces.com/problemset/problem/876/B
*/

package main

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

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

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

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

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

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

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n, k, m int
	A       []int

	R [100000 + 50]int
)

func main() {
	n, k, m = ReadInt3()
	A = ReadIntSlice(n)

	for _, a := range A {
		R[a%m]++
	}

	for r := 0; r < m; r++ {
		if R[r] >= k {
			answers := []int{}
			for i := 0; i < n; i++ {
				if A[i]%m == r {
					answers = append(answers, A[i])
					if len(answers) >= k {
						break
					}
				}
			}

			fmt.Println("Yes")
			fmt.Println(PrintIntsLine(answers...))
			return
		}
	}
	fmt.Println("No")
}

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

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

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

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

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

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

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

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

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

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

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

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

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

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

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

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

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

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

	return string(res)
}

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

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

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

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

package main

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

const (
	MAXN = 100001
)

var (
	arr [MAXN]int
	mods [MAXN]int
	n, k, m int
)

func main()  {
	var input = bufio.NewReader(os.Stdin)
	var selected = -1
	fmt.Fscanf(input, "%d %d %d\n", &n, &k, &m)
	for i := 0; i < n; i++ {
		fmt.Fscanf(input, "%d ", &arr[i])
		mod := arr[i] % m
		mods[mod]++
		if mods[mod] >= k {
			selected = mod
		}
	}
	var output = bufio.NewWriter(os.Stdout)
	if selected == -1 {
		fmt.Fprintf(output, "No\n")
	} else {
		fmt.Fprintf(output, "Yes\n")
		for i := 0; i < n; i++ {
			if k > 0 && arr[i] % m == selected {
				fmt.Fprintf(output, "%d ", arr[i])
				k--
			}
		}
	}
	output.Flush()
}


package main

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

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

  line, _ := reader.ReadString('\n')
  a := strings.TrimSpace(line)
  line, _ = reader.ReadString('\n')
  b := strings.TrimSpace(line)
  na, nb := len(a), len(b)

  sums := make([]int64, nb + 1)
  for i := 1; i <= nb; i++ {
    sums[i] = sums[i - 1]
    if b[i - 1] == '1' {
      sums[i]++
    }
  }

  result := int64(0)
  for start := 0; start < na; start++ {
    end := nb - na + start
    span := int64(end - start + 1)
    sum := sums[end + 1] - sums[start]
    if a[start] == '1' {
      sum = span - sum
    }
    result += sum
  }

  writer.WriteString(fmt.Sprintf("%d\n", result))
}

package main

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

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

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

	reader := bufio.NewReader(os.Stdin)

	a, _ := reader.ReadString('\n')
	b, _ := reader.ReadString('\n')
	a = strings.TrimSpace(a)
	b = strings.TrimSpace(b)
	na, nb := len(a), len(b)+1
	dp := make([]int, nb)
	sum := int64(0)

	for i := 1; i < nb; i++ {
		dp[i] = dp[i-1]
		if b[i-1] == '1' {
			dp[i]++
		}
	}

	for i := 0; i < na; i++ {
		cnt1 := dp[nb-na+i] - dp[i]
		// println(cnt1)
		if a[i] == '0' {
			sum += int64(cnt1)
		} else {
			sum += int64(nb - na - cnt1)
		}
	}
	// println(dp, na, nb)
	println(sum)
}

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

	return n
}

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

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

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

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

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

package main

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

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

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

	reader := bufio.NewReader(os.Stdin)

	a, _ := reader.ReadString('\n')
	b, _ := reader.ReadString('\n')
	a = strings.TrimSpace(a)
	b = strings.TrimSpace(b)

	sum := 0
	// println(a, b)
	for i := 0; i <= len(b)-len(a); i++ {
		for j := 0; j < len(a); j++ {
			print(a[j], b[i+j], abs(int(a[j])-int(b[i+j])), sum, " ")
			sum += abs(int(a[j]) - int(b[i+j]))
		}
		println()
	}

	println(int(sum))
}

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

	return n
}

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

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

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

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

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

package main

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

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

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

	reader := bufio.NewReader(os.Stdin)

	a, _ := reader.ReadString('\n')
	b, _ := reader.ReadString('\n')
	a = a[:len(a)-1]
	b = b[:len(b)-1]

	sum := 0
	println(a, b)
	for i := 0; i <= len(b)-len(a); i++ {
		for j := 0; j < len(a); j++ {
			// print(a[j], b[i+j], abs(int(a[j])-int(b[i+j])), " ")
			sum += abs(int(a[j]) - int(b[i+j]))
		}
		// println()
	}

	println(int(sum))
}

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

	return n
}

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

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

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

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

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

package main

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

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

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

	reader := bufio.NewReader(os.Stdin)

	a, _ := reader.ReadString('\n')
	b, _ := reader.ReadString('\n')
	a = a[:len(a)-1]
	b = b[:len(b)-1]

	sum := 0
	// println(a, b)
	for i := 0; i <= len(b)-len(a); i++ {
		for j := 0; j < len(a); j++ {
			print(a[j], b[i+j], abs(int(a[j])-int(b[i+j])), sum, " ")
			sum += abs(int(a[j]) - int(b[i+j]))
		}
		println()
	}

	println(int(sum))
}

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

	return n
}

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

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

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

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

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

package main

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

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

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

	reader := bufio.NewReader(os.Stdin)

	a, _ := reader.ReadString('\n')
	b, _ := reader.ReadString('\n')
	a = a[:len(a)-1]
	b = b[:len(b)-1]

	sum := 0
	// println(a, b)
	for i := 0; i <= len(b)-len(a); i++ {
		for j := 0; j < len(a); j++ {
			// print(a[j], b[i+j], abs(int(a[j])-int(b[i+j])), " ")
			sum += abs(int(a[j]) - int(b[i+j]))
		}
		// println()
	}

	println(sum)
}

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

	return n
}

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

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

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

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

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

package main

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

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

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

	reader := bufio.NewReader(os.Stdin)

	a, _ := reader.ReadString('\n')
	b, _ := reader.ReadString('\n')
	a = strings.TrimSpace(a)
	b = strings.TrimSpace(b)
	na, nb := len(a), len(b)+1
	dp := make([]int, nb)
	sum := 0

	for i := 1; i < nb; i++ {
		dp[i] = dp[i-1]
		if b[i-1] == '1' {
			dp[i]++
		}
	}

	for i := 0; i < na; i++ {
		cnt1 := dp[nb-na+i] - dp[i]
		// println(cnt1)
		if a[i] == '0' {
			sum += cnt1
		} else {
			sum += nb - na - cnt1
		}
	}
	// println(dp, na, nb)
	println(sum)
}

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

	return n
}

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

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

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

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

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

package main

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

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

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

	reader := bufio.NewReader(os.Stdin)

	a, _ := reader.ReadString('\n')
	b, _ := reader.ReadString('\n')
	a = a[:len(a)-1]
	b = b[:len(b)-1]

	sum := 0
	// println(a, b)
	for i := 0; i <= len(b)-len(a); i++ {
		for j := 0; j < len(a); j++ {
			// print(a[j], b[i+j], abs(int(a[j])-int(b[i+j])), " ")
			sum += abs(int(a[j]) - int(b[i+j]))
		}
		// println()
	}

	println(int(sum))
}

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

	return n
}

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

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

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

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

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