package main

import (
        "fmt"
)

func calculateMaxHayBale(n int, d int, a []int) int {
        max := a[0]
        bale := 1
        for d > 0 && bale < n {
                increment := d / bale
                if increment > a[bale] {
                        increment = a[bale]
                }
                a[bale] -= increment
                if increment == 0 {
                        bale++
                        continue
                }
                max += increment
                d -= increment * bale
                // fmt.Printf("Increment = %v, max=%v, d=%v\n", increment, max, d)
        }

        return max
}

func main() {
        numTestCases := 0
        fmt.Scan(&numTestCases)
        for i := 0; i < numTestCases; i++ {
                n, d := 0, 0
                fmt.Scan(&n)
                fmt.Scan(&d)

                a := make([]int, n)
                for j := range a {
                        fmt.Scan(&a[j])
                }

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

package main;

import (
	"fmt"
)

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

func solve() {
	var n, d int
	fmt.Scan(&n, &d)
	var a = make([]int, n + 1)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	for i := 1; i < n; i++ {
		var x int = min(a[i], d / i)
		a[0] += x
		a[i] -= x
		d -= x * i
	}
	fmt.Println(a[0])
}

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

package main

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

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

func readNum(scanner *bufio.Scanner) (a int) {
	scanner.Scan()
	readInt(scanner.Bytes(), 0, &a)
	return
}

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

func readNNums(scanner *bufio.Scanner, n int) []int {
	res := make([]int, n)
	x := 0
	scanner.Scan()
	for i := 0; i < n; i++ {
		for x < len(scanner.Bytes()) && scanner.Bytes()[x] == ' ' {
			x++
		}
		x = readInt(scanner.Bytes(), x, &res[i])
	}
	return res
}

func fillNNums(scanner *bufio.Scanner, n int, res []int) {
	x := 0
	scanner.Scan()
	for i := 0; i < n; i++ {
		for x < len(scanner.Bytes()) && scanner.Bytes()[x] == ' ' {
			x++
		}
		x = readInt(scanner.Bytes(), x, &res[i])
	}
}

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

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

	return i
}

func readInt64(bytes []byte, from int, val *int64) int {
	i := from
	var tmp int64
	for i < len(bytes) && bytes[i] != ' ' {
		tmp = tmp*10 + int64(bytes[i]-'0')
		i++
	}
	*val = tmp
	return i
}

func readNInt64Nums(scanner *bufio.Scanner, n int) []int64 {
	res := make([]int64, n)
	x := -1
	scanner.Scan()
	for i := 0; i < n; i++ {
		x = readInt64(scanner.Bytes(), x+1, &res[i])
	}
	return res
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	tc := readNum(scanner)

	for tc > 0 {
		tc--
		n, d := readTwoNums(scanner)
		A := readNNums(scanner, n)
		fmt.Println(solve(n, d, A))
	}
}

func solve(n, d int, A []int) int {
	var res int

	for i := 1; i < n && d > 0; i++ {
		a := A[i]
		b := min(d, a*i)
		res += b / i
		d -= b
	}

	return A[0] + res
}

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

package main;

import (
	"fmt"
)

func solve() {
	var n, d int
	fmt.Scan(&n, &d)
	var arr = make([]int, n + 1)
	for i := 0; i < n; i++ {
		fmt.Scan(&arr[i])
	}
	for i := 1; i < n; i++ {
		var tmp int
		if arr[i]<d/i{
			tmp = arr[i]
		} else {
			tmp = d/i
		}
		arr[0] += tmp
		arr[i] -= tmp
		d -= tmp * i
	}
	fmt.Println(arr[0])
}

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

package main

import "fmt"

var (
        t, n, d int
        a [101]int
)

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

func main() {
        fmt.Scan(&t)
        for i := 0; i < t; i++ {
                fmt.Scan(&n, &d)
                for j := 0; j < n; j++ {
                        fmt.Scan(&a[j])
                }
                ans := a[0]
                for j := 1; j < n; j++ {
                        tmp := min(d/j, a[j])
                        ans += tmp
                        d -= tmp*j
                }
                fmt.Println(ans)
        }
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	cases := getIntFromInput(scanner)
	for i := int64(0); i < cases; i++ {
		scanner.Scan()
		arrs := scanner.Text()
		arr := strings.Split(arrs, " ")
		num, _ := strconv.ParseInt(arr[0], 10, 64)
		days, _ := strconv.ParseInt(arr[1], 10, 64)
		scanner.Scan()
		arrs = scanner.Text()
		arr = strings.Split(arrs, " ")
		a1, _ := strconv.ParseInt(arr[0], 10, 64)
		for i := int64(1); i < num; i++ {
			ai, _ := strconv.ParseInt(arr[i], 10, 64)
			if ai * i >= days {
				r := days / i
				a1 += r
				days = 0
				break
			} else {
				a1 += ai
				days -= ai * i
			}
		}
		fmt.Println(a1)
	}
}

func getIntFromInput(s *bufio.Scanner) int64 {
	s.Scan()
	numStr := s.Text()
	num, _ := strconv.ParseInt(string(numStr), 10, 64)
	return num
}

package main

import "fmt"

func main() {
	var a [105]int
	var n, d, t, i, cas int
	fmt.Scan(&t)
	for cas = 0; cas < t; cas++ {
		fmt.Scan(&n, &d);
		for i = 1; i <= n; i++ {
			fmt.Scan(&a[i]);
		}
		for i = 2; i <= n; i++ {
			a[1] += min(a[i], d/(i-1))
			d -= min(a[i], d/(i-1)) * (i - 1)

		}
		fmt.Println(a[1])
	}
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

package main

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

func scanInt(s *bufio.Scanner) int {
	s.Scan()
	x, _ := strconv.Atoi(s.Text())
	return x
}

func main() {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	s.Buffer(make([]byte, 1<<12), 1<<20)

	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	t := scanInt(s)
	for i := 0; i < t; i++ {
		n, d := scanInt(s), scanInt(s)
		a := make([]int, n)
		for j := 0; j < n; j++ {
			a[j] = scanInt(s)
		}
		r := a[0]
		if n > 1 {
			for x, e := range a[1:] {
				if d > x {
					l := d / (x + 1)
					if l > e {
						d -= e * (x + 1)
						r += e
					} else {
						d -= l * (x + 1)
						r += l
						break
					}
				}
			}
		}
		fmt.Fprintln(w, r)
	}

}

package main

import "fmt"
import "os"
import "bufio"
import "strings"
import "strconv"

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Scan()
    line := scanner.Text()
    t, _ := strconv.Atoi(line)
    for i := 0; i < t; i++ {
        scanner.Scan()
        line = scanner.Text()
        parts := strings.Split(line, " ")
        n, _ := strconv.Atoi(parts[0])
        d, _ := strconv.Atoi(parts[1])
        a := make([]int, n)
        scanner.Scan()
        line = scanner.Text()
        parts = strings.Split(line, " ")
        for j := 0; j < n; j++ {
            a[j], _ = strconv.Atoi(parts[j])
        }
        //~ fmt.Println(n, d, a)

        days := 0
        for j := 1; j < n && days < d; j++ {
            for a[j] > 0 && days < d {
                for k := j; k > 0 && days < d; k-- {
                    a[k]--
                    a[k - 1]++
                    days++
                }
            }
        }

        fmt.Println(a[0])
    }
}

package main

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

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

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

	for t := 0; t < T; t++ {
		var n, d int
		fmt.Fscanf(reader, "%d %d\n", &n, &d)

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

		b := a[1:]

		for i := 0; i < len(b); i++ {
			for b[i] > 0 && d >= (i+1) {
				a[0] += 1
				b[i]--
				d -= (i + 1)
			}
		}

		fmt.Fprintf(writer, "%d\n", a[0])
	}
}

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

package main

import (
	"fmt"
)

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

	for t > 0 {
		var n, d int
		var c []int
		var res int
		fmt.Scanf("%d%d\n", &n, &d)

		for i:= 0; i < n; i++{
			var x int
			fmt.Scanf("%d", &x)
			c = append(c, x)
		}
		fmt.Scanf("\n")
		res = c[0]

		for i:= 1; i < n; i++{
			x := c[i]
			z := x * i
			if z < d {
				res += x
				d -= z
			} else {
				res += d / i
				break
			}
		}
		fmt.Println(res)

		t--
	}
}

package main;

import (
	"fmt"
)

func solve() {
	var n, d int
	fmt.Scan(&n, &d)
	var arr = make([]int, n + 1)
	for i := 0; i < n; i++ {
		fmt.Scan(&arr[i])
	}
	for i := 1; i < n; i++ {
		var tmp int
		if arr[i]< d/i{
			tmp = arr[i]
		} else{
			tmp = d
		}
		arr[0] += tmp
		arr[i] -= tmp
		d -= tmp * i
	}
	fmt.Println(arr[0])
}

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

package main

import "fmt"

func main() {
	var a [105]int
	var n, d, t, i, cas int
	fmt.Scan(&t)
	for cas = 0; cas < 10; cas++ {
		fmt.Scan(&n, &d);
		for i = 1; i <= n; i++ {
			fmt.Scan(&a[i]);
		}
		for i = 2; i <= n; i++ {
			a[1] += min(a[i], d/(i-1))
			d -= min(a[i], d/(i-1)) * (i - 1)

		}
		fmt.Println(a[1])
	}
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

package main

import "fmt"

var (
        t, n, d int
        a [101]int
)

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

func main() {
        fmt.Scanln(&t)
        for i := 0; i < t; i++ {
                fmt.Scanf("%d%d",&n, &d)
                for j := 0; j < n; j++ {
                        fmt.Scanf("%d", &a[j])
                }
                ans := a[0]
                for j := 1; j < n; j++ {
                        tmp := min(d/j, a[j])
                        ans += tmp
                        d -= tmp*j
                }
                fmt.Println(ans)
        }
}

package main

import "fmt"
import "os"
import "bufio"
import "strings"
import "strconv"

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Scan()
    line := scanner.Text()
    t, _ := strconv.Atoi(line)
    for i := 0; i < t; i++ {
        scanner.Scan()
        line = scanner.Text()
        parts := strings.Split(line, " ")
        n, _ := strconv.Atoi(parts[0])
        d, _ := strconv.Atoi(parts[1])
        a := make([]int, n)
        scanner.Scan()
        line = scanner.Text()
        parts = strings.Split(line, " ")
        for j := 0; j < n; j++ {
            a[j], _ = strconv.Atoi(parts[j])
        }
        //~ fmt.Println(n, d, a)

        days := 0
        for j := 1; j < n && days < d; j++ {
            for k := j; k > 0 && days < d; k-- {
                a[k]--
                a[k - 1]++
                days++
            }
        }

        fmt.Println(a[0])
    }
}

package main

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

func calculateMaxHayBale(n int, d int, a []int) int {
        max := a[0]
        bale := 1
        for d > 0 && bale < n {
                increment := d / bale
                if increment > a[bale] {
                        increment = a[bale]
                }
                a[bale] -= increment
                if increment == 0 {
                        bale++
                        continue
                }
                max += increment
                d -= increment * bale
                // fmt.Printf("Increment = %v, max=%v, d=%v\n", increment, max, d)
        }

        return max
}

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

        line, _, _ := reader.ReadLine()
        fmt.Sscanf(string(line), "%d", &numTestCases)
        for i := 0; i < numTestCases; i++ {
                n, d := 0, 0
                line, _, _ := reader.ReadLine()
                fmt.Sscanf(string(line), "%d %d", &n, &d)

                a := make([]int, n)
                line, _, _ = reader.ReadLine()
                for j := range a {
                        fmt.Sscanf(string(line), "%d", &a[j])
                }

                fmt.Printf("n=%d, d=%d, a=%v\n", n, d, a)
                fmt.Printf("%d\n", calculateMaxHayBale(n, d, a))
        }
}

package main

import (
        "fmt"
)

func calculateMaxHayBale(n int, d int, a []int) int {
        max := a[0]
        bale := 1
        for d > 0 && bale < n {
                increment := d / bale
                if increment > a[bale] {
                        increment = a[bale]
                }
                a[bale] -= increment
                if increment == 0 {
                        bale++
                        continue
                }
                max += increment
                d -= increment * bale
                // fmt.Printf("Increment = %v, max=%v, d=%v\n", increment, max, d)
        }

        return max
}

func main() {
        numTestCases := 0
        fmt.Scanf("%d\r\n", &numTestCases)
        n, d := 0, 0
        for i := 0; i < numTestCases; i++ {
                fmt.Scanf("%d %d\r\n", &n, &d)

                a := make([]int, n)
                for j := range a {
                        fmt.Scanf("%d", &a[j])
                }

                fmt.Printf("n=%d, d=%d, a=%v\n", n, d, a)
                fmt.Printf("%d\n", calculateMaxHayBale(n, d, a))
        }
}

package main

import (
        "fmt"
)

func calculateMaxHayBale(n int, d int, a []int) int {
        max := a[0]
        bale := 1
        for d > 0 && bale < n {
                increment := d / bale
                if increment > a[bale] {
                        increment = a[bale]
                }
                a[bale] -= increment
                if increment == 0 {
                        bale++
                        continue
                }
                max += increment
                d -= increment * bale
                // fmt.Printf("Increment = %v, max=%v, d=%v\n", increment, max, d)
        }

        return max
}

func main() {
        numTestCases := 0
        fmt.Scanf("%d\n", &numTestCases)
        n, d := 0, 0
        for i := 0; i < numTestCases; i++ {
                fmt.Scanf("%d %d\n", &n, &d)

                a := make([]int, n)
                for j := range a {
                        fmt.Scanf("%d", &a[j])
                }

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

package main

import (
        "fmt"
)

func calculateMaxHayBale(n int, d int, a []int) int {
        max := a[0]
        bale := 1
        for d > 0 && bale < n {
                increment := d / bale
                if increment > a[bale] {
                        increment = a[bale]
                }
                a[bale] -= increment
                if increment == 0 {
                        bale++
                        continue
                }
                max += increment
                d -= increment * bale
                // fmt.Printf("Increment = %v, max=%v, d=%v\n", increment, max, d)
        }

        return max
}

func main() {
        numTestCases := 0
        fmt.Scan(&numTestCases)
        for i := 0; i < numTestCases; i++ {
                n, d := 0, 0
                fmt.Scan(&n)
                fmt.Scan(&d)

                a := make([]int, n)
                for j := range a {
                        fmt.Scan(&a[j])
                }

                fmt.Printf("n=%d, d=%d, a=%v\n", n, d, a)
                fmt.Printf("%d\n", calculateMaxHayBale(n, d, a))
        }
}

package main

import (
        "fmt"
)

func calculateMaxHayBale(n int, d int, a []int) int {
        max := a[0]
        bale := 1
        for d > 0 && bale < n {
                increment := d / bale
                if increment > a[bale] {
                        increment = a[bale]
                }
                a[bale] -= increment
                if increment == 0 {
                        bale++
                        continue
                }
                max += increment
                d -= increment * bale
                // fmt.Printf("Increment = %v, max=%v, d=%v\n", increment, max, d)
        }

        return max
}

func main() {
        numTestCases := 0
        fmt.Scanf("%d\n", &numTestCases)
        n, d := 0, 0
        for i := 0; i < numTestCases; i++ {
                fmt.Scanf("%d %d\n", &n, &d)

                a := make([]int, n)
                for j := range a {
                        fmt.Scanf("%d", &a[j])
                }

                fmt.Printf("n=%d, d=%d, a=%v\n", n, d, a)
                fmt.Printf("%d\n", calculateMaxHayBale(n, d, a))
        }
}

package main

import "fmt"

func main() {
	nums := [3]int {1, 2, 3}
	for i, val := range nums {
		fmt.Println(val, i)
	}
}

package main;

import (
	"fmt"
)

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

func solve() {
	var n, d int
	fmt.Scan(&n, &d)
	var a = make([]int, n + 1)
	for i := 0; i < n; i++ {
		fmt.Scanf("%v", &a[i])
	}
	for i := 1; i < n; i++ {
		var x int = min(a[i], d / i)
		a[0] += x
		a[i] -= x
		d -= x * i
	}
	fmt.Println(a[0])
}

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

package main;

import "fmt"

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

func solve() {
	var n, d int
	fmt.Scan(&n, &d)
	var a = make([]int, n + 1)
	for i := 0; i < n; i++ {
		fmt.Scan("%d", &a[i])
	}
	for i := 1; i < n; i++ {
		var x int = min(a[i], d / i)
		a[0] += x
		a[i] -= x
		d -= x * i
	}
	fmt.Println(a[0])
}

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

package main;

import "fmt"

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

func solve() {
	var n, d int
	fmt.Scan(&n, &d)
	var a = make([]int, n + 1)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d ", &a[i])
	}
	for i := 1; i < n; i++ {
		var x int = min(a[i], d / i)
		a[0] += x
		a[i] -= x
		d -= x * i
	}
	fmt.Println(a[0])
}

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

package main;

import "fmt"

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

func solve() {
	var n, d int
	fmt.Scan(&n, &d)
	var a = make([]int, n + 1)
	for i := 0; i < n; i++ {
		fmt.Scanf("%v", &a[i])
	}
	for i := 1; i < n; i++ {
		var x int = min(a[i], d / i)
		a[0] += x
		a[i] -= x
		d -= x * i
	}
	fmt.Println(a[0])
}

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

package main;

import "fmt"

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

func solve() {
	var n, d int
	fmt.Scan(&n, &d)
	var a = make([]int, n + 1)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
	}
	for i := 1; i < n; i++ {
		var x int = min(a[i], d / i)
		a[0] += x
		a[i] -= x
		d -= x * i
	}
	fmt.Println(a[0])
}

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


package main

import (
	"fmt"
)

func reverse(s string) string {
	runes := []rune(s)
	for from, to := 0, len(runes)-1; from < to; from, to = from+1, to-1 {
		runes[from], runes[to] = runes[to], runes[from]
	}
	return string(runes)
}

func main() {
	s := ""
	fmt.Scan(&s)
	s += reverse(s)
	fmt.Println(s)
}

package main

import (
	"fmt"
)

func main() {
	var str string;
	fmt.Scan(&str)

  l := len(str)
  m := make([]rune, l)

  for _, c := range str {
    l--
    m[l] = c
  }

	fmt.Printf("%s%s\n", str, string(m))
}

package main

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

func main() {
	bio := bufio.NewReaderSize(os.Stdin, 100010)

	line, _, err := bio.ReadLine();

	if err != nil {
		panic(err)
	}

	fmt.Print(string(line))
	for i := len(line) - 1; i >= 0; i-- {
		fmt.Print(string(line[i]))
	}
}

// hello project main.go
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scanf("%s", &s)
	runes := []rune(s)
	for from, to := 0, len(runes)-1; from < to; from, to = from+1, to-1 {
		runes[from], runes[to] = runes[to], runes[from]
	}
	fmt.Println(s + string(runes))
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	var s string
	fmt.Fscanln(reader, &s)
	l := len(s) * 2
	arr := make([]rune, l)
	for i, c := range s {
		arr[i] = c
		arr[l-i-1] = c
	}
	fmt.Fprintln(writer, string(arr))
}

package main

import(
    "fmt"
)

func main() {
    var n string
    fmt.Scanf("%s", &n)
    fmt.Print(n)
    for i := len(n) - 1; i >= 0; i-- {
        fmt.Print(n[i:i+1])
    }
    fmt.Println()
}

package main

import "fmt"

func main() {
    var str string
    fmt.Scan(&str)
    fmt.Print(str)
    runes := []rune(str)
    for i:=len(runes)-1; i>=0; i-- {
        fmt.Printf("%c", runes[i])
    }
}

package main

import (
	"fmt"
)

func main() {
	var N string
	fmt.Scan(&N)
	fmt.Println(N + reverseString(N))
}
func reverseString(a string) string {
	r := make([]byte, len(a))
	for i := len(a) - 1; i >= 0; i-- {
		r[i] = a[len(a) - i - 1]
	}
	return string(r)
}

package main

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

func main() {
	bio := bufio.NewReader(os.Stdin)
	line, _, err := bio.ReadLine();

	if err != nil {
		panic(err)
	}

	fmt.Print(string(line))
	for i := len(line) - 1; i >= 0; i-- {
		fmt.Print(string(line[i]))
	}
}

package main

import "fmt"

func main() {
    var n string
    fmt.Scan(&n)
    fmt.Print(n)
    for i:=len(n)-1; i>=0; i-- {
        fmt.Print(n[i])
    }
}

package main

import "fmt"

func main() {
    var str string
    fmt.Scan(&str)
    fmt.Print(str)
    runes := []rune(str)
    fmt.Println(runes)
    for i:=len(runes)-1; i>=0; i-- {
        fmt.Print(runes[i])
    }
}

package main

import "fmt"

func main() {
    var n string
    fmt.Scan(&n)
    fmt.Print(n)
    runes := []rune(n)
    for i:=len(runes)-1; i>=0; i-- {
        fmt.Print(runes[i])
    }
}

package main

import "fmt"

func main() {
    var n string
    fmt.Scan(&n)
    fmt.Print(n)
    runes := []rune(n)
    for i:=len(runes)-1; i>=0; i-- {
        fmt.Print(rune(runes[i]))
    }
}


package main

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

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

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

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

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

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

/**
Run solve the problem CF1676A
Date: 11/05/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1676/A
Problem: CF1676A
**/
func (in *CF1676A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		str := in.NextString()
		s := 0
		a := 0
		for i := 0; i < len(str); i++ {
			if i < 3 {
				s += int(str[i] - '0')
			}
			a += int(str[i] - '0')
		}

		if s == (a - s) {
			fmt.Println("YES")
		}else {
			fmt.Println("NO")
		}
	}
}

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

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

package main

import "fmt"

func main() {
	var T int
	var a string
	fmt.Scanln(&T)
	for T > 0 {
		fmt.Scanln(&a)
		sum1 := 0
		for i := 0; i < len(a)/2; i++ {
			sum1 += int(a[i] - '0')
		}
		sum2 := 0
		for i := len(a) / 2; i < len(a); i++ {
			sum2 += int(a[i] - '0')
		}

		if sum1 == sum2 {
			fmt.Printf("YES\n")
		} else {
			fmt.Printf("NO\n")
		}
		T--
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	var str string
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		fmt.Scanf("%s\n", &str)
		sum1 := 0
		sum2 := 0
		for j := 0; j < len(str); j++ {
			if j < 3 {
				sum1 = sum1 + int(str[j]) - '0'
			} else {
				sum2 = sum2 + int(str[j]) - '0'
			}
		}
		if sum1 == sum2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanln(&n)
	for i := 0; i < n; i++ {
		var s string
		fmt.Scanln(&s)
		if s[0]+s[1]+s[2] == s[3]+s[4]+s[5] {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

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

func sum(i int) (ans int) {
	for i != 0 {
		ans += i % 10
		i /= 10
	}
	return
}

func slove() {
	defer w.Flush()
	var nn string
	fmt.Fscan(r, &nn)
	n, _ := strconv.Atoi(nn)
	if sum(n/1000) == sum(n%1000) {
		fmt.Fprintln(w, "Yes")
	} else {
		fmt.Fprintln(w, "No")
	}
}

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

package main

import (
	"fmt"
	"strconv"
)

func main() {
	var (
		t int
		n string
	)
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		var (
			p1 int
			p2 int
		)
		fmt.Scanf("%s\n", &n)
		n1, _ := strconv.Atoi(string(n[0]))
		n2, _ := strconv.Atoi(string(n[1]))
		n3, _ := strconv.Atoi(string(n[2]))
		n4, _ := strconv.Atoi(string(n[3]))
		n5, _ := strconv.Atoi(string(n[4]))
		n6, _ := strconv.Atoi(string(n[5]))
		p1 = n1 + n2 + n3
		p2 = n4 + n5 + n6
		if p1 == p2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

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

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

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

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

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

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

	t := nextInt()
	for i := 0; i < t; i++ {
		solve()
	}
}

func digitsSum(x string) int {
	res := 0

	n, e := strconv.Atoi(x)
	if e != nil {
		panic(e)
	}

	for n != 0 {
		res += n % 10
		n /= 10
	}
	return res
}

func solve() {
	digits := next()

	head := digitsSum(digits[:3])
	tail := digitsSum(digits[3:])

	if head == tail {
		out("YES\n")
	} else {
		out("NO\n")
	}
}

package main
import (
	"fmt"
	"strconv"
)
func main() {
	var n int
	fmt.Scan(&n)
	for i:=0;i<n;i++{
		var x string
		fmt.Scan(&x)
		first_3:= 0
		last_3:= 0
		for j:=0;j<3;j++{
			z1,_:= strconv.Atoi(string(x[j]))
			first_3+=z1
		}
		for j:=len(x)-3;j<len(x);j++{
			z2,_:= strconv.Atoi(string(x[j]))
			last_3+=z2
		}
		if first_3 == last_3 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

// https://codeforces.com/problemset/problem/1676/A

// 1676A - Lucky?

// A ticket is a string consisting of six digits. A ticket is considered lucky if the sum of the first three digits is equal to the sum of the last three digits. Given a ticket, output if it is lucky or not. Note that a ticket can have leading zeroes.

// Input
// The first line of the input contains an integer t (1≤t≤10^3) — the number of testcases.
// The description of each test consists of one line containing one string consisting of six digits.

// Output
// Output t lines, each of which contains the answer to the corresponding test case. Output "YES" if the given ticket is lucky, and "NO" otherwise.
// You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).

// Example
// input
// 5
// 213132
// 973894
// 045207
// 000000
// 055776
// output
// YES
// NO
// YES
// YES
// NO

// Note

// In the first test case, the sum of the first three digits is 2+1+3=6 and the sum of the last three digits is 1+3+2=6, they are equal so the answer is "YES".
// In the second test case, the sum of the first three digits is 9+7+3=19 and the sum of the last three digits is 8+9+4=21, they are not equal so the answer is "NO".
// In the third test case, the sum of the first three digits is 0+4+5=9 and the sum of the last three digits is 2+0+7=9, they are equal so the answer is "YES".

// Tutorial

// We need to check if the sum of the first three digits is equal to the sum of the last three digits. This is doable by scanning the input as a string, then comparing the sum of the first three characters with the sum of the last three characters using the if statement and the addition operation.

package main

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

func main() {
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	var c int
	var t uint
	var s string

	for c, _ = fmt.Fscan(reader, &t); c == 1; c, _ = fmt.Fscan(reader, &t) {
		for ; t > 0; t-- {
			fmt.Fscan(reader, &s)

			if s[0]+s[1]+s[2] == s[3]+s[4]+s[5] {
				fmt.Fprintln(writer, "YES")
			} else {
				fmt.Fprintln(writer, "NO")
			}
		}
	}

	writer.Flush()
}

package main

import "fmt"

var b2s = map[bool]string{false: "NO", true: "YES"}

func main() {
	var i int
	var s string
	for fmt.Scanln(&i); i > 0; i-- {
		fmt.Scanln(&s)
		fmt.Println(b2s[s[0]+s[1]+s[2] == s[3]+s[4]+s[5]])
	}
}

package main

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

func solve(r *bufio.Reader) {
	var n string
	fmt.Fscan(r, &n)

	ll, rr := 0, 0

	for i := 0; i < 3; i++ {
		ll += int(n[i] - '0')
	}
	for i := 3; i < 6; i++ {
		rr += int(n[i] - '0')
	}

	if ll == rr {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}
func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(r, &n)
	for i := 0; i < n; i++ {
		solve(r)
	}
}

package main

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

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

func main() {
	defer out.Flush()
	var t int64
	fmt.Fscan(in, &t)
	for t != 0 {
		var s string
		fmt.Fscan(in, &s)
		arrStr := strings.Split(s, "")
		i := 0
		j := len(arrStr) - 1
		var lsum, rsum int64
		for i <= j {
			li, _ := strconv.Atoi(arrStr[i])
			ri, _ := strconv.Atoi(arrStr[j])
			lsum += int64(li)
			rsum += int64(ri)
			i++
			j--
		}
		if lsum == rsum {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
		t--
	}

}

package main

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

func main() {
	var t int
	fmt.Fscan(os.Stdin, &t)
	for t != 0 {
		var s string
		fmt.Fscan(os.Stdin, &s)
		sl, sr := 0, 0
		for i := 0; i < 3; i++ {
			n1, _ := strconv.Atoi(string(s[i]))
			n2, _ := strconv.Atoi(string(s[i+3]))
			sl += n1
			sr += n2
		}
		if sl == sr {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}

		t -= 1
	}
}

package main

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

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

	n := readInt(in)
	for i := 0; i < n; i++ {
		solution(in, out)
	}
}

func solution(in *bufio.Reader, out *bufio.Writer) {
	str := readLine(in)
	a, _ := strconv.Atoi(str[0:1])
	b, _ := strconv.Atoi(str[1:2])
	c, _ := strconv.Atoi(str[2:3])
	d, _ := strconv.Atoi(str[3:4])
	e, _ := strconv.Atoi(str[4:5])
	f, _ := strconv.Atoi(str[5:6])

	if a+b+c == d+e+f {
		out.WriteString("YES\n")
	} else {
		out.WriteString("NO\n")
	}

}

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

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

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

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

func readArrInt64(in *bufio.Reader) []int64 {
	numbs := readLineNumbs(in)
	arr := make([]int64, len(numbs))
	for i, n := range numbs {
		val, _ := strconv.ParseInt(n, 10, 64)
		arr[i] = val
	}
	return arr
}

package main

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

func main() {
	cin := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(cin, &n)
	var s string
	for i := 0; i < n; i++ {
		fmt.Fscan(cin, &s)
		var s1 = s[0] + s[1] + s[2]
		var s2 = s[3] + s[4] + s[5]
		if s1 == s2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

const (
	MaxInt32 = 1 << 31 - 1
)

func main(){
	cin := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(cin, &t)
	for t > 0 {
		var ticket string
		fmt.Fscan(cin, &ticket)
		left, right := 0, 0
		for i := 0; i < 6; i++ {
			if i < 3 {
				n, _ := strconv.Atoi(string(ticket[i]))
				left += n
			}
			if i >= 3 {
				n, _ := strconv.Atoi(string(ticket[i]))
				right += n
			}
		}
		if left == right {
			fmt.Println("YES")
		}else {
			fmt.Println("NO")
		}
		 t -= 1
	}
}

package main

import "fmt"

func main() {
  var t int
  fmt.Scan(&t)
  for ; t > 0; t-- {
    solve();
  }
}

func solve() {
  var s string
  fmt.Scan(&s)

  var b []byte = []byte(s)

  if sumOfThreeElements(b) == sumOfThreeElements(b[3:]) {
    fmt.Println("YES")
  } else {
    fmt.Println("NO")
  }
}

func sumOfThreeElements(b []byte) int {
  var res int = 0
  res += int(b[0]) - int('0')
  res += int(b[1]) - int('0')
  res += int(b[2]) - int('0')
  return res
}

package main

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

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

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

func main() {
	defer out.Flush()

	var tc int
	fmt.Fscan(in, &tc)
	for ; tc > 0; tc-- {
		var s string
		fmt.Fscan(in, &s)
		var a, b int
		for j, x := range s {
			if j < 3 {
				a += int(x - '0')
			} else {
				b += int(x - '0')
			}
		}
		if a == b {
			fmt.Println("yES")
		} else {
			fmt.Println("no")
		}
	} //fim do loop de test cases
} // fim main

package main
import "fmt"
func main() {
    var t int
    fmt.Scan(&t)
    for i:=0;i<t;i++ {
        var s string
        fmt.Scan(&s)
        if s[0]+s[1]+s[2]==s[3]+s[4]+s[5] {
            fmt.Println("YES")
        } else {
            fmt.Println("NO")
        }
    }
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	for n > 0 {
		var s string
		fmt.Scanf("%s\n", &s)
		le := s[0] - '0' + s[1] - '0' + s[2] - '0'
		ri := s[3] - '0' + s[4] - '0' + s[5] - '0'
		if le == ri {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
		n--
	}
}

package main

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

func isLuckyTicket(ticket string) bool {
	sum1 := 0
	for i := 0; i < 3; i++ {
		tmp, _ := strconv.Atoi(string(ticket[i]))
		sum1 += tmp
	}
	sum2 := 0
	for i := 3; i < 6; i++ {
		tmp, _ := strconv.Atoi(string(ticket[i]))
		sum2 += tmp
	}
	if sum1 == sum2 {
		return true
	}
	return false
}

func main() {
	var t int
	fmt.Scanf("%d", &t)
	reader := bufio.NewReader(os.Stdin)
	str, _ := reader.ReadString('\n')
	for i := 0; i < t; i++ {
		str, _ = reader.ReadString('\n')
		if isLuckyTicket(str) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import "fmt"

func solve(input string) string {
	c_a, c_b := 0, 0
	c_a = int(input[0]) + int(input[1]) + int(input[2])
	c_b = int(input[3]) + int(input[4]) + int(input[5])

	if c_a == c_b {
		return "YES"
	}
	return "NO"
}

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

	for testcases > 0 {
		testcases -= 1
		fmt.Scanf("%s\n", &input)
		fmt.Println(solve(input))
	}
}

package main

import (
	"fmt"
)

func main() {
	var T int
	for fmt.Scanln(&T); T > 0; T-- {
		var s string
		fmt.Scanln(&s)
		if s[0]+s[1]+s[2] == s[3]+s[4]+s[5] {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

func main_edu_128_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() {
		var n string
		Fscan(in, &n)
		if n[0]+n[1]+n[2] == n[3]+n[4]+n[5] {
			Fprintln(out, "Yes")
		} else {
			Fprintln(out, "No")
		}
	}
	// Coding...ove!
	for i := 0; i < cas; i++ {
		sol()
	}
}

func main() {
	main_edu_128_A()
}

package main

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

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

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

func main() {
	defer writer.Flush()

	var n int
	var a string
	scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		scanf("%s\n", &a)
		if a[0]+a[1]+a[2] == a[3]+a[4]+a[5] {
			printf("YES\n")
		} else {
			printf("NO\n")
		}
	}
}

package main

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

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

	var T int
	for fmt.Fscan(in, &T); T > 0; T-- {
		var s string
		fmt.Fscan(in, &s)
		if s[0]+s[1]+s[2] == s[3]+s[4]+s[5] {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

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

package main

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

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

func solve(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	var t int
	for fmt.Fscan(in, &t); t > 0; t-- {
		var s string
		fmt.Fscan(in, &s)
		var s1, s2 int
		for i := 0; i < 3; i++ {
			s1 += int(s[i])
			s2 += int(s[5-i])
		}
		if s1 == s2 {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	for fmt.Fscan(in, &t); t > 0; t-- {
		var s string
		fmt.Fscan(in, &s)
		if s[0]-'0'+s[1]-'0'+s[2]-'0' == s[3]-'0'+s[4]-'0'+s[5]-'0' {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	testCases, _ := strconv.Atoi(scanner.Text())
	for i := 0; i < testCases; i++ {
		scanner.Scan()
		txt := scanner.Text()
		idx := 0
		totalFirst := 0
		for idx < 3 {
			c, _ := strconv.Atoi(string(txt[idx]))
			totalFirst += c
			idx++
		}

		totalSecond := 0
		for idx < 6 {
			c, _ := strconv.Atoi(string(txt[idx]))
			totalSecond += c
			idx++
		}
		if totalFirst == totalSecond {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

func main() {
	var (
		t int
	)

	reader := bufio.NewReader(os.Stdin)
	fmt.Scanf("%d\n", &t)

	for t > 0 {
		t--

		s, _ := reader.ReadString('\n')
		if s[len(s)-1] == 10 {
			s = s[:len(s)-1]
		}
		if s[len(s)-1] == 13 {
			s = s[:len(s)-1]
		}

		n := len(s)

		a, _ := strconv.Atoi(string(s[0]))
		b, _ := strconv.Atoi(string(s[1]))
		c, _ := strconv.Atoi(string(s[2]))
		x, _ := strconv.Atoi(string(s[n-1]))
		y, _ := strconv.Atoi(string(s[n-2]))
		z, _ := strconv.Atoi(string(s[n-3]))

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

package main

import (
	"bufio"
	"flag"
	"fmt"
	"log"
	"os"
	"runtime/pprof"
	"strconv"
	"strings"
)

var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")

func main() {
	flag.Parse()
	if *cpuprofile != "" {
		f, err := os.Create(*cpuprofile)
		if err != nil {
			log.Fatal(err)
		}
		pprof.StartCPUProfile(f)
		defer pprof.StopCPUProfile()
	}

	in := bufio.NewReader(os.Stdin)
	testCases := readInt(in)

	for i := 0; i < testCases; i++ {
		digits := readStrToInts(in)
		result := 0
		for i := 0; i < len(digits)/2; i++ {
			result += digits[i] - digits[i+3]
		}

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

func stringToInts(s string) []int {
	result := []int{}
	for _, r := range s {
		val, _ := strconv.Atoi(string(r))
		result = append(result, val)
	}

	return result
}

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

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

func readStrToInts(in *bufio.Reader) []int {
	nStr, _ := in.ReadString('\n')
	nStr = strings.ReplaceAll(nStr, "\r", "")
	nStr = strings.ReplaceAll(nStr, "\n", "")
	return stringToInts(nStr)
}

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

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

func readInt64s(in *bufio.Reader) []int64 {
	numbs := readLineNumbs(in)
	arr := make([]int64, len(numbs))
	for i, n := range numbs {
		val, _ := strconv.ParseInt(n, 10, 64)
		arr[i] = val
	}
	return arr
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var N int
	var Q string
	var A,B int32

	fmt.Fscan(in, &N)
	//m := make([]int,N)
	//num := make(map[int]int)
	for i := 0;i < N;i++{
		fmt.Fscan(in, &Q)

		for num, i := range Q{
			if num < 3{
				A += i
			}else{
				B += i
			}
		}

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

}

package main

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

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

func A(_r io.Reader, _w io.Writer) {
	in, out := bufio.NewReader(_r), bufio.NewWriter(_w)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for k := 0; k < t; k++ {
		str := ""
		fmt.Fscan(in, &str)
		s1 := 0
		s2 := 0
		for i := 0; i < 6; i++ {
			if i < 3 {
				v, _ := strconv.Atoi(string(str[i]))
				s1 += v
			} else {
				v, _ := strconv.Atoi(string(str[i]))
				s2 += v
			}
		}
		if s1 == s2 {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

//goland:noinspection GoUnusedFunction
func min(a int, nums ...int) int {
	min := a

	for _, num := range nums {
		if num < min {
			min = num
		}
	}
	return min
}

//goland:noinspection GoUnusedFunction
func max(a int, nums ...int) int {
	max := a

	for _, num := range nums {
		if num > max {
			max = num
		}
	}
	return max
}

//goland:noinspection GoUnusedFunction
func maxFloat(a float64, nums ...float64) float64 {
	max := a

	for _, num := range nums {
		if num > max {
			max = num
		}
	}
	return max
}

//goland:noinspection GoUnusedFunction
func fprintlnArr(w io.Writer, arr []int) {
	for _, val := range arr {
		fmt.Fprint(w, val, " ")
	}
	fmt.Fprintln(w)
}

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

	var t int
	for fmt.Fscan(in, &t); t > 0; t-- {
		var s string
		fmt.Fscan(in, &s)
		sum1, sum2 := 0, 0

		for i := 0; i < 3; i++ {
			num, _ := strconv.Atoi(string(s[i]))
			sum1 += num
		}

		for i := 3; i < 6; i++ {
			num, _ := strconv.Atoi(string(s[i]))
			sum2 += num
		}

		if sum1 == sum2 {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

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

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

	var T int
	var x string

	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &x)
		a,b := 0, 0
		for i := 0;i <3; i++ {
			a += int(x[i]-'0')
		}
		for i := 3;i <6; i++ {
			b += int(x[i]-'0')
		}

		ans := "NO"
		if a == b {
			ans = "YES"
		}
		Fprintln(out, ans)
	}
}

package main

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

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

func solve() string {
	var s string
	fmt.Fscan(in, &s)
	var lsum, rsum int

	for _, r := range s[:3] {
		lsum += int(r - 'a')
	}
	for _, r := range s[3:] {
		rsum += int(r - 'a')
	}
	if lsum == rsum {
		return "YES"
	}

	return "NO"
}

func main() {
	defer out.Flush()
	var t int
	for fmt.Fscanln(in, &t); 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 s string
		fmt.Fscan(in, &s)

		var a1 int
		for i := 0; i < 3; i++ {
			a1 += int(s[i] - '0')
		}

		var a2 int
		for i := 3; i < 6; i++ {
			a2 += int(s[i] - '0')
		}

		if a1 == a2 {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

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

	solve := func(curCase int)bool {
		var s string
		Fscan(in, &s)
		s1 := 0
		for _, b := range s[:3] {
			s1+=int(b&15)
		}
		for _, b := range s[3:] {
			s1-=int(b&15)
		}
		return s1==0
	}

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

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

}

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

package main

import "fmt"

func main() {
	var T int
	var a string
	fmt.Scan(&T)
	for T > 0 {
		fmt.Scanf("%s", &a)
		sum1 := 0
		for i := 0; i < len(a)/2; i++ {
			sum1 += int(a[i] - '0')
		}
		sum2 := 0
		for i := len(a) / 2; i < len(a); i++ {
			sum2 += int(a[i] - '0')
		}

		if sum1 == sum2 {
			fmt.Printf("YES\n")
		} else {
			fmt.Printf("NO\n")
		}
		T--
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	var str string
	fmt.Scanf("%d", &t)
	for i := 0; i < t; i++ {
		fmt.Scanf("%s", &str)
		sum1 := 0
		sum2 := 0
		for j := 0; j < len(str); j++ {
			if j < 3 {
				sum1 = sum1 + int(str[j]) - '0'
			} else {
				sum2 = sum2 + int(str[j]) - '0'
			}
		}
		if sum1 != sum2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	var str string
	fmt.Scanf("%d", &t)
	for i := 0; i < t; i++ {
		fmt.Scanf("%s", &str)
		sum1 := 0
		sum2 := 0
		for j := 0; j < len(str); j++ {
			if j < 3 {
				sum1 = sum1 + int(str[j]) - '0'
			} else {
				sum2 = sum2 + int(str[j]) - '0'
			}
		}
		if sum1 == sum2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}


// Author: sighduck
// URL: https://codeforces.com/contest/1181/problem/B

package main

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

func addStrings(a string, b string) *big.Int {
	i := new(big.Int)
	i.SetString(a, 10)
	j := new(big.Int)
	j.SetString(b, 10)
	return i.Add(i, j)
}

func minBigInt(a *big.Int, b *big.Int) *big.Int {
	if a.Cmp(b) == 1 {
		return b
	}
	return a
}

func _Solve(l int, n string, m int) string {
	left1, right1 := n[:m], n[m:]
	left2, right2 := n[:l-m], n[l-m:]
	if string(right1[0]) == "0" && string(right2[0]) == "0" {
		return _Solve(l, n, m+1)
	}
	if string(right1[0]) == "0" {
		return addStrings(left2, right2).String()
	}
	if string(right2[0]) == "0" {
		return addStrings(left1, right1).String()
	}
	return minBigInt(addStrings(left1, right1), addStrings(left2, right2)).String()
}

func Solve(l int, n string) string {
	return _Solve(l, n, l/2)
}

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

	var l int
	var n string
	fmt.Fscanf(reader, "%d\n%s\n", &l, &n)

	fmt.Fprintf(writer, "%s\n", Solve(l, n))
}

package main

import (
	"fmt"
)

func main() {
	var a int
	var c string

	fmt.Scanln(&a)
	fmt.Scanln(&c)

	min := make([]byte, len(c))
	for i := 0; i < len(c); i++ {
		min[i] = c[i] - '0'
	}

	for i := a / 2; i > 0; i-- {
		if c[i] == '0' {
			continue
		}

		l := i + 1

		if len(c[i:])+1 > l {
			l = len(c[i:]) + 1
		}

		e := make([]byte, l)

		for j := 0; j < l-1; j++ {
			if j < i {
				e[l-j-1] += c[0:i][i-j-1] - '0'
			}

			if j < len(c[i:]) {
				e[l-j-1] += c[i:][len(c[i:])-j-1] - '0'
			}

			if e[l-j-1] > 9 {
				e[l-j-2]++
				e[l-j-1] -= 10
			}
		}

		if e[0] == 0 {
			e = e[1:]
		}

		if len(e) < len(min) {
			min = e
		} else if len(e) == len(min) {
			for j := 0; j < len(e); j++ {
				if e[j] > min[j] {
					break
				}

				if e[j] < min[j] {
					min = e
					break
				}

				if j == len(e)-1 {
					min = e
				}
			}
		}
		break
	}

	for i := a/2 + 1; i < a; i++ {
		if c[i] == '0' {
			continue
		}

		l := i + 1

		if len(c[i:])+1 > l {
			l = len(c[i:]) + 1
		}

		e := make([]byte, l)

		for j := 0; j < l-1; j++ {
			if j < i {
				e[l-j-1] += c[0:i][i-j-1] - '0'
			}

			if j < len(c[i:]) {
				e[l-j-1] += c[i:][len(c[i:])-j-1] - '0'
			}

			if e[l-j-1] > 9 {
				e[l-j-2]++
				e[l-j-1] -= 10
			}
		}

		if e[0] == 0 {
			e = e[1:]
		}

		if len(e) < len(min) {
			min = e
		} else if len(e) == len(min) {
			for j := 0; j < len(e); j++ {
				if e[j] > min[j] {
					break
				}

				if e[j] < min[j] {
					min = e
					break
				}

				if j == len(e)-1 {
					min = e
				}
			}
		}
		break
	}

	for i := 0; i < len(min); i++ {
		fmt.Print(min[i])
	}
}

package main

import (
	"fmt"
	"math/big"
)

func main() {
	var a int
	var b, d big.Int
	var c string

	fmt.Scanln(&a)
	fmt.Scanln(&c)

	var min big.Int
	min.SetString(c, 10)

	for i := a / 2; i > 0; i-- {
		if c[i] == '0' {
			continue
		}

		b.SetString(c[0:i], 10)
		d.SetString(c[i:], 10)

		e := b.Add(&b, &d)

		if min.Cmp(e) == 1 {
			min = *e
		}
		break
	}

	for i := a/2 + 1; i < a; i++ {
		if c[i] == '0' {
			continue
		}

		b.SetString(c[0:i], 10)
		d.SetString(c[i:], 10)

		e := b.Add(&b, &d)

		if min.Cmp(e) == 1 {
			min = *e
		}
		break
	}

	fmt.Print(min.String())
}


package main

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

func solve() {
	f := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	N, n := 0, 0
	fmt.Fscan(f, &N)
	for i := 0; i < N; i++ {
		fmt.Fscan(f, &n)
		tot, o, m, p := n/2, []int{}, math.MaxInt32, 0
		for j := 0; j < n; j++ {
			fmt.Fscan(f, &p)
			o = append(o, p)
			if p < m {
				m = p
			}
		}
		for j := 0; j < n; j++ {
			if o[j] != m && tot > 0 {
				fmt.Fprintln(w, o[j], m)
				tot--
			}
			if tot == 0 {
				break
			}
		}
	}
	w.Flush()
}

func main() {
	solve()
}

// 00
package main

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

func write_int(f *bufio.Writer, a int) {
	f.Write([]byte(strconv.Itoa(a)))
}
func write_string(f *bufio.Writer, a string) {
	f.Write([]byte(a))
}

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		fmt.Fscan(reader, &n)
		a := make([]int, n)
		mi := 1000000000
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &a[i])
			if a[i] < mi {
				mi = a[i]
			}
		}
		total := n / 2
		for i := 0; i < total; i++ {
			if mi != a[i] {
				//fmt.Println(a[i], mi)
				write_int(f, a[i])
				write_string(f, " ")
				write_int(f, mi)
				write_string(f, "\n")
			} else {
				total++
			}
		}

	}
}

// 00
package main

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

func write_int(f *bufio.Writer, a int) {
	f.Write([]byte(strconv.Itoa(a)))
}
func write_string(f *bufio.Writer, a string) {
	f.Write([]byte(a))
}

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		fmt.Fscan(reader, &n)
		a := make([]int, n)
		mi := 1000000000
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &a[i])
			if a[i] < mi {
				mi = a[i]
			}
		}
		total := n / 2
		for i := 0; i < total; i++ {
			if mi != a[i] {
				fmt.Println(a[i], mi)
				// write_int(f, a[i])
				// write_string(f, " ")
				// write_int(f, mi)
				// write_string(f, "\n")
			} else {
				total++
			}
		}

	}
}

// 00
package main

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

func write_int(f *bufio.Writer, a int) {
	f.Write([]byte(strconv.Itoa(a)))
}
func write_string(f *bufio.Writer, a string) {
	f.Write([]byte(a))
}

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		fmt.Fscan(reader, &n)
		a := make([]int, n)
		mi := 1000000000
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &a[i])
			if a[i] < mi {
				mi = a[i]
			}
		}
		total := n / 2
		for i := 0; i < total; i++ {
			if mi != a[i] {
				write_int(f, a[i])
				write_string(f, " ")
				write_int(f, mi)
				write_string(f, "\n")
			} else {
				total++
			}
		}

	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		t-=1
		var n int
		fmt.Fscan(in, &n)
		var a []int
		for i := 1; i <= n; i++ {
			var x int
			fmt.Fscan(in, &x)
			a = append(a, x)
		}
		sort.Ints(a)
		for i := 1; i <= n/2; i++ {
			fmt.Println(a[i], a[0])
		}
	}
}

package main

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

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

func gcd(x, y int) int {
	if y > x {
		return gcd(y, x)
	}
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func solve(n int, a []int) string {
	sort.Ints(a)
	var s []string
	for i := 0; i < n/2; i++ {
		s = append(s, fmt.Sprint(a[n-1-i], a[0]))
	}
	return strings.Join(s, "\n")
}

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

package main

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

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

var a [2e5 + 10]int

func main() {
	var ntc int
	fmt.Fscan(in, &ntc)
	for t := 0; t < ntc; t++ {
		var n int
		var minAi int = math.MaxInt32
		fmt.Fscan(in, &n)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &a[i])
			if minAi > a[i] {
				minAi = a[i]
			}
		}
		var left = n / 2
		for i := 0; left > 0; i++ {
			if a[i] == minAi {
				continue
			}
			left--
			fmt.Fprintf(out, "%d %d\n", a[i], minAi)
		}
	}
	out.Flush()
}

package main

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

func main() {
	defer _w.Flush()
	t := ReadInt()
	for i := 0; i < t; i++ {
		solve()
	}
}
func solve() {
	n := ReadInt()
	a := ReadInts(n)
	sort.Ints(a)

	j := 1
	for i := 0; i < n/2; i++ {
		println(a[j], a[0])
		j++
	}
}

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

func ReadString() (s string) { fmt.Fscan(_r, &s); return }
func ReadInt() (i int)       { fmt.Fscan(_r, &i); return }
func ReadInts(n int) (a []int) {
	for ; n > 0; n-- {
		a = append(a, ReadInt())
	}
	return
}
func print(a ...interface{})   { fmt.Fprint(_w, a...) }
func println(a ...interface{}) { fmt.Fprintln(_w, a...) }
func prints(s []int)           { v := fmt.Sprint(s); println(v[1 : len(v)-1]) }

package main

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

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

func main() {
	defer out.Flush()

	var tc int
	for fmt.Fscan(in, &tc); tc > 0; tc-- {
		var n int
		fmt.Fscan(in, &n)
		a := make([]int, n)
		for i := range a {
			fmt.Fscan(in, &a[i])
		}
		sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })
		for i := 0; i < n/2; i++ {
			fmt.Fprintln(out, a[i+1], a[0])
		}
	}
}

package main

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

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

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

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

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

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

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

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

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

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

		}
		return initial
	}
}

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

		}
		return m
	}
}

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

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

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

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

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

	return
}

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

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

	return num
}

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

func MODULE(x, y int) int {
	if x > y {
		return x - y
	} else {
		return y - x
	}
}

func BITAND(x, y int64) int64 {
	var ans int64
	begin := x
	sec := y
	var count int64 = 1
	for 1 == 1 {
		if (begin%2)*(sec%2) == 1 {
			ans = ans + count
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}

		} else {
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}
		}
	}
	return ans
}

func Sum(n, m int) int {
	var ans int

	if n == 1 {
		return 0
	} else {
		for i := 2; i < n; i++ {
			ans = (ans + Sum(i, m)) % m
		}
		for j := 2; j < n+1; j++ {
			ans = (ans + Sum(n/j, m)) % m
		}
		return ans
	}
}

func ChangeStringToDate(x string) (t time.Time, err error) {
	t, err = time.Parse("2006-01-02", x)
	return
}

func DiffrenceBetweenTwoDates(first, second time.Time) int64 {
	date := first
	date2 := second
	k := date.Unix() - date2.Unix()
	return k
}

func Union(a, b []int) []int {
	m := make(map[int]bool)

	for _, item := range a {
		m[item] = true
	}

	for _, item := range b {
		if _, ok := m[item]; !ok {
			a = append(a, item)
		}
	}
	return a
}

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

func DIVI(x []int) string {
	if len(x) == 1 {
		if x[0]%2 == 0 {
			return "NO"
		} else {
			return "YES"

		}
	} else {
		q := len(x)
		if DIVI(x[:q-1]) == "YES" {
			b := 0
			for j := 2; j < q+2; j++ {
				if x[q-1]%j != 0 {
					b = 1
					break
				}
			}
			if b == 1 {
				return "YES"
			} else {
				return "NO"

			}
		} else {
			return "NO"
		}
	}
}

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)
	for o := 0; o < t; o++ {

		var n int
		fmt.Fscan(input, &n)
		ARRAY := make([]int, n)

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

		}

		sort.Ints(ARRAY)
		k := n / 2
		for i := 1; i <= k; i++ {
			fmt.Println(ARRAY[i])
			fmt.Println(ARRAY[0])
		}

	}
}

package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

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

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

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

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

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

func proc() {
	n := scanInt()
	mas := make([]int, n)
	for i := 0; i < n; i++ {
		mas[i] = scanInt()
	}
	sort.Ints(mas)
	for i := 0; i < n/2; i++ {
		fmt.Printf("%d %d\n", mas[i+1], mas[0])
	}
}

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

package main

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

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)

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

		sort.Ints(nums)
		for i := 1; i <= n/2; i++ {
			fmt.Fprintf(out, "%d %d\n", nums[i], nums[0])
		}
	}
}

package main

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

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)

		nums := make([]int, n)
		var max int
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &nums[i])
			if nums[i] > max {
				max = nums[i]
			}
		}

		sort.Ints(nums)

		c := n / 2
	Loop:
		for j := len(nums) - 1; j >= 0; j-- {
			seen := make([]bool, max+1)
			for k := 0; k < j; k++ {
				if seen[k] {
					continue
				}

				idx := sort.SearchInts(nums, nums[j]%nums[k])
				if nums[idx] == nums[j]%nums[k] {
					continue
				}

				for p := nums[k]; p < nums[j]; p = p * nums[k] {
					seen[p] = true
					idx = sort.SearchInts(nums, p)
					if idx >= len(nums) || p == nums[idx] {
						fmt.Fprintf(out, "%d %d\n", nums[j], p)
						c--
						if c <= 0 {
							break Loop
						}
					}

					if p == 1 {
						break
					}
				}
			}
		}
	}
}

package main

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

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)

		nums := make([]int, n)
		var max int
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &nums[i])
			if nums[i] > max {
				max = nums[i]
			}
		}

		sort.Ints(nums)

		c := n / 2
	Loop:
		for j := len(nums) - 1; j >= 0; j-- {
			seen := make([]bool, max+1)
			for k := 0; k < j; k++ {
				if seen[k] {
					continue
				}

				idx := sort.SearchInts(nums, nums[j]%nums[k])
				if nums[idx] == nums[j]%nums[k] {
					continue
				}

				for p := nums[k]; p < nums[j]; p = p * nums[k] {
					seen[p] = true
					idx = sort.SearchInts(nums, p)
					if idx >= len(nums) || p == nums[idx] {
						fmt.Fprintf(out, "%d %d\n", nums[j], p)
						c--
						if c <= 0 {
							break Loop
						}
					}
				}
			}
		}
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		t-=1
		var n int
		fmt.Fscan(in, &n)
		var a []int
		for i := 1; i <= n; i++ {
			var x int
			fmt.Fscan(in, &x)
			a = append(a, x)
		}
		sort.Ints(a)
		for i := n - 2; i >= (n-1)/2; i-- {
			fmt.Println(a[n-1], a[i])
		}
	}
}

package main

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

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

func gcd(x, y int) int {
	if y > x {
		return gcd(y, x)
	}
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func solve(n int, a []int) string {
	sort.Ints(a)
	var s []string
	for i := 0; i < n/2; i++ {
		s = append(s, fmt.Sprint(a[0], a[n-1-i]))
	}
	return strings.Join(s, "\n")
}

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


package main

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

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

	n := 0
	Scan(&n)
	p(o, 3*n+4)
	p(o, 0, 0)
	p(o, 1, 0)
	for i := 0; i < n; i++ {
		for j := 0; j < 3; j++ {
			p(o, i+j, i+1)
		}
	}
	p(o, n, n+1)
	p(o, n+1, n+1)
}

package main

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

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

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

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

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

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

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

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

	return i
}

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

	n := readNum(reader)

	res := solve(n)

	// fmt.Println(len(res))

	var buf bytes.Buffer
	buf.WriteString(fmt.Sprintf("%d\n", len(res)))

	for i := 0; i < len(res); i++ {
		buf.WriteString(fmt.Sprintf("%d %d\n", res[i][0], res[i][1]))
	}
	fmt.Print(buf.String())
}

func solve(n int) [][]int {
	res := make([][]int, 0, 3*(n-1)+7)

	res = append(res, []int{0, 0})
	res = append(res, []int{1, 0})
	res = append(res, []int{0, 1})
	res = append(res, []int{1, 1})
	res = append(res, []int{1, 2})
	res = append(res, []int{2, 1})
	res = append(res, []int{2, 2})
	x, y := 3, 3
	for i := 2; i <= n; i++ {
		res = append(res, []int{x - 1, y})
		res = append(res, []int{x, y})
		res = append(res, []int{x, y - 1})
		x++
		y++
	}

	return res
}

package main

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

const (
	mod = int64(1e9 + 7)
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 1
	//fmt.Fscanf(in, "%d\n", &t)
	for tt := 0; tt < t; tt++ {
		n := 0
		fmt.Fscanf(in, "%d\n", &n)
		ans := [][]int{{0, 0}, {0, 1}, {1, 0}, {1, 1}, {2, 1}, {1, 2}, {2, 2}}
		for i := 2; i <= n; i++ {
			ans = append(ans, []int{i + 1, i})
			ans = append(ans, []int{i, i + 1})
			ans = append(ans, []int{i + 1, i + 1})
		}
		fmt.Fprintf(out, "%d\n", len(ans))
		for i := 0; i < len(ans); i++ {
			fmt.Fprintf(out, "%d %d\n", ans[i][0], ans[i][1])
		}
	}
	return
}

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

/*
URL:
https://codeforces.com/problemset/problem/1368/C
*/

package main

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

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

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

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

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

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

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

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

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

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

var (
	n int

	A [][2]int
)

func main() {
	n = ReadInt()

	A = [][2]int{
		[2]int{0, 0}, [2]int{0, 1}, [2]int{1, 0}, [2]int{1, 1},
		[2]int{1, 2}, [2]int{2, 1}, [2]int{2, 2},
	}
	i, j := 2, 2

	for t := 1; t < n; t++ {
		A = append(A, [2]int{i, j + 1}, [2]int{i + 1, j}, [2]int{i + 1, j + 1})
		i++
		j++
	}

	PrintfBufStdout("%d\n", len(A))
	for _, a := range A {
		PrintfBufStdout("%d %d\n", a[0], a[1])
	}
	stdout.Flush()
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return res
}

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

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

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

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

	return string(res)
}

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

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

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

	return string(res)
}

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

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

package main

import "fmt"

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

	fmt.Println(3*(n+1) + 1)
	for i := 0; i < n+1; i++ {
		fmt.Println(i+1, i)
		fmt.Println(i, i)
		fmt.Println(i, i+1)
	}
	fmt.Println(n+1, n+1)
}

package main

import (
	"fmt"
)

func main(){
	var n int
	fmt.Scan(&n)
	fmt.Println(3*n + 4)
	fmt.Println(0, 0)
	fmt.Println(1, 0)
	for i := 1; i <= n; i++ {
		fmt.Println(i-1, i)
		fmt.Println(i, i)
		fmt.Println(i+1, i)
	}
	fmt.Println(n, n+1)
	fmt.Println(n+1, n+1)
}

package main

import (
	"fmt"
)

func main(){
	var n int
	fmt.Scan(&n)
	fmt.Println(3*n + 2)
	fmt.Println(0, 0)
	for i := 1; i <= n; i++ {
		fmt.Println(n-1, n+1)
		fmt.Println(n, n)
		fmt.Println(n+1, n-1)
	}
	fmt.Println(n+1, n+1)
}

package main

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

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

	n := 0
	Scan(&n)
	p(o, 3*n+4)
	p(o, 0, 0)
	p(o, 1, 0)
	for i := 1; i <= n; i++ {
		for j := 0; j < 3; j++ {
			p(o, i+j, i)
		}
	}
	p(o, n+1, n+1)
	p(o, n+2, n+1)
}


package main

import (
	"fmt"
	"math"
)

func main() {
	var a float64
	var b float64
	var c float64
	fmt.Scan(&a)
	fmt.Scan(&b)
	fmt.Scan(&c)
	output := math.Sqrt((math.Pow(b, 2)) - (4 * a * c))
	output1 := (-b + output) / (2 * a)
	output2 := (-b - output) / (2 * a)
	if output1 > output2 {
		fmt.Println(output1, output2)
	} else {
		fmt.Println(output2, output1)
	}

}