package main

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

// github.com/EndlessCheng/codeforces-go
func f(x int64) (s int64) {
	for ; x > 0; x /= 10 {
		s += x % 10
	}
	return
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var T, up, n int64
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &up)
		if f(n) <= up {
			Fprintln(out, 0)
			continue
		}
		for p := int64(10); ; p *= 10 {
			if v := (n/p + 1) * p; f(v) <= up {
				Fprintln(out, v-n)
				break
			}
		}
	}
}

package main

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

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

	T:= 0
	for Fscan(in, &T); T > 0; T-- {
		var n,s int64
		Fscan(in, &n, &s);
		sod:=func(n int64) int64{
			v:=int64(0)
			for n>0{
				v+=n%10
				n/=10
			}
			return v
		}

		getNext:=func(n int64) int64 {
			if n==0{
				return 1
			}
			k:=int64(1)
			for n%10==0{
				k*=10
				n/=10
			}
			k*=10
			n/=10
			n++
			return n*k
		}
		m:=n
		for sod(m)>s{
			m=getNext(m)
		}
		Fprintln(out,m-n)
	}
}

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

package main

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

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

	for t := io.NextInt(); t > 0; t-- {
		n, s := io.NextInt64(), io.NextInt()

		nstr := "0" + strconv.FormatInt(n, 10)
		m := len(nstr)
		digits := make([]int, m)
		sum := 0
		for i, d := range nstr {
			digits[i] = int(d - '0')
			sum += digits[i]
		}

		var ans int64
		pow10 := int64(1)
		for i := m - 1; i >= 0; i-- {
			if sum > s {
				if digits[i] > 0 {
					ans += int64(10-digits[i]) * pow10
					sum -= digits[i] - 1
					digits[i-1] += 1
				}
			}
			pow10 *= 10
		}

		io.Println(ans)
	}
}

type FastIO struct {
	*bufio.Writer
	r    io.Reader
	buf  [8192]byte
	i, n int
}

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

func (f *FastIO) readC() byte {
	if f.i == f.n {
		f.n, _ = f.r.Read(f.buf[:])
		if f.n == 0 {
			panic("EOF")
		}
		f.i = 0
	}
	f.i++
	return f.buf[f.i-1]
}

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) NextInt64() int64 {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	neg := false
	if c == '-' {
		neg = true
		c = f.readC()
	}
	var n int64
	for ; '0' <= c && c <= '9'; c = f.readC() {
		n = n*10 + int64(c) - '0'
	}
	if neg {
		return -n
	}
	return n
}

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

package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	bf := make([]byte, 1024*1024)
	sc.Buffer(bf, 10*1024*1024)
	sc.Split(bufio.ScanWords)

	in := func() uint64 {
		sc.Scan()
		i, _ := strconv.ParseUint(sc.Text(), 10, 64)
		return i
	}

	for t := in(); t > 0 ; t-- {
		n, s := in(), in()

		a := make([]uint64, 0, 18)

		for n != 0 {
			a = append(a, n%10)
			n /= 10
		}

		var i int
		m := len(a)
		b := make([]uint64,m)

		b[m-1] = a[m-1]

		for i = m-2; i >= 0; i-- {
			b[i] = a[i] + b[i+1]
		}

		for i = m-1; i >=0 ; i-- {
			if b[i] > s || (b[i] == s && b[0] != s) {
				break
			}
		}

		var val uint64 = 0

		if i == -1 {
			fmt.Println(0)
			continue
		}

		for j := i; j >= 0; j-- {
			val *= 10
			val += (9 - a[j])
		}

		val++

		fmt.Println(val)
	}
}

package main

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

func main(){
	var (
		t int
		n,s,tmp,div,ans uint64
		jobGoing bool
	)
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i:=1;i<=t;i++{
		jobGoing = true
		div = 1
		ans = 0
		fmt.Fscan(in, &n, &s)
		for n/div>=10{
			div*=10
		}
		for jobGoing {
			tmp = (n/div)%10
			if s<=tmp {
				if s==tmp{
					if n%div!=0{
						ans = (div*10)-(n%(div*10))
						jobGoing = false
					}
				}else{
					ans = (div*10)-(n%(div*10))
					jobGoing = false
				}
			}else{
				s = s-tmp
			}
			div/=10
			if div==0{
				jobGoing = false
			}
		}
		fmt.Println(ans)
	}
}

package main

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

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() {
	defer writer.Flush()

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

	var n string
	var s int
	for t > 0 {
		scanf("%s %d\n", &n, &s)

		nn := 0
		for i := 0; i < len(n); i++ {
			nn += int(n[i] - '0')
		}
		if nn <= s {
			printf("0\n")
			t--
			continue
		}
		var ans int64
		sum := 0
		i := 0
		for i < len(n) {
			sum += int(n[i] - '0')
			if sum >= s {
				break
			}
			ans = ans*10 + int64(n[i]-'0')
			i++
		}
		if i == 0 {
			ans = int64(math.Pow(10, float64(len(n))))
		} else {
			ans++
			ans = ans * int64(math.Pow(10, float64(len(n)-i)))
		}
		temp, _ := strconv.ParseInt(n, 10, 64)
		// printf("%d - %d\n", ans, temp)
		printf("%d\n", ans-temp)
		t--
	}
}

package main

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

// github.com/EndlessCheng/codeforces-go
func f(s string) (ds int) {
	for _, b := range s {
		ds += int(b & 15)
	}
	return
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var T, up int
	var n int64
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &up)
		if f(strconv.FormatInt(n, 10)) <= up {
			Fprintln(out, 0)
			continue
		}
		for p := int64(10); ; p *= 10 {
			if v := (n/p + 1) * p; f(strconv.FormatInt(v, 10)) <= up {
				Fprintln(out, v-n)
				break
			}
		}
	}
}

package main

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

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() {
	defer writer.Flush()

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

	var n string
	var s int
	for t > 0 {
		scanf("%s %d\n", &n, &s)

		nn, _ := strconv.Atoi(n)
		if nn == s {
			printf("0\n")
			t--
			continue
		}
		var ans int64
		sum := 0
		i := 0
		for i < len(n) {
			sum += int(n[i] - '0')
			if sum >= s {
				break
			}
			ans = ans*10 + int64(n[i]-'0')
			i++
		}
		if i == 0 {
			ans = int64(math.Pow(10, float64(len(n))))
		} else {
			ans++
			ans = ans * int64(math.Pow(10, float64(len(n)-i)))
		}
		temp, _ := strconv.Atoi(n)
		// printf("%d - %d\n", ans, temp)
		printf("%d\n", ans-int64(temp))
		t--
	}
}

package main

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

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() {
	defer writer.Flush()

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

	var n string
	var s int
	for t > 0 {
		scanf("%s %d\n", &n, &s)

		nn, _ := strconv.Atoi(n)
		if nn <= s {
			printf("0\n")
			t--
			continue
		}
		var ans int64
		sum := 0
		i := 0
		for i < len(n) {
			sum += int(n[i] - '0')
			if sum >= s {
				break
			}
			ans = ans*10 + int64(n[i]-'0')
			i++
		}
		if i == 0 {
			ans = int64(math.Pow(10, float64(len(n))))
		} else {
			ans++
			ans = ans * int64(math.Pow(10, float64(len(n)-i)))
		}
		temp, _ := strconv.ParseInt(n, 10, 64)
		// printf("%d - %d\n", ans, temp)
		printf("%d\n", ans-temp)
		t--
	}
}

package main

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

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() {
	defer writer.Flush()

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

	var n string
	var s int
	for t > 0 {
		scanf("%s %d\n", &n, &s)

		nn, _ := strconv.Atoi(n)
		if nn == s {
			printf("0\n")
			t--
			continue
		}
		var ans int64
		sum := 0
		i := 0
		for i < len(n) {
			sum += int(n[i] - '0')
			if sum >= s {
				break
			}
			ans = ans*10 + int64(n[i]-'0')
			i++
		}
		if i == 0 {
			ans = int64(math.Pow(10, float64(len(n))))
		} else {
			ans++
			ans = ans * int64(math.Pow(10, float64(len(n)-i)))
		}
		temp, _ := strconv.ParseInt(n, 10, 64)
		// printf("%d - %d\n", ans, temp)
		printf("%d\n", ans-temp)
		t--
	}
}

package main

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

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() {
	defer writer.Flush()

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

	var n string
	var s int
	for t > 0 {
		scanf("%s %d\n", &n, &s)

		nn, _ := strconv.Atoi(n)
		if nn == s {
			printf("0\n")
			t--
			continue
		}
		var ans int
		sum := 0
		i := 0
		for i < len(n) {
			sum += int(n[i] - '0')
			if sum >= s {
				break
			}
			ans = ans*10 + int(n[i]-'0')
			i++
		}
		if i == 0 {
			ans = int(math.Pow(10, float64(len(n))))
		} else {
			ans++
			ans = ans * int(math.Pow(10, float64(len(n)-i)))
		}
		temp, _ := strconv.Atoi(n)
		// printf("%d - %d\n", ans, temp)
		printf("%d\n", ans-int(temp))
		t--
	}
}


package main

import . "fmt"

// github.com/EndlessCheng/codeforces-go
func main() {
	var n, a, b uint
	Scan(&n, &a, &b)
	base := uint(1) << b
	if (n > 1 && n-1 == a) || base+a > 50000 {
		Print(-1)
		return
	}
	Print(1)
	if n == 1 {
		return
	}
	for i := uint(1); i <= b; i++ {
		Print(" ", 1<<i)
	}
	if b == 0 {
		Print(" ", 1)
		n--
	}
	for i := uint(1); i <= a; i++ {
		Print(" ", base+i)
	}
	for n -= a + b + 1; n > 0; n-- {
		Print(" ", 1)
	}
}

// Author: sighduck
// URL: https://codeforces.com/problemset/problem/148/C

package main

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

type PrincessReaction struct {
	Ohs  int
	Wows int
}

func validate(t []int) PrincessReaction {
	totalSum := 1
	maxSoFar := 1
	wows := 0
	ohs := 0
	for i := 1; i < len(t); i++ {
		if t[i] > totalSum {
			wows += 1
		} else if t[i] > maxSoFar {
			ohs += 1
		}
		if t[i] > maxSoFar {
			maxSoFar = t[i]
		}
		totalSum += t[i]
	}
	return PrincessReaction{Ohs: ohs, Wows: wows}
}

func Solve(n, a, b int) []int {
	result := []int{1}
	ohs := 0
	wows := 0
	maxSoFar := 1
	totalSum := 1
	noWows := b == 0
	for i := 1; i < n; i++ {
		if wows < b {
			maxSoFar *= 2
			totalSum += maxSoFar
			wows += 1
			result = append(result, maxSoFar)
		} else if ohs < a && noWows {
			noWows = false
			totalSum += 1
			result = append(result, 1)
		} else if ohs < a {
			maxSoFar += 1
			totalSum += maxSoFar
			ohs += 1
			result = append(result, maxSoFar)
		} else {
			result = append(result, 1)
		}
	}
	reaction := validate(result)
	if reaction.Ohs != a || reaction.Wows != b {
		return []int{-1}
	}
	return result
}

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

	var n, a, b int
	fmt.Fscanf(reader, "%d %d %d\n", &n, &a, &b)

	for _, elem := range Solve(n, a, b) {
		fmt.Fprintf(writer, "%d ", elem)
	}
	fmt.Fprintf(writer, "\n")
}

package main

import . "fmt"

// github.com/EndlessCheng/codeforces-go
func main() {
	var n, a, b uint
	Scan(&n, &a, &b)
	base := uint(1) << b
	if base+a > 50000 {
		Print(-1)
		return
	}
	Print(1)
	for i := uint(1); i <= b; i++ {
		Print(" ", 1<<i)
	}
	for i := uint(1); i <= a; i++ {
		Print(" ", base+i)
	}
	for n -= a + b + 1; n > 0; n-- {
		Print(" ", 1)
	}
}

package main

import . "fmt"

// github.com/EndlessCheng/codeforces-go
func main() {
	var n, a, b uint
	Scan(&n, &a, &b)
	base := uint(1) << b
	if (n > 1 && n-1 == a) || base+a > 50000 {
		Print(-1)
		return
	}
	Print(1)
	for i := uint(1); i <= b; i++ {
		Print(" ", 1<<i)
	}
	for i := uint(1); i <= a; i++ {
		Print(" ", base+i)
	}
	for n -= a + b + 1; n > 0; n-- {
		Print(" ", 1)
	}
}


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, v int
		var x, y int64
		Fscan(in, &n, &x, &y)
		s := 0
		for i := 0; i < n; i++ {
			Fscan(in, &v)
			s ^= v & 1
		}
		if s == 0 {
			if x&1 == y&1 {
				Fprintln(out, "Alice")
			} else {
				Fprintln(out, "Bob")
			}
		} else {
			if x&1 != y&1 {
				Fprintln(out, "Alice")
			} else {
				Fprintln(out, "Bob")
			}
		}
	}

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

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

	for ii := 0; ii < t; ii++ {
		var n int
		var a, y int64
		fmt.Fscan(in, &n, &a, &y)
		sum := a
		for i := 0; i < n; i++ {
			var num int64
			fmt.Fscan(in, &num)
			sum += num
		}
		if (sum+y)%2 == 0 {
			fmt.Fprintln(out, "Alice")
		} else {
			fmt.Fprintln(out, "Bob")
		}
	}
}

// 1 0 1 2

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()
	// arr := make([]int, 1e5+10)
	var T int
	var n int
	var x, y int64
	var v int64
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &x, &y)
		for i := 0; i < n; i++ {
			Fscan(in, &v)
			x ^= v
		}
		if x&1 == y&1 {
			Fprintln(out, "Alice")
		} else {
			Fprintln(out, "Bob")
		}
	}

}

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

package main

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

const MOD int64 = 1000000007

var n int
var x, y int64

var a[]int64

// ByAge implements sort.Interface based on the Age field.
type ByV []*pair

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

func main() {

	read := bufio.NewReader(os.Stdin)

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

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

		fmt.Fscan(read, &n, &x, &y)

		a = make([]int64, n)

		for j := 0; j < n; j++ {
			fmt.Fscan(read, &a[j])
		}

		fmt.Println(solve())
	}
}

type pair struct {
	v int
	idx []int
}

func solve() string {
	al := x

	var sum = al

	for i := 0; i < n; i++ {
		sum += a[i]
	}

	r1 := sum % 2
	r2 := y % 2

	if r1 == r2 {
		return "Alice"
	}
	return "Bob"
}

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

package main

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

const (
	MOD int64 = 1e9+7
	NL byte = byte('\n')
	SP byte = byte(' ')
)

var (
	in *bufio.Scanner
	out *bufio.Writer

	n, x int
	y int64
	a [100000]int64
	resS [2]string = [2]string{"Alice", "Bob"}
	res int
)

func main() {
	initBuffer()
	var t int = 1
	t = getInt()
	for i := 0; i < t; i++ {
		solve()
	}
	// test()
	out.Flush()
}

func solve() {
	initialize()
	input()
	count()
	output()
}

func initialize() {

}

func input() {
	n = getInt()
	x = getInt()
	y = getInt64()
	for i := 0; i < n; i++ {
		a[i] = getInt64()
	}
}

func count() {
	res = x % 2
	for i := 0; i < n; i++ {
		if a[i] % 2 == 1 {
			res = 1 - res
		}
	}
	if res == int(y % 2) {
		res = 0
	} else {
		res = 1
	}
}

func output() {
	out.WriteString(resS[res])
	out.WriteByte(NL)
}

func test() {
	fmt.Print()
}

func initBuffer() {
	in = bufio.NewScanner(os.Stdin)
	in.Buffer([]byte{}, 4 * 1024 * 1024)
	in.Split(scanWords)
	out = bufio.NewWriter(os.Stdout)
}

func scanWords(data []byte, atEOF bool) (advance int, token []byte, err error) {
	if atEOF && len(data) == 0 {
		return 0, nil, nil
	}
	i := bytes.IndexByte(data, '\n')
	j := bytes.IndexByte(data, ' ')
	ind := min(i, j)
	if ind < 0 {
		ind = max(i, j)
	}
	if ind >= 0 {
		return ind + 1, dropCR(data[0:ind]), nil
	}
	if atEOF {
		return len(data), dropCR(data), nil
	}
	return 0, nil, nil
}

func dropCR(data []byte) []byte {
	if len(data) > 0 && data[len(data)-1] == '\r' {
		return data[:len(data)-1]
	}
	return data
}

func getFloat() float64 {
	in.Scan()
	b := in.Bytes()
	var isNeg bool
	if b[0] == '-' {
		isNeg = true
		b = b[1:]
	}
	var res1 int64
	for i := 0; i < len(b); i++ {
		if b[i] == '.' {
			b = b[i+1:]
			break
		}
		res1 *= 10
		res1 += int64(b[i]) - 48
		if i == len(b) - 1 {
			b = b[:0]
		}
	}
	var res2 float64
	for i := len(b); i > 0; i-- {
		res2 += float64(b[i-1]) - 48
		res2 /= 10
	}
	if isNeg {
		res1 *= -1
		res2 *= -1
	}
	return float64(res1) + res2
}

func getInt() int {
	in.Scan()
	b := in.Bytes()
	var isNeg bool
	if b[0] == '-' {
		isNeg = true
		b = b[1:]
	}
	var res int
	for i := 0; i < len(b); i++ {
		res *= 10
		res += int(b[i]) - 48
	}
	if isNeg {
		res *= -1
	}
	return res
}

func getInt64() int64 {
	in.Scan()
	b := in.Bytes()
	var isNeg bool
	if b[0] == '-' {
		isNeg = true
		b = b[1:]
	}
	var res int64
	for i := 0; i < len(b); i++ {
		res *= 10
		res += int64(b[i]) - 48
	}
	if isNeg {
		res *= -1
	}
	return res
}

func getString() string {
	in.Scan()
	return in.Text()
}

func intToBytes(n int) []byte {
	var res [33]byte
	var isNeg bool
	if n < 0 {
		isNeg = true
		n = -n
	}
	var l int = 33
	for n > 0 {
		l--
		res[l] = byte(n % 10 + 48)
		n /= 10
	}
	if l == 33 {
		l--
		res[l] = byte(48)
	}
	if isNeg {
		l--
		res[l] = byte(45)
	}
	return res[l:]
}

func int64ToBytes(n int64) []byte {
	var res [65]byte
	var isNeg bool
	if n < 0 {
		isNeg = true
		n = -n
	}
	var l int = 65
	for n > 0 {
		l--
		res[l] = byte(n % 10 + 48)
		n /= 10
	}
	if l == 65 {
		l--
		res[l] = byte(48)
	}
	if isNeg {
		l--
		res[l] = byte(45)
	}
	return res[l:]
}

func bsLower(arr []int, n int) int {
	var minN, midN, maxN int
	maxN = len(arr)
	for maxN - 1 > minN {
		midN = (minN + maxN) / 2
		if arr[midN] < n {
			minN = midN
		} else {
			maxN = midN
		}
	}
	if arr[minN] >= n {
		return minN
	}
	return maxN
}

func bsLower64(arr []int64, n int64) int {
	var minN, midN, maxN int
	maxN = len(arr)
	for maxN - 1 > minN {
		midN = (minN + maxN) / 2
		if arr[midN] < n {
			minN = midN
		} else {
			maxN = midN
		}
	}
	if arr[minN] >= n {
		return minN
	}
	return maxN
}

func bsUpper(arr []int, n int) int {
	var minN, midN, maxN int
	maxN = len(arr)
	for maxN - 1 > minN {
		midN = (minN + maxN) / 2
		if arr[midN] <= n {
			minN = midN
		} else {
			maxN = midN
		}
	}
	if arr[minN] > n {
		return minN
	}
	return maxN
}

func bsUpper64(arr []int64, n int64) int {
	var minN, midN, maxN int
	maxN = len(arr)
	for maxN - 1 > minN {
		midN = (minN + maxN) / 2
		if arr[midN] <= n {
			minN = midN
		} else {
			maxN = midN
		}
	}
	if arr[minN] > n {
		return minN
	}
	return maxN
}

func max(n1, n2 int) int {
	if n1 > n2 {
		return n1
	}
	return n2
}

func max64(n1, n2 int64) int64 {
	if n1 > n2 {
		return n1
	}
	return n2
}

func min(n1, n2 int) int {
	if n1 < n2 {
		return n1
	}
	return n2
}

func min64(n1, n2 int64) int64 {
	if n1 < n2 {
		return n1
	}
	return n2
}

func yes(res, isUpperCase bool) bool {
	var arr [4]string = [4]string{"No", "Yes", "NO", "YES"}
	var ind int
	if res == true {
		ind = 1
	}
	if isUpperCase == true {
		ind += 2
	}
	out.WriteString(arr[ind])
	out.WriteByte(NL)
	return res
}

package main

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

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

func flush()                            { out.Flush() }
func scan(a ...interface{})             { fmt.Fscan(in, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(out, f, a...) }
func assert(f bool) {
	if !f {
		panic("gg")
	}
}

// ----------------------------- TEMPLATE END ----------------------------------

func main() {
	defer flush()

	var ntc int
	scan(&ntc)
	for t := 0; t < ntc; t++ {
		var n int
		var x, y, ai int64
		scan(&n, &x, &y)
		x %= 2
		y %= 2
		for i := 0; i < n; i++ {
			scan(&ai)
			if ai%2 == 1 {
				x ^= 1
			}
		}
		if x == y {
			printf("Alice\n")
		} else {
			printf("Bob\n")
		}
	}
}

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

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

		if x%2 == 0 && y%2 == 0 || x%2 != 0 && y%2 != 0 {
			fmt.Fprintln(out, "Alice")
		} else {
			fmt.Fprintln(out, "Bob")
		}
	}
}

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

		var sum, t int64
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &t)
			sum += t
		}
		sum += x

		if sum % 2 == 0 && y % 2 == 0 || sum % 2 != 0 && y % 2 != 0 {
			fmt.Fprintln(out, "Alice")
		} else {
			fmt.Fprintln(out, "Bob")
		}

	}
}

package main

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

/*

 */

//goland:noinspection GoUnhandledErrorResult
func solve() {
	var n, x, y int64
	scanf("%d %d %d\n", &n, &x, &y)

	for i := 0; i < int(n); i++ {
		var a int64
		scanf("%d", &a)

		x ^= a
	}
	scanf("\n")

	if x%2 == y%2 {
		fmt.Fprintln(writer, "Alice")
	} else {
		fmt.Fprintln(writer, "Bob")
	}
}

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

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var tests int
	fmt.Fscan(in, &tests)
	for t := 0; t < tests; t++ {
		var n, x, y int64
		fmt.Fscan(in, &n, &x, &y)
		v := make([]int64, n)
		for i := range v {
			fmt.Fscan(in, &v[i])
		}
		var sum int64
		for _, q := range v {
			sum += q
		}
		if (sum+x+y)%2 == 0 {
			fmt.Println("Alice")
		} else {
			fmt.Println("Bob")
		}
	}
}

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

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

		for i := 0; i < n; i++ {
			if x+arr[i] > y {
				x ^= arr[i]
			} else {
				x += arr[i]
			}
		}

		if x != y {
			fmt.Fprintln(out, "Bob")
		} else {
			fmt.Fprintln(out, "Alice")
		}
	}
}

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

		arr := make([]int64, n)
		var sum int64
		var xor int64
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &arr[i])
			sum += arr[i]
		}

		var isWinner bool
		for i := n - 1; i >= 0; i-- {
			if (sum^xor)+x == y {
				isWinner = true
				break
			}

			xor ^= arr[i]
			sum -= arr[i]
		}

		if !isWinner && x^xor == y {
			isWinner = true
		}

		if !isWinner {
			fmt.Fprintln(out, "Bob")
		} else {
			fmt.Fprintln(out, "Alice")
		}
	}
}

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

		arr := make([]int64, n)
		var sum int64
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &arr[i])
			sum += arr[i]
		}

		winner := -1
		var xor int64
		for i := 0; i < n; i++ {
			if (x+sum)^xor == y {
				winner = 0
				break
			} else if (x+sum+3)^xor == y {
				winner = 1
				break
			}

			sum -= arr[n-1-i]
			xor ^= arr[n-1-i]
		}

		if winner == 0 || x^xor == y {
			fmt.Fprintln(out, "Alice")
		} else if winner == 1 || (x+3)^xor == y {
			fmt.Fprintln(out, "Bob")
		} else {
			fmt.Fprintln(out, "Alice")
		}
	}
}

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

		arr := make([]int64, n)
		var sum int64
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &arr[i])
			sum += arr[i]
		}

		winner := 0
		var xor int64
		for i := 0; i <= n; i++ {
			if (x+sum)^xor == y {
				break
			} else if (x+sum+3)^xor == y {
				winner = 1
				break
			}

			if n-1-i >= 0 {
				sum -= arr[n-1-i]
				xor ^= arr[n-1-i]
			}
		}

		if winner == 0 {
			fmt.Fprintln(out, "Alice")
		} else {
			fmt.Fprintln(out, "Bob")
		}
	}
}

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

		arr := make([]int64, n)
		var sum int64
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &arr[i])
			sum += arr[i]
		}

		winner := 0
		var xor int64
		for i := 0; i < n; i++ {
			if (x+sum)^xor == y {
				break
			} else if (x+sum+3)^xor == y {
				winner = 1
				break
			}

			sum -= arr[n-1-i]
			xor ^= arr[n-1-i]
		}

		if winner == 0 {
			fmt.Fprintln(out, "Alice")
		} else {
			fmt.Fprintln(out, "Bob")
		}
	}
}

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

		sum, t := x, int64(0)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &t)
			sum += t
		}

		if x % 2 == 0 && y % 2 == 0 || x % 2 != 0 && y % 2 != 0 {
			fmt.Fprintln(out, "Alice")
		} else {
			fmt.Fprintln(out, "Bob")
		}

	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var tests int
	fmt.Fscan(in, &tests)
	for t := 0; t < tests; t++ {
		var n, x, y int
		fmt.Fscan(in, &n, &x, &y)
		v := make([]int, n)
		for i := range v {
			fmt.Fscan(in, &v[i])
		}
		sum := 0
		for _, x := range v {
			sum += x
		}
		if (sum + x + y) % 2 == 0 {
			fmt.Print("Alice\n")
		} else {
			fmt.Print("Bob\n")
		}
	}
}

package main

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

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

	for ii := 0; ii < t; ii++ {
		var n int
		var a, y int64
		fmt.Fscan(in, &n, &a, &y)
		sum := a
		for i := 0; i < n; i++ {
			var num int64
			fmt.Fscan(in, &num)
			sum += num
		}
		if (sum+a+y)%2 == 0 {
			fmt.Fprint(out, "Alice")
		} else {
			fmt.Fprint(out, "Bob")
		}
	}
}

// 1 0 1 2

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()
	// arr := make([]int, 1e5+10)
	var T int
	var n, x, y int
	var v int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &x, &y)
		for i := 0; i < n; i++ {
			Fscan(in, &v)
			x ^= v
		}
		if x&1 == y&1 {
			Fprintln(out, "Alice")
		} else {
			Fprintln(out, "Bob")
		}
	}

}

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


package main

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

type Int int64

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

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

	var t int
	Fscan(in, &t)

	for tt := 0; tt < t; tt++ {
		var n int
		Fscan(in, &n)
		a := make([]Int, n)
		b := make([]Int, n)
		for i := 0; i < n; i++ {
			Fscan(in, &a[i])
		}
		cnt := L0
		mx := L0
		first := -1
		last := -1
		b[0] = 1
		for i := 1; i < n; i++ {
			if a[i] == a[i-1] {
				b[i] = b[i-1] + 1
				if b[i] == 2 {
					cnt++
					if cnt == 1 {
						first = i
					}
				}
				if b[i] > mx {
					mx = b[i]
				}
				if b[i] >= 2 {
					last = i
				}
			} else {
				b[i] = 1
			}
		}

		ans := L0
		if cnt == 1 {
			if mx > 2 {
				ans = Max(1, mx-3)
			}
		} else if cnt > 1 {
			ans = Int(last - 1 - first)
		}

		Fprintln(out, ans)

	}

}

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

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

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

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

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

package main

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

var in = bufio.NewReader(os.Stdin)

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

	a := -1
	b := -1

	arr := make([]int, n)
	for i := 0; i < n; i += 1 {
		fmt.Fscan(in, &arr[i])

		if i > 0 {
			if arr[i-1] == arr[i] {
				if a == -1 {
					a = i
				} else {
					b = i - 1
				}
			}
		}
	}

	if b == -1 {
		fmt.Printf("0\n")
	} else if a == b {
		fmt.Printf("1\n")
	} else {
		fmt.Printf("%d\n", b-a)
	}
}

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

	for i := 0; i < n; i += 1 {
		solve()
	}
}

package main

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

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

func solve() int {
	var n, x int
	fmt.Fscan(in, &n)

	ar := make([]int, 0, 0)

	for i := 0; i < n; i++ {
		fmt.Fscan(in, &x)
		ar = append(ar, x)
	}

	var L, R int = -1, -1

	for i := 0; i < n-1; i++ {
		if ar[i] == ar[i+1] {
			R = i
			if L == -1 {
				L = i
			}
		}
	}

	if R == L {
		return 0
	}

	if R-L-1 > 1 {
		return R - L - 1
	}
	return 1
}

func main() {
	defer out.Flush()

	var t int
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		fmt.Fprintln(out, solve())
	}
}

package main

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

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

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

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

		l, r := -1, -1
		for i := 1; i < n; i++ {
			if arr[i-1] == arr[i] && l < 0 {
				l = i - 1
			} else if arr[i-1] == arr[i] {
				r = i
			}
		}

		if l < 0 || r < 0 {
			fmt.Fprintln(out, 0)
		} else if (r - l + 1) <= 4 {
			fmt.Fprintln(out, 1)
		} else {
			fmt.Fprintln(out, r-l+1-3)
		}
	}
}

package main

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

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

	var t int
	fmt.Fscanf(in, "%d\n", &t)

	for ; t > 0; t-- {
		var n int
		fmt.Fscanf(in, "%d\n", &n)

		arr := make([]int, n)

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

		max := -1
		min := -1
		for i := 1; i < n; i++ {
			if arr[i] == arr[i - 1] {
				if min == -1 {
					min = i
				}
				max = i
			}
		}
		if min == max {
			fmt.Fprintln(out, 0)
		} else {
			fmt.Fprintln(out, math.Max(1, float64(max - min - 1)))
		}
	}
}

package main

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

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

var T int
var N int

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

	fmt.Fscan(in, &T)
	for ; T > 0; T-- {
		fmt.Fscan(in, &N)
		a := make([]int, N)
		for i := range a {
			fmt.Fscan(in, &a[i])
		}
		left, right := -1, -1
		e_cnt := 0
		for i := 0; i < N-1; i++ {
			if a[i] == a[i+1] {
				e_cnt++
				if left == -1 {
					left = i
				}
				right = i + 1
			}
		}
		length := right - left + 1
		if length-2 < 0 || e_cnt <= 1 {
			fmt.Fprintln(out, 0)
		} else {
			fmt.Fprintln(out, max(1, length-2-1))
		}
	}
}

func max(i, j int) int {
	if i > j {
		return i
	}
	return j
}

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 s int
		fmt.Fscan(in, &s)
		nums := make([]int, s)
		for i := 0; i < s; i++ {
			fmt.Fscan(in, &nums[i])
		}
		var n [][]int
		count := 1
		for i := 1; i < s; i++ {
			if nums[i] == nums[i-1] {
				count++
				if i == s-1 {
					n = append(n, []int{i - count + 1, count})
					count = 0
				}
			} else {
				if count > 1 {
					n = append(n, []int{i - count, count})
				}
				count = 1
			}
		}
		//fmt.Println(n)
		if len(n) == 0 {
			fmt.Fprintln(out, "0")
			continue
		}
		if len(n) == 1 {
			c := n[0][1]
			if c == 2 {
				fmt.Fprintln(out, 0)
			} else if c == 3 {
				fmt.Fprintln(out, 1)
			} else {
				fmt.Fprintln(out, c-3)
			}
			continue
		}

		fmt.Fprintln(out, n[len(n)-1][0]+n[len(n)-1][1]-2-n[0][0]-1)
	}
}

package main

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

func calculateEquality(input []int) int {
	length := len(input)
	result := 0
	for i := 0; i < length-1; i++ {
		if input[i] == input[i+1] {
			result++
		}
	}
	return result
}
func oneIfEqual(a, b int) int {
	if a == b {
		return 1
	}
	return 0
}
func solve(input []int) int {
	length := len(input)
	if length <= 2 {
		return 0
	}
	equality := calculateEquality(input)
	replacement := 0
	changes := 0
	shouldChange := func(index int) bool {
		if index <= 0 || index >= length-1 {
			return false
		}
		return input[index-1] == input[index]
	}
	makeChange := func(index int) {
		if index <= 0 || index >= length-1 {
			return
		}
		dif := 0
		if index <= length-3 {
			a := input[index-1]
			b := input[index]
			c := input[index+1]
			d := input[index+2]
			dif = (oneIfEqual(a, replacement) + oneIfEqual(replacement, replacement) + oneIfEqual(replacement, d)) - (oneIfEqual(a, b) + oneIfEqual(b, c) + oneIfEqual(c, d))
		} else {
			// index == length-2
			a := input[index-1]
			b := input[index]
			c := input[index+1]
			dif = (oneIfEqual(a, replacement) + oneIfEqual(replacement, replacement)) - (oneIfEqual(a, b) + oneIfEqual(b, c))
		}
		input[index] = replacement
		input[index+1] = replacement
		changes++
		replacement--
		equality += dif
	}
	for i := 0; i < length && equality > 1; i++ {
		if shouldChange(i) {
			makeChange(i)
		}
	}
	return changes
}

func main() {
	input := bufio.NewReader(os.Stdin)
	t := readInt(input)
	for i := 0; i < t; i++ {
		readInt(input)
		arr := readArrInt(input)
		solution := solve(arr)
		fmt.Println(solution)
	}
}

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

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

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

package main

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

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

	var T, n, pre, v int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &pre)
		p := []int{}
		for i := 1; i < n; i++ {
			if Fscan(in, &v); v == pre {
				p = append(p, i)
			}
			pre = v
		}
		if len(p) < 2 {
			Fprintln(out, 0)
		} else {
			ans := p[len(p)-1] - p[0] - 1
			if ans < 1 {
				ans = 1
			}
			Fprintln(out, ans)
		}
	}
}

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

package main

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

/*
3
4
3 1 5 3
6
2 1 1 2 1 4
7
0 1 1 1 5 0 0
---
0
0
3 = 0 1 2 3 4 4 0
========
6
2
1 1
3
1 1 1
4
1 1 1 1
5
1 1 1 1 1
6
1 1 1 1 1 1
7
1 1 1 1 1 1 1
---
0
1 = 1 2 2
1 = 1 2 2 1
2 = 1 2 3 3 1
3 = 1 2 4 4 3 1 or 1 2 3 4 4 1
4 = 1 2 3 4 5 5 1 or 1 2 4 5 5 3 1
==========
2
4
1 1 2 2
10
1 2 2 3 4 5 6 7 7 8
---
2
5 = 1 2 10 11 12 13 14 14 7 8
*/

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

	a := make([]int, n)

	for i := range a {
		scanf("%d", &a[i])
	}
	scanf("\n")

	equalityCnt := 0
	firstEqualityIdx := -1
	lastEqualityIdx := -1

	for i, lft := range a[:n-1] {
		rht := a[i+1]
		if lft == rht {
			equalityCnt++

			if equalityCnt == 1 {
				firstEqualityIdx = i
			}

			lastEqualityIdx = i
		}
	}

	if equalityCnt <= 1 {
		fmt.Fprintln(writer, 0)
		return
	}

	if abs(lastEqualityIdx-firstEqualityIdx) == 1 {
		fmt.Fprintln(writer, 1)
		return
	}

	fmt.Fprintln(writer, lastEqualityIdx-firstEqualityIdx-1)
}

//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 GoUnusedFunction
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 "fmt"

func solve() {
	var n int
	_, _ = fmt.Scanf("%d\n", &n)

	a := -1
	b := -1

	arr := make([]int, n)
	for i := 0; i < n; i += 1 {
		_, _ = fmt.Scan(&arr[i])

		if i > 0 {
			if arr[i-1] == arr[i] {
				if a == -1 {
					a = i
				} else {
					b = i - 1
				}
			}
		}
	}

	if b == -1 {
		fmt.Printf("0\n")
	} else if a == b {
		fmt.Printf("1\n")
	} else {
		fmt.Printf("%d\n", b-a)
	}
}

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

	for i := 0; i < n; i += 1 {
		solve()
	}
}

package main

import "fmt"

func solve() {
	var n int
	_, _ = fmt.Scanf("%d\n", &n)

	a := -1
	b := -1

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

		if i > 0 {
			if arr[i-1] == arr[i] {
				if a == -1 {
					a = i
				} else {
					b = i - 1
				}
			}
		}
	}

	if b == -1 {
		fmt.Printf("0\n")
	} else if a == b {
		fmt.Printf("1\n")
	} else {
		fmt.Printf("%d\n", b-a)
	}
}

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

	for i := 0; i < n; i += 1 {
		solve()
	}
}

package main

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

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

func solve() int {
	var n, x int
	fmt.Fscan(in, &n)

	ar := make([]int, 0, 0)

	for i := 0; i < n; i++ {
		fmt.Fscan(in, &x)
		ar = append(ar, x)
	}

	var cnt int = 0

	for i := 1; i < n; i++ {
		if ar[i] == ar[i-1] {
			cnt++
		}
	}
	if cnt <= 1 {
		return 0
	}
	cnt = 0

	for i := 1; i < n; i++ {
		if ar[i] == ar[i-1] {
			cnt++
			i += 2
		}
	}
	return cnt
}

func main() {
	defer out.Flush()

	var t int
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		fmt.Fprintln(out, solve())
	}
}

package main

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

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

func solve() int {
	var n, x int
	fmt.Fscan(in, &n)

	ar := make([]int, 0, 0)

	for i := 0; i < n; i++ {
		fmt.Fscan(in, &x)
		ar = append(ar, x)
	}

	var cnt int = 0

	for i := 1; i < n; i++ {
		if ar[i] == ar[i-1] {
			cnt++
		}
	}
	if cnt <= 1 {
		return 0
	}
	cnt = 0

	for i := 1; i < n; i++ {
		if ar[i] == ar[i-1] {
			cnt++
			i++
		}
	}
	return cnt
}

func main() {
	defer out.Flush()

	var t int
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		fmt.Fprintln(out, solve())
	}
}

package main

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

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

func solve() int {
	var n, x int
	fmt.Fscan(in, &n)

	ar := make([]int, 0, 0)

	for i := 0; i < n; i++ {
		fmt.Fscan(in, &x)
		ar = append(ar, x)
	}

	var cnt int = 0
	for i := 1; i < n; i++ {
		if ar[i] == ar[i-1] {
			cnt++
			i++
		}
	}
	return cnt
}

func main() {
	defer out.Flush()

	var t int
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		fmt.Fprintln(out, solve())
	}
}

package main

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

type Int int64

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

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

	var t int
	Fscan(in, &t)

	for tt := 0; tt < t; tt++ {
		var n int
		Fscan(in, &n)
		last := -1
		cnt := 1
		ans := 0
		num := 0
		for i := 0; i <= n; i++ {
			var x int
			if i < n {
				Fscan(in, &x)
			}

			if x == last {
				cnt++
			} else {
				if cnt > 1 {
					num++
				}
				if cnt > 2 {
					ans += int(Max(Int(cnt-3), L1))
				}
				cnt = 1
			}
			last = x
		}
		if num > 1 {
			ans += num
		}
		Fprintln(out, ans)

	}

}

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

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

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

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

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

package main

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

type Int int64

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

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

	var t int
	Fscan(in, &t)

	for tt := 0; tt < t; tt++ {
		var n int
		Fscan(in, &n)
		last := -1
		mx := -1
		cnt := 1
		ans := 0
		for i := 0; i < n; i++ {
			var x int
			Fscan(in, &x)

			if x == last {
				cnt++
				if cnt > mx {
					mx = cnt
				}
			} else {
				ans += cnt - 1
				cnt = 1
			}
			last = x
		}
		ans += cnt - 1
		if mx > 1 {
			ans = ans - (mx - 1)
			ans += int(Max(Int(mx-3), Int(1)))
		}
		Fprintln(out, ans)

	}

}

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

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

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

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

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

package main

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

type Int int64

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

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

	var t int
	Fscan(in, &t)

	for tt := 0; tt < t; tt++ {
		var n int
		Fscan(in, &n)
		last := -1
		mx := -1
		cnt := 1
		ans := 0
		for i := 0; i < n; i++ {
			var x int
			Fscan(in, &x)

			if x == last {
				cnt++
				if cnt > mx {
					mx = cnt
				}
			} else {
				ans += cnt - 1
				cnt = 1
			}
			last = x
		}
		ans += cnt - 1
		if mx > 1 {
			ans = ans - (mx - 1) + mx/2
		}
		Fprintln(out, ans)

	}

}

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

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

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

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

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

package main

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

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

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

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

		l, r := -1, -1
		for i := 1; i < n; i++ {
			if arr[i-1] == arr[i] && l < 0 {
				l = i - 1
			} else if arr[i-1] == arr[i] {
				r = i
			}
		}

		if l < 0 || r < 0 {
			fmt.Fprintln(out, 0)
		} else {
			fmt.Fprintln(out, (r-l+1)/2)
		}
	}
}

package main

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

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

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

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

		l, r := -1, -1
		for i := 1; i < n; i++ {
			if arr[i-1] == arr[i] && l < 0 {
				l = i - 1
			} else if arr[i-1] == arr[i] {
				r = i
			}
		}

		if l < 0 || r < 0 {
			fmt.Fprintln(out, 0)
		} else {
			fmt.Fprintln(out, (r-l)/2)
		}
	}
}

package main

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

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

	var t int
	fmt.Fscanf(in, "%d\n", &t)

	for ; t > 0; t-- {
		var n int
		fmt.Fscanf(in, "%d\n", &n)

		ans := 0
		count := 0
		prev := 0

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

			if num == prev && i != n - 1 {
				count++
				continue
			}

			ans += count / 2
			count = 1
			prev = num
		}

		fmt.Fscanf(in, "\n")

		fmt.Fprintln(out, ans)
	}
}

package main

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

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

var T int
var N int

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

	fmt.Fscan(in, &T)
	for ; T > 0; T-- {
		fmt.Fscan(in, &N)
		a := make([]int, N)
		for i := range a {
			fmt.Fscan(in, &a[i])
		}
		left, right := -1, -1
		for i := 0; i < N-1; i++ {
			if a[i] == a[i+1] {
				if left == -1 {
					left = i
				}
				right = i + 1
			}
		}
		length := right - left + 1
		if length-2 < 0 {
			fmt.Fprintln(out, 0)
		} else {
			fmt.Fprintln(out, max(1, length-2-1))
		}
	}
}

func max(i, j int) int {
	if i > j {
		return i
	}
	return j
}

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 s int
		fmt.Fscan(in, &s)
		nums := make([]int, s)
		for i := 0; i < s; i++ {
			fmt.Fscan(in, &nums[i])
		}
		var n [][]int
		count := 1
		for i := 1; i < s; i++ {
			if nums[i] == nums[i-1] {
				count++
				if i == s-1 {
					n = append(n, []int{i, count})
					count = 0
				}
			} else {
				if count > 1 {
					n = append(n, []int{i - count, count})
				}
				count = 1
			}
		}
		//fmt.Println(n)
		if len(n) == 0 {
			fmt.Fprintln(out, "0")
			continue
		}
		if len(n) == 1 {
			c := n[0][1]
			if c == 2 {
				fmt.Fprintln(out, 0)
			} else if c == 3 {
				fmt.Fprintln(out, 1)
			} else {
				fmt.Fprintln(out, c-3)
			}
			continue
		}

		fmt.Fprintln(out, n[len(n)-1][0]+n[len(n)-1][1]-2-n[0][0]-1)
	}
}


package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	text, _ := reader.ReadString('\n')
	text = strings.TrimRight(text, "\r\n")

	u := 0
	d := 0
	l := 0
	r := 0
	if len(text)%2 != 0 {
		fmt.Println(-1)
	} else {
		for _, v := range text {
			if v == 'U' {
				u++
			}
			if v == 'D' {
				d++
			}
			if v == 'L' {
				l++
			}
			if v == 'R' {
				r++
			}
		}

		U := u - d
		if U < 0 {
			U = 0 - U
		}
		L := l - r
		if L < 0 {
			L = 0 - L
		}
		if U > L {
			v := U - L
			v = (v / 2) + L
			fmt.Println(v)
		} else {
			v := L - U
			v = (v / 2) + U
			fmt.Println(v)
		}
	}

}

package main

import "fmt"
import "bufio"
import "os"

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

	var s string
	fmt.Fscanf(buf, "%s\n", &s)

	n := len(s)
	u := 0
	d := 0
	l := 0
	r := 0
	for i := 0; i < n; i++ {
		c := s[i]
		if c == 'U' {
			u++
		} else if c == 'D' {
			d++
		} else if c == 'L' {
			l++
		} else if c == 'R' {
			r++
		}
	}

	if u < d {
		u, d = d, u
	}

	if l < r {
		l, r = r, l
	}

	res := 0
	for u-1 >= d+1 {
		res++
		u--
		d++
	}

	for l-1 >= r+1 {
		res++
		l--
		r++
	}

	x := u - d
	y := l - r

	if x != y {
		fmt.Printf("-1\n")
	} else {
		if x == 1 {
			res++
		}
		fmt.Printf("%d\n", res)
	}
}

// http://codeforces.com/contest/712/problem/B
package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)

func main () {
	var str string

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input := bufio.NewReader(os.Stdin)

	fmt.Fscanln(input, &str)

	if len(str) % 2 != 0 {
		fmt.Println(-1)
		return
	}

	x := 0;
	y := 0;

	for i := 0; i < len(str); i++ {
		switch str[i] {
		case 'U': y++;
		case 'D': y--;
		case 'R': x++;
		case 'L': x--;
		}
	}

	fmt.Println(math.Abs(float64(x)) / 2 + math.Abs(float64(y)) / 2)
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	re := regexp.MustCompile(`\r?\n`)

	if s, err := reader.ReadString('\n'); err != nil {
		if err != io.EOF {
			return
		}
	} else {
		s = re.ReplaceAllString(s, "")

		directions := map[rune]int{}
		for _, r := range s {
			directions[r] += 1
		}

		xd := abs(directions['R'] - directions['L'])
		yd := abs(directions['U'] - directions['D'])

		if (xd+yd)%2 != 0 {
			fmt.Println(-1)
		} else {
			fmt.Println((xd + yd) / 2)
		}
	}
}

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

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	text, _ := reader.ReadString('\n')
	text = strings.TrimRight(text, "\r\n")

	u := 0
	d := 0
	l := 0
	r := 0
	if len(text)%2 != 0 {
		fmt.Println(-1)
	} else {
		for _, v := range text {
			if v == 'U' {
				u++
			}
			if v == 'D' {
				d++
			}
			if v == 'L' {
				l++
			}
			if v == 'R' {
				r++
			}
		}

		U := u - d
		if U < 0 {
			U = 0 - U
		}
		L := l - r
		if L < 0 {
			L = 0 - L
		}
		if U > L {
			fmt.Println(U)
		} else {
			fmt.Println(L)
		}
	}

}


package main

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

var in = bufio.NewScanner(os.Stdin)

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

func main() {
	in.Split(bufio.ScanWords)
	n, m, w := readInt(), readInt(), readInt()
	a := make([]int, n)
	max := 0
	for i := range a {
		a[i] = readInt()
		if a[i] > max {
			max = a[i]
		}
	}

	q := make([]int, 0, m)
	fmt.Println(sort.Search(max+m+1, func(minHeight int) bool {
		used := 0
		q := q
		for i := range a {
			for len(q) > 0 && q[0] == i {
				q = q[1:]
			}
			for len(q)+a[i] < minHeight {
				used++
				if used > m {
					return true
				}
				q = append(q, i+w)
			}
		}
		return used > m
	}) - 1)
}

package main

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

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

	var n, m, w int
	fmt.Fscanf(r, "%d %d %d\n", &n, &m, &w)

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

	fmt.Println(minMax(a, m, w))
}

func minMax(a []int, m, w int) int {
	var ret int

	lo, hi := 0, int(2e9)
	for lo <= hi {
		mid := int((int64(lo) + int64(hi)) / 2)
		b := make([]int, len(a))
		copy(b, a)

		can := true
		free := m
		x := 0
		for i := 0; i < len(b); i++ {
			cur := b[i] + x
			for cur < mid && free > 0 {
				cur++
				x++
				free--
			}
			if cur < mid {
				can = false
				break
			}
			if i+w < len(b) {
				b[i+w] -= x
			}
		}

		if can {
			lo = mid + 1
			ret = mid
		} else {
			hi = mid - 1
		}
	}

	return ret
}

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

package main

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

var in = bufio.NewScanner(os.Stdin)

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

func main() {
	in.Split(bufio.ScanWords)
	n, m, w := readInt(), readInt(), readInt()
	a := make([]int, n)
	max := 0
	for i := range a {
		a[i] = readInt()
		if a[i] > max {
			max = a[i]
		}
	}

	q := make([]int, 0, m)
	fmt.Println(sort.Search(max+m, func(minHeight int) bool {
		used := 0
		q := q
		for i := range a {
			for len(q) > 0 && q[0] == i {
				q = q[1:]
			}
			for len(q)+a[i] < minHeight {
				used++
				if used > m {
					return true
				}
				q = append(q, i+w)
			}
		}
		return used > m
	}) - 1)
}

package main

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

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

	var n, m, w int
	fmt.Fscanf(r, "%d %d %d\n", &n, &m, &w)

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

	fmt.Println(minMax(a, m, w))
}

func minMax(a []int, m, w int) int {
	var ret int

	lo, hi := 0, int(1e6)
	for lo <= hi {
		mid := (lo + hi) / 2
		b := make([]int, len(a))
		copy(b, a)

		can := true
		free := m
		x := 0
		for i := 0; i < len(b); i++ {
			cur := b[i] + x
			for cur < mid && free > 0 {
				cur++
				x++
				free--
			}
			if cur < mid {
				can = false
				break
			}
			if i+w < len(b) {
				b[i+w] -= x
			}
		}

		if can {
			lo = mid + 1
			ret = mid
		} else {
			hi = mid - 1
		}
	}

	return ret
}


package main

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

func A() {
	_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()
	// Coding...beg!
	sol = func() {
		/*
			T_C
			var n int
			Fscan(in, &n)
			a := make([]int, n)
			Map := make(map[int]int, 0)
			for i := 0; i < n; i++ {
				Fscan(in, &a[i])
				Map[a[i]]++
			}
			var cnt, cnt2 int
			for _, v := range Map {
				if v == 1 {
					cnt++
				} else {
					cnt2++
				}
			}
			Fprintln(out, cnt2+(cnt+1)/2) */
		/* T_A */
		/* var s string
		var n int
		Fscan(in, &n)
		Fscan(in, &s)
		var j, k int
		for j = n / 2; j >= 0 && s[j] == s[n/2]; j-- {

		}
		for k = n / 2; k < n && s[k] == s[n/2]; k++ {

		}
		Fprintln(out, k-j-1) */
		/* T_b */
		var n int
		Fscan(in, &n)
		a := make([]int, n)
		for i := 0; i < n; i++ {
			Fscan(in, &a[i])
		}
		var g []int
		for i := 0; i < n; i++ {
			if a[i] != i {
				g = append(g, a[i])
			}
		}
		cnt := make([]int, 20)
		for i := 0; i < len(g); i++ {
			x := g[i]
			for k := 0; k < 20; k++ {
				if (x & (1 << k)) != 0 {
					cnt[k]++
				}
			}
		}
		var ans int
		for i := 0; i < 20; i++ {
			if cnt[i] == len(g) {
				ans += (1 << i)
			}
		}
		Fprintln(out, ans)
	}
	// Coding...ove!
	for i := 0; i < cas; i++ {
		sol()
	}
}
func main() { A() }

package main

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

func main() {

	var T int
	var N int
	var x int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &T)
	for T > 0 {
		fmt.Fscan(in, &N)
		ans := (1 << 30) - 1
		for i := 0; i < N; i++ {
			fmt.Fscan(in, &x)
			if x != i {
				ans &= x
			}
		}
		fmt.Println(ans)
		T--
	}
}

package main

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

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

func scan(a ...interface{}) {
	fmt.Fscan(in, a...)
}
func printf(f string, a ...interface{}) {
	fmt.Fprintf(out, f, a...)
}

func solve() {
	var n int
	scan(&n)
	a := make([]int, n)
	b := make([]int, n)
	for i := 0; i < n; i++ {
		scan(&a[i])
	}
	copy(b, a)
	sort.Slice(b, func(i, j int) bool {
		return b[i] < b[j]
	})
	ans := 0xffffffff
	for i := 0; i < n; i++ {
		if a[i] != b[i] {
			// printf("%d %d\n", a[i], b[i])
			ans &= a[i]
		}
	}
	printf("%d\n", ans)
}
func main() {
	defer out.Flush()
	n := 0
	scan(&n)
	for i := 0; i < n; i++ {
		solve()
	}
}

package main

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

func main() {
	scanner := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	var ntests int
	fmt.Fscan(scanner, &ntests)
	for iter := 0; iter < ntests; iter++ {
		var n int
		fmt.Fscan(scanner, &n)
		//slice := make([]int, n)
		res := 1024*1024 - 1
		for i := 0; i < n; i++ {
			var tmp int
			fmt.Fscan(scanner, &tmp)
			if tmp != i {
				res = res & tmp
			}
		}
		fmt.Fprintln(writer, res)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)
var wrtr = bufio.NewWriterSize(os.Stdout, 10_000_000)
var rdr = bufio.NewScanner(os.Stdin)
func gs() string  { rdr.Scan(); return rdr.Text() }
func gi() int     { i,e := strconv.Atoi(gs()); if e != nil {panic(e)}; return i }
func gi2() (int,int) { return gi(),gi() }
func gi3() (int,int,int) { return gi(),gi(),gi() }
func gi4() (int,int,int,int) { return gi(),gi(),gi(),gi() }
func gis(n int) []int  { res := make([]int,n); for i:=0;i<n;i++ { res[i] = gi() }; return res }
func gf() float64 { f,e := strconv.ParseFloat(gs(),64); if e != nil {panic(e)}; return f }
func gbs() []byte { return []byte(gs()) }
func gfs(n int) []float64  { res := make([]float64,n); for i:=0;i<n;i++ { res[i] = gf() }; return res }
func gss(n int) []string  { res := make([]string,n); for i:=0;i<n;i++ { res[i] = gs() }; return res }
func ia(m int) []int { return make([]int,m) }
func iai(m int,v int) []int { a := make([]int,m); for i:=0;i<m;i++ { a[i] = v }; return a }
func twodi(n int,m int,v int) [][]int {
	r := make([][]int,n); for i:=0;i<n;i++ { x := make([]int,m); for j:=0;j<m;j++ { x[j] = v }; r[i] = x }; return r
}
func fill2(m int) ([]int,[]int) { a,b := ia(m),ia(m); for i:=0;i<m;i++ {a[i],b[i] = gi(),gi()}; return a,b }
func fill3(m int) ([]int,[]int,[]int) { a,b,c := ia(m),ia(m),ia(m); for i:=0;i<m;i++ {a[i],b[i],c[i] = gi(),gi(),gi()}; return a,b,c }
func fill4(m int) ([]int,[]int,[]int,[]int) { a,b,c,d := ia(m),ia(m),ia(m),ia(m); for i:=0;i<m;i++ {a[i],b[i],c[i],d[i] = gi(),gi(),gi(),gi()}; return a,b,c,d }
func abs(a int) int { if a < 0 { return -a }; return a }
func rev(a []int) { i,j := 0,len(a)-1; for i < j { a[i],a[j] = a[j],a[i]; i++; j-- } }
func max(a,b int) int { if a > b { return a }; return b }
func min(a,b int) int { if a > b { return b }; return a }
func tern(cond bool, a int, b int) int { if cond { return a }; return b }
func terns(cond bool, a string, b string) string { if cond { return a }; return b }
func maxarr(a []int) int { ans := a[0]; for _,aa := range(a) { if aa > ans { ans = aa } }; return ans }
func minarr(a []int) int { ans := a[0]; for _,aa := range(a) { if aa < ans { ans = aa } }; return ans }
func sumarr(a []int) int { ans := 0; for _,aa := range(a) { ans += aa }; return ans }
func zeroarr(a []int) { for i:=0; i<len(a); i++ { a[i] = 0 } }
func powmod(a,e,mod int) int { res, m := 1, a; for e > 0 { if e&1 != 0 { res = res * m % mod }; m = m * m % mod; e >>= 1 }; return res }
func powint(a,e int) int { res, m := 1, a; for e > 0 { if e&1 != 0 { res = res * m }; m = m * m; e >>= 1 }; return res }
func gcd(a,b int) int { for b != 0 { t:=b; b=a%b; a=t }; return a }
func gcdExtended(a,b int) (int,int,int) { if a == 0 { return b,0,1 }; gcd,x1,y1 := gcdExtended(b%a,a); return gcd, y1-(b/a)*x1,x1 }
func modinv(a,m int) (int,bool) { g,x,_ := gcdExtended(a,m); if g != 1 { return 0,false }; return (x % m + m) % m,true  }
func makefact(n int,mod int) ([]int,[]int) {
	fact,factinv := make([]int,n+1),make([]int,n+1)
	fact[0] = 1; for i:=1;i<=n;i++ { fact[i] = fact[i-1] * i % mod }
	factinv[n] = powmod(fact[n],mod-2,mod); for i:=n-1;i>=0;i-- { factinv[i] = factinv[i+1] * (i+1) % mod }
	return fact,factinv
}
func vecintstring(a []int) string { astr := make([]string,len(a)); for i,a := range a { astr[i] = strconv.Itoa(a) }; return strings.Join(astr," ") }
func main() {
	//f1, _ := os.Create("cpu.prof"); pprof.StartCPUProfile(f1); defer pprof.StopCPUProfile()
	defer wrtr.Flush()
	infn := ""; if infn == "" && len(os.Args) > 1 {	infn = os.Args[1] }
	if infn != "" {	f, e := os.Open(infn); if e != nil { panic(e) }; rdr = bufio.NewScanner(f) }
	rdr.Split(bufio.ScanWords); rdr.Buffer(make([]byte,1024),1_000_000_000)
	// PROGRAM STARTS HERE
	T := gi()
	for tt:=1;tt<=T;tt++ {
		N := gi(); P := gis(N);
		X := 0x3fffffff
		for i:=0;i<N;i++ { if P[i] != i { X = X & i } }
		fmt.Fprintln(wrtr,X)
	}
}

package main

import (
	"bufio"
	"container/heap"
	. "fmt"
	"math"
	"os"
)

type Int int64

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

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

	var T int
	Fscan(in, &T)

	for tt := 0; tt < T; tt++ {
		var n, x Int
		Fscan(in, &n)

		k := -L1
		for i := L0; i < n; i++ {
			Fscan(in, &x)
			if x != i {
				if k == -1 {
					k = x
				} else {
					k = k & x
				}
			}
		}
		Fprintln(out, k)

	}

}

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

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

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

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

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

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

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

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

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

func doNothing(m Int) Int {
	return m
}

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

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

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

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

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

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

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

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

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

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

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

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

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

// An Item is something we manage in a priority queue.
type Item struct {
	value    Int // The value of the item; arbitrary.
	priority Int // The priority of the item in the queue.
	indices  Int
	// The index is needed by update and is maintained by the heap.Interface methods.
	index int // The index of the item in the heap.
}

// A PriorityQueue implements heap.Interface and holds Items.
type PriorityQueue []*Item

func NewItem(value, priority Int) *Item {
	return &Item{
		value:    value,
		priority: priority,
		index:    -1,
	}

}

func (pq PriorityQueue) Len() int { return len(pq) }

func (pq PriorityQueue) Less(i, j int) bool {
	// We want Pop to give us the highest, not lowest, priority so we use greater than here.
	return pq[i].priority < pq[j].priority
}

func (pq PriorityQueue) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *PriorityQueue) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Item)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *PriorityQueue) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	old[n-1] = nil  // avoid memory leak
	item.index = -1 // for safety
	*pq = old[0 : n-1]
	return item
}

// update modifies the priority and value of an Item in the queue.
func (pq *PriorityQueue) update(item *Item, value Int, priority Int) {
	item.value = value
	item.priority = priority
	heap.Fix(pq, item.index)
}

type SegTree struct {
	st []Segment
}

type Segment struct {
	l, r, val, add, minIndex Int
}

func newSegTree(n Int) SegTree {
	segTree := SegTree{make([]Segment, n<<2)}
	segTree.Build(1, 1, n)
	return segTree
}

func (segTree SegTree) Build(x, l, r Int) {
	segTree.st[x].l = l
	segTree.st[x].r = r
	if l == r {
		segTree.st[x].minIndex = l
		return
	}
	mid := (l + r) >> 1
	segTree.Build(x<<1, l, mid)
	segTree.Build(x<<1|1, mid+1, r)
}

func (segTree SegTree) push(x Int) {
	if segTree.st[x].add != 0 {
		segTree.modifyOne(x<<1, segTree.st[x].add)
		segTree.modifyOne(x<<1|1, segTree.st[x].add)
		segTree.st[x].add = 0
	}
}

func (segTree SegTree) update(x Int) {
	if segTree.st[x<<1].val < segTree.st[x<<1|1].val {
		segTree.st[x].val = segTree.st[x<<1].val
		segTree.st[x].minIndex = segTree.st[x<<1].minIndex
	} else {
		segTree.st[x].val = segTree.st[x<<1|1].val
		segTree.st[x].minIndex = segTree.st[x<<1|1].minIndex
	}
}

func (segTree SegTree) modifyOne(x, add Int) {
	segTree.st[x].val += add
	if segTree.st[x].l != segTree.st[x].r {
		segTree.st[x].add += add
	}
}

func (segTree SegTree) Modify(x, l, r, add Int) {
	if segTree.st[x].l >= l && segTree.st[x].r <= r {
		segTree.modifyOne(x, add)
		return
	}
	segTree.push(x)
	mid := (segTree.st[x].l + segTree.st[x].r) >> 1
	if mid >= l {
		segTree.Modify(x<<1, l, r, add)
	}
	if mid < r {
		segTree.Modify(x<<1|1, l, r, add)
	}
	segTree.update(x)
}

func updateRes(cRes, cIndex, res, index Int) (Int, Int) {
	if cRes > res {
		return res, index
	}
	return cRes, cIndex
}

func (segTree SegTree) Query(x, l, r Int) (Int, Int) {
	res := Int(math.MaxInt64)
	resInd := -L1
	if segTree.st[x].l >= l && segTree.st[x].r <= r {
		res, resInd = updateRes(res, resInd, segTree.st[x].val, segTree.st[x].minIndex)
		return res, resInd
	}
	mid := (segTree.st[x].l + segTree.st[x].r) >> 1
	if mid >= l {
		sonRes, sonInd := segTree.Query(x<<1, l, r)
		res, resInd = updateRes(res, resInd, sonRes, sonInd)
	}
	if mid < r {
		sonRes, sonInd := segTree.Query(x<<1|1, l, r)
		res, resInd = updateRes(res, resInd, sonRes, sonInd)
	}
	return res, resInd
}

type Graph struct {
	nodeSize Int
	edges    []Edge
	head     []Int
	dis      []Int
	vis      []bool
	nCnt     Int
	ans      []Int
}

type Edge struct {
	u, v, c, indices, next Int
}

func NewGraph(nodeSize Int) *Graph {
	return &Graph{
		nodeSize: nodeSize,
		edges:    make([]Edge, (2e5+10)<<2),
		head:     make([]Int, nodeSize+100),
		dis:      make([]Int, nodeSize+100),
		vis:      make([]bool, nodeSize+100),
		nCnt:     L1,
		ans:      make([]Int, nodeSize),
	}
}

func (g *Graph) addEdge(u Int, v Int, cost Int, indices Int) {
	g.nCnt++
	g.edges[g.nCnt] = Edge{u, v, cost, indices, g.head[u]}
	g.head[u] = g.nCnt
}

func (g *Graph) Dijkstra(begin Int) {
	for i := L1; i <= g.nodeSize; i++ {
		g.dis[i] = math.MaxInt64
	}
	pq := make(PriorityQueue, 0)
	heap.Init(&pq)

	g.dis[begin] = 0
	heap.Push(&pq, &Item{begin, 0, -1, -1})

	id := L0

	for len(pq) > 0 {
		it := heap.Pop(&pq).(*Item)
		u := it.value
		if g.vis[u] {
			continue
		}
		g.vis[u] = true

		if it.indices != -1 && id < g.nodeSize-1 {
			g.ans[id] = it.indices
			id++
		}

		for i := g.head[u]; i != 0; i = g.edges[i].next {
			v := g.edges[i].v
			if g.dis[v] > g.dis[u]+g.edges[i].c {
				g.dis[v] = g.dis[u] + g.edges[i].c

				heap.Push(&pq, &Item{v, g.dis[v], g.edges[i].indices, -1})
			}
		}
	}
}

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)
	for t := io.ReadInt(); t > 0; t-- {
		n := io.ReadInt()
		a := io.ReadIntSlice(n)

		ans := 1<<30 - 1

		for i := 0; i < n; i++ {
			if a[i] != i {
				ans &= i
			}
		}

		fmt.Println(ans)
	}
}


package main

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

func readLine(reader *bufio.Reader) []byte {
	result := make([]byte, 0)
	for {
		s, isPrefix, err := reader.ReadLine()
		if err != nil {
			fmt.Printf("error=%+v\n", err)
			break
		}
		result = append(result, s...)
		if !isPrefix {
			// fmt.Println(string(result))
			break
		}
	}
	return result
}

func main() {
	var cases int
	fmt.Scanf("%d\n", &cases)
	reader := bufio.NewReader(os.Stdin)
	for i := 0; i < cases; i++ {
		line := readLine(reader)
		n, _ := strconv.Atoi(string(line))
		line = readLine(reader)
		ans := strings.Split(string(line), " ")
		line = readLine(reader)
		bns := strings.Split(string(line), " ")
		an := make([]int, n)
		bn := make([]int, n)
		for i := 0; i < n; i++ {
			an[i], _ = strconv.Atoi(ans[i])
			bn[i], _ = strconv.Atoi(bns[i])
		}
		sort.Ints(an)
		sort.Ints(bn)
		for _, i := range an {
			fmt.Printf("%d ", i)
		}
		fmt.Println()
		for _, i := range bn {
			fmt.Printf("%d ", i)
		}
	}
}

func printList(an []int) {

}

package main

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

func main() {
	handleCases(os.Stdin)
}

func handleCases(f io.Reader) {
	cases, err := scanner(f)
	if err != nil {
		panic(err)
	}

	var (
		xi, yi []int
	)

	for _, tc := range cases {
		xi, yi, err = algo(tc)
		if err != nil {
			panic(err)
		}

		fmt.Println(joinInt(xi))
		fmt.Println(joinInt(yi))
	}
}

func algo(in *input) ([]int, []int, error) {
	var (
		ai, bi []int
	)

	ai, bi = simple(in)
	if check(ai, bi) {
		return ai, bi, nil
	}

	ai, bi = ssort(in)
	if check(ai, bi) {
		return ai, bi, nil
	}

	return nil, nil, errors.New("no solution")
}

func simple(in *input) ([]int, []int) {
	return in.OzherYar, in.BrasYar
}

func ssort(in *input) ([]int, []int) {
	return sortArr(in.OzherYar), sortArr(in.BrasYar)
}

type arr []int

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

func sortArr(in []int) []int {
	ai := make([]int, 0, len(in))

	for _, i := range in {
		ai = append(ai, i)
	}

	sort.Sort(arr(ai))

	return ai
}

// true - корректно
func check(ai, bi []int) bool {
	m := map[int]struct{}{}

	var s int

	for i, _ := range ai {
		s = ai[i] + bi[i]

		_, ok := m[s]
		if ok {
			return false
		}

		m[s] = struct{}{}
	}

	return true
}

type input struct {
	DaughterCount int
	OzherYar      []int
	BrasYar       []int
}

func scanner(f io.Reader) ([]*input, error) {
	scanner := bufio.NewScanner(f)

	naborCount := true
	daughterCountLine := true
	ozherYarLine := true
	brasYarLine := true

	var (
		tmpItem *input
		tmpArr  []int
		tmpI    int
		err     error
	)

	var i []*input

	for scanner.Scan() {
		if naborCount {
			naborCount = false

			tmpI, err = parseInt(scanner.Text())
			if err != nil {
				return nil, err
			}

			i = make([]*input, 0, tmpI)

			continue
		}
		if daughterCountLine {
			daughterCountLine = false

			tmpItem = new(input)

			tmpI, err = parseInt(scanner.Text())
			if err != nil {
				return nil, err
			}

			tmpItem.DaughterCount = tmpI

			continue
		}

		if ozherYarLine {
			ozherYarLine = false
			tmpArr, err = parseIntArr(scanner.Text())
			if err != nil {
				return nil, err
			}

			tmpItem.OzherYar = tmpArr

			continue
		}

		if brasYarLine {
			brasYarLine = false

			tmpArr, err = parseIntArr(scanner.Text())
			if err != nil {
				return nil, err
			}

			tmpItem.BrasYar = tmpArr

			if tmpItem.DaughterCount != len(tmpItem.OzherYar) || tmpItem.DaughterCount != len(tmpItem.BrasYar) {
				fmt.Println(tmpItem)
				return nil, errors.New("validation error")
			}

			i = append(i, tmpItem)

			daughterCountLine = true
			ozherYarLine = true
			brasYarLine = true

			continue
		}

		break
	}

	if err := scanner.Err(); err != nil {
		return nil, err
	}

	return i, nil
}

func parseIntArr(line string) ([]int, error) {
	words := strings.Split(line, " ")
	arr := make([]int, 0, len(words))

	for _, word := range words {
		i, err := parseInt(word)
		if err != nil {
			return nil, err
		}

		arr = append(arr, i)
	}

	return arr, nil
}

func parseInt(line string) (int, error) {
	i, err := strconv.ParseInt(line, 10, 64)
	if err != nil {
		return 0, err
	}

	return int(i), nil
}

func joinInt(in []int) string {
	b := strings.Builder{}
	sep := " "

	for i, r := range in {
		if i != 0 {
			b.WriteString(sep)
		}

		b.WriteString(fmt.Sprintf("%d", r))
	}

	return b.String()
}

package main

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

var reader io.Reader
var scanner *bufio.Scanner

func Init(io io.Reader, max_token_size int) {
	reader = bufio.NewReader(io)
	scanner = bufio.NewScanner(reader)
	// max token size
	scanner.Split(bufio.ScanWords)
	scanner.Buffer([]byte{}, max_token_size)
}

func stderr(v ...interface{}) {
	fmt.Fprintln(os.Stderr, v...)
}

func die(v ...interface{}) {
	fmt.Fprintln(os.Stderr, v...)
	os.Exit(1)
}

func NextInt() int {
	bytes := NextBytes()
	i, err := Atoi(bytes)
	if err != nil {
		die(err)
	}
	return i
}

func NextBytes() []byte {
	if !scanner.Scan() {
		die(scanner.Err())
	}
	bytes := scanner.Bytes()
	copied := make([]byte, len(bytes))
	copy(copied, bytes)
	return copied
}

func Atoi(b []byte) (int, error) {
	neg := false
	if b[0] == '+' {
		b = b[1:]
	} else if b[0] == '-' {
		neg = true
		b = b[1:]
	}
	n := 0
	for _, v := range b {
		if v < '0' || v > '9' {
			return 0, strconv.ErrSyntax
		}
		n = n*10 + int(v-'0')
	}
	if neg {
		return -n, nil
	}
	return n, nil
}

func ExtendByteArray(a []byte, size int) []byte {
	if size <= len(a) {
		return a
	} else {
		return append(a, make([]byte, size-len(a))...)
	}
}

func ExtendIntArray(a []int, size int) []int {
	if size <= len(a) {
		return a
	} else {
		return append(a, make([]int, size-len(a))...)
	}
}

func main() {
	inf := os.Stdin
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	// inf, err := os.Open("a.in")
	// if err != nil {
	// 	die(err)
	// }
	// out, err := os.Create("a.out")
	// if err != nil {
	// 	die(err)
	// }
	// defer out.Close()
	Init(inf, 1000010)

	T := NextInt()
	for t := 0; t < T; t++ {
		n := NextInt()
		x := make([]int, n)
		for i := 0; i < n; i++ {
			x[i] = NextInt()
		}
		y := make([]int, n)
		for i := 0; i < n; i++ {
			y[i] = NextInt()
		}
		sort.Ints(x)
		sort.Ints(y)
		for i := 0; i < n; i++ {
			fmt.Fprint(out, x[i], " ")
		}
		fmt.Fprintln(out)
		for i := 0; i < n; i++ {
			fmt.Fprint(out, y[i], " ")
		}
		fmt.Fprintln(out)
	}
}

// https://codeforces.com/contest/1352/problem/A
package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
var input io.Reader

func main() {
	var (
		T int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		solver()
	}
}

func solver() {
	var n int
	fmt.Fscan(input, &n)
	a := make([]int, n)
	b := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(input, &a[i])
	}
	for i := 0; i < n; i++ {
		fmt.Fscan(input, &b[i])
	}

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

	for i := 0; i < n; i++ {
		if i > 0 {
			fmt.Print(" ")
		}
		fmt.Print(a[i])
	}
	fmt.Println()

	for i := 0; i < n; i++ {
		if i > 0 {
			fmt.Print(" ")
		}
		fmt.Print(b[i])
	}
	fmt.Println()
}

package main

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

func main(){
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t,n int
	fmt.Scan(&t)
	for ;t>0;t--{
		fmt.Scan(&n)
		ne:= make([]int,n)
		b := make([]int,n)
		readN(ne,0,n)
		readN(b,0,n)
		sort.Ints(ne)
		sort.Ints(b)
		for _,v := range ne {
			fmt.Fprintf(out,"%d ",v)
		}
		fmt.Fprintf(out,"\n")
		for _,v := range b {
			fmt.Fprintf(out,"%d ",v)
		}
		fmt.Fprintf(out,"\n")

	}

}

func readN(all []int,i,n int){
	if n==0{
		return
	}
	if m,err := fmt.Scan(&all[i]);m!=1{
		panic(err)
	}
	readN(all,i+1,n-1)
}

package main

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

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)
		for i := range a {
			Fscan(in, &a[i])
		}
		b := make([]int, n)
		for i := range b {
			Fscan(in, &b[i])
		}
		sort.Ints(a)
		sort.Ints(b)
		for i, v := range a {
			if i > 0 {
				Fprint(out, " ")
			}
			Fprint(out, v)
		}
		Fprintln(out)
		for i, v := range b {
			if i > 0 {
				Fprint(out, " ")
			}
			Fprint(out, v)
		}
		Fprintln(out)

		return
	}

	var t int
	Fscan(in, &t)
	for _case := 1; _case <= t; _case++ {
		solve()
	}
}

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

package main

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

const (
	MX_INT int64 = math.MaxInt64
	MN_INT int64 = math.MinInt64
)

func main(){
	for testCases := ScanInt64(); testCases > 0; testCases--{
		numberOfDaughters := ScanInt()
		necklessBrightnessArray := ScanIntSlice(numberOfDaughters)
		braceletBrightnessArray := ScanIntSlice(numberOfDaughters)

		sort.Ints(necklessBrightnessArray)
		sort.Ints(braceletBrightnessArray)

		var IDs []string
		var IDs2 []string
		for _, i := range necklessBrightnessArray {
			IDs = append(IDs, strconv.Itoa(i))
		}
		for _, i := range braceletBrightnessArray {
			IDs2 = append(IDs2, strconv.Itoa(i))
		}

		fmt.Println(strings.Join(IDs, " "))
		fmt.Println(strings.Join(IDs2, " "))

	}
	close(O)
	oWg.Wait()
}

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

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var Pl func(a ...interface{}) (n int, err error)

func init() {
	Pl = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e8))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriterSize(os.Stdout, int(1e5))
	go func(writer *bufio.Writer) {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}(writer)
}

func ScanWord() string {
	in.Scan()
	return in.Text()
}

func ScanStringSlice(n int64) []string {
	length := int(n)
	s := make([]string, n)
	for i := 0; i < length; i++ {
		s[i] = ScanWord()
	}
	return s
}

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

func ScanInt() int {
	intStr := ScanWord()
	i, err := strconv.Atoi(intStr)
	if err != nil {
		panic(err)
	}
	return i
}

func ScanInt64Slice(n int64) []int64 {
	length := int(n)
	arr := make([]int64, n)
	for i := 0; i < length; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

func ScanIntSlice(n int) []int {
	length := int(n)
	arr := make([]int, n)
	for i := 0; i < length; i++ {
		arr[i] = ScanInt()
	}
	return arr
}

/*********************** Utils ***********************/

func Mx(args ...int64) int64 {
	maxVal := MN_INT
	for _, v := range args {
		if v > maxVal {
			maxVal = v
		}
	}
	return maxVal
}

func Mn(args ...int64) int64 {
	minVal := MX_INT
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
	}
	return minVal
}

func LCM(a, b int64) int64 {
	return a / GCD(a, b) * b
}

func GCD(a, b int64) int64 {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}

func S(v interface{}) string {
	return fmt.Sprintf("%v", v)
}

package main
import (
	"bufio"
	"fmt"
	"os"
	"sort"
)
func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var t int
	fmt.Fscan(r,&t)
	for i := 0; i < t; i++ {
		var n int
		fmt.Fscan(r, &n)
		a := make([]int, n)
		b := make([]int, n)
		for j := 0; j < n; j++ {
			fmt.Fscan(r, &a[j])
		}
		for j := 0; j < n; j++ {
			fmt.Fscan(r, &b[j])
		}
		sort.Ints(a)
		sort.Ints(b)
		for j := 1; j < n; j++ {
			if a[j] + b[j] == a[j-1] + b[j-1] {
				b[j], b[j-1] = b[j-1],b[j]
			}
		}
		for j, e := range a {
			if j == 0 {
				fmt.Fprint(w,e)
			} else {
				fmt.Fprint(w," ", e)
			}
		}
		fmt.Fprintln(w)
		for j, e := range b {
			if j == 0 {
				fmt.Fprint(w, e)
			} else {
				fmt.Fprint(w," ", e)
			}
		}
		fmt.Fprintln(w)
	}
}

package main

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

func main() {
	handleCases(os.Stdin)
}

func handleCases(f io.Reader) {
	cases, err := scanner(f)
	if err != nil {
		panic(err)
	}

	for _, tc := range cases {
		xi, yi, err := algo(tc)
		if err != nil {
			panic(err)
		}

		fmt.Println(joinInt(xi))
		fmt.Println(joinInt(yi))
	}
}

func algo(in *input) ([]int, []int, error) {
	var (
		ai, bi []int
	)

	ai, bi = simple(in)
	if check(ai, bi) {
		return ai, bi, nil
	}

	ai, bi = reverse(in)
	if check(ai, bi) {
		return ai, bi, nil
	}

	return nil, nil, errors.New("no solution")
}

func simple(in *input) ([]int, []int) {
	return in.OzherYar, in.BrasYar
}

func reverse(in *input) ([]int, []int) {
	ai := make([]int, 0, in.DaughterCount)

	for i := in.DaughterCount - 1; i == 0; i-- {
		ai = append(ai, in.OzherYar[i])
	}

	return ai, in.BrasYar
}

// true - корректно
func check(ai, bi []int) bool {
	m := map[int]struct{}{}

	var s int

	for i, _ := range ai {
		s = ai[i] + bi[i]

		_, ok := m[s]
		if ok {
			return false
		}

		m[s] = struct{}{}
	}

	return true
}

type input struct {
	DaughterCount int
	OzherYar      []int
	BrasYar       []int
}

func scanner(f io.Reader) ([]*input, error) {
	scanner := bufio.NewScanner(f)

	naborCount := true
	daughterCountLine := true
	ozherYarLine := true
	brasYarLine := true

	var (
		tmpItem *input
		tmpArr  []int
		tmpI    int
		err     error
	)

	var i []*input

	for scanner.Scan() {
		if naborCount {
			naborCount = false

			tmpI, err = parseInt(scanner.Text())
			if err != nil {
				return nil, err
			}

			i = make([]*input, 0, tmpI)

			continue
		}
		if daughterCountLine {
			daughterCountLine = false

			tmpItem = new(input)

			tmpI, err = parseInt(scanner.Text())
			if err != nil {
				return nil, err
			}

			tmpItem.DaughterCount = tmpI

			continue
		}

		if ozherYarLine {
			ozherYarLine = false
			tmpArr, err = parseIntArr(scanner.Text())
			if err != nil {
				return nil, err
			}

			tmpItem.OzherYar = tmpArr

			continue
		}

		if brasYarLine {
			brasYarLine = false

			tmpArr, err = parseIntArr(scanner.Text())
			if err != nil {
				return nil, err
			}

			tmpItem.BrasYar = tmpArr

			if tmpItem.DaughterCount != len(tmpItem.OzherYar) || tmpItem.DaughterCount != len(tmpItem.BrasYar) {
				fmt.Println(tmpItem)
				return nil, errors.New("validation error")
			}

			i = append(i, tmpItem)

			daughterCountLine = true
			ozherYarLine = true
			brasYarLine = true

			continue
		}

		break
	}

	if err := scanner.Err(); err != nil {
		return nil, err
	}

	return i, nil
}

func parseIntArr(line string) ([]int, error) {
	words := strings.Split(line, " ")
	arr := make([]int, 0, len(words))

	for _, word := range words {
		i, err := parseInt(word)
		if err != nil {
			return nil, err
		}

		arr = append(arr, i)
	}

	return arr, nil
}

func parseInt(line string) (int, error) {
	i, err := strconv.ParseInt(line, 10, 64)
	if err != nil {
		return 0, err
	}

	return int(i), nil
}

func joinInt(in []int) string {
	b := strings.Builder{}
	sep := " "

	for i, r := range in {
		if i != 0 {
			b.WriteString(sep)
		}

		b.WriteString(fmt.Sprintf("%d", r))
	}

	return b.String()
}

package main

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

func main() {
	handleCases(os.Stdin)
}

func handleCases(f io.Reader) {
	cases, err := scanner(f)
	if err != nil {
		panic(err)
	}

	for _, tc := range cases {
		xi, yi, err := algo(tc)
		if err != nil {
			panic(err)
		}

		fmt.Println(joinInt(xi))
		fmt.Println(joinInt(yi))
	}
}

func algo(in *input) ([]int, []int, error) {
	var (
		ai, bi []int
	)

	ai, bi = simple(in)
	if check(ai, bi) {
		return ai, bi, nil
	}

	ai, bi = sort(in)
	if check(ai, bi) {
		return ai, bi, nil
	}

	ai, bi = reverse(in)
	if check(ai, bi) {
		return ai, bi, nil
	}

	return nil, nil, errors.New("no solution")
}

func simple(in *input) ([]int, []int) {
	return in.OzherYar, in.BrasYar
}

func sort(in *input) ([]int, []int) {
	return sortArr(in.OzherYar), sortArr(in.BrasYar)
}

func reverse(in *input) ([]int, []int) {
	ai := sortArr(in.OzherYar)
	bi := sortArr(sortArr(in.BrasYar))

	return ai, bi
}

func sortArr(in []int) []int {
	ai := make([]int, 0, len(in))

	for i := len(in) - 1; i == 0; i-- {
		ai = append(ai, in[i])
	}

	return ai
}

// true - корректно
func check(ai, bi []int) bool {
	m := map[int]struct{}{}

	var s int

	for i, _ := range ai {
		s = ai[i] + bi[i]

		_, ok := m[s]
		if ok {
			return false
		}

		m[s] = struct{}{}
	}

	return true
}

type input struct {
	DaughterCount int
	OzherYar      []int
	BrasYar       []int
}

func scanner(f io.Reader) ([]*input, error) {
	scanner := bufio.NewScanner(f)

	naborCount := true
	daughterCountLine := true
	ozherYarLine := true
	brasYarLine := true

	var (
		tmpItem *input
		tmpArr  []int
		tmpI    int
		err     error
	)

	var i []*input

	for scanner.Scan() {
		if naborCount {
			naborCount = false

			tmpI, err = parseInt(scanner.Text())
			if err != nil {
				return nil, err
			}

			i = make([]*input, 0, tmpI)

			continue
		}
		if daughterCountLine {
			daughterCountLine = false

			tmpItem = new(input)

			tmpI, err = parseInt(scanner.Text())
			if err != nil {
				return nil, err
			}

			tmpItem.DaughterCount = tmpI

			continue
		}

		if ozherYarLine {
			ozherYarLine = false
			tmpArr, err = parseIntArr(scanner.Text())
			if err != nil {
				return nil, err
			}

			tmpItem.OzherYar = tmpArr

			continue
		}

		if brasYarLine {
			brasYarLine = false

			tmpArr, err = parseIntArr(scanner.Text())
			if err != nil {
				return nil, err
			}

			tmpItem.BrasYar = tmpArr

			if tmpItem.DaughterCount != len(tmpItem.OzherYar) || tmpItem.DaughterCount != len(tmpItem.BrasYar) {
				fmt.Println(tmpItem)
				return nil, errors.New("validation error")
			}

			i = append(i, tmpItem)

			daughterCountLine = true
			ozherYarLine = true
			brasYarLine = true

			continue
		}

		break
	}

	if err := scanner.Err(); err != nil {
		return nil, err
	}

	return i, nil
}

func parseIntArr(line string) ([]int, error) {
	words := strings.Split(line, " ")
	arr := make([]int, 0, len(words))

	for _, word := range words {
		i, err := parseInt(word)
		if err != nil {
			return nil, err
		}

		arr = append(arr, i)
	}

	return arr, nil
}

func parseInt(line string) (int, error) {
	i, err := strconv.ParseInt(line, 10, 64)
	if err != nil {
		return 0, err
	}

	return int(i), nil
}

func joinInt(in []int) string {
	b := strings.Builder{}
	sep := " "

	for i, r := range in {
		if i != 0 {
			b.WriteString(sep)
		}

		b.WriteString(fmt.Sprintf("%d", r))
	}

	return b.String()
}