package main

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

func run(or io.Reader, ow io.Writer) {
	in := bufio.NewReader(or)
	out := bufio.NewWriter(ow)
	defer out.Flush()
	check := func(x int) bool {
		for i := 2; i*i <= x; i++ {
			if x%i == 0 {
				return false
			}
		}
		return true
	}
	a := make([]int, 10)
	for i := 0; i < 10; i++ {

		for j := int(math.Pow10(i)); ; j++ {
			if check(j) {
				a[i] = j
				//fmt.Fprintln(out, a[i])
				break
			}
		}
	}

	solve := func() {
		var x, y, z int
		fmt.Fscan(in, &x, &y, &z)
		o := int(math.Pow10(z - 1))
		if x == y {
			fmt.Fprint(out, a[x-z]*o, " ", (a[y-z]+1)*o)
		} else {
			fmt.Fprint(out, a[x-z]*o, " ", a[y-z]*o)
		}

		fmt.Fprintln(out)
	}

	T := 1
	fmt.Fscan(in, &T)
	for o := 0; o < T; o++ {
		solve()
	}

}

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

package main

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

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

	solve := func(Case int) {
		var a, b, c int
		Fscan(in, &a, &b, &c)
		swap := false
		if a > b {
			swap=true
			a, b = b, a
		}
		if b == 1 {
			Fprintln(out, 1, 1)
			return
		}
		x := "1" + strings.Repeat("0", a-1)
		y := strings.Repeat("1", b-c+1) + strings.Repeat("0", c-1)
		if swap {
			Fprintln(out, y,x)
			return
		}
		Fprintln(out, x, y)
	}

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

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

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

package main

import (
	"bufio"
	. "fmt"
	"io"
	"math"

	//"math"
	"os"
)

func run(r io.Reader, w io.Writer) {
	in := bufio.NewReader(r)
	out := bufio.NewWriter(w)
	defer out.Flush()

	var t int
	for Fscan(in, &t); t > 0; t-- {
		var a, b, c int
		Fscan(in, &a, &b, &c)

		numA := int(math.Pow10(a - c))
		numB := int(math.Pow10(b - c)) + 1
		numC := int(math.Pow10(c - 1))

		Fprintln(out, numA * numC, numB * numC)
	}
}

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

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

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

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

package main

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

type Scanner struct {
	bScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bScanner := bufio.NewScanner(os.Stdin)
	bScanner.Split(bufio.ScanWords)
	bScanner.Buffer([]byte{}, math.MaxInt32)
	return &Scanner{
		bScanner,
	}
}
func (s *Scanner) Next() string {
	s.bScanner.Scan()
	return s.bScanner.Text()
}
func (s *Scanner) NextInt() int {
	s.bScanner.Scan()
	res, err := strconv.Atoi(s.bScanner.Text())
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) NextInt64() int64 {
	s.bScanner.Scan()
	res, err := strconv.ParseInt(s.bScanner.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) NextFloat() float64 {
	s.bScanner.Scan()
	res, err := strconv.ParseFloat(s.bScanner.Text(), 64)
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) NextInts(N int) []int {
	res := make([]int, N)
	for i := 0; i < N; i++ {
		res[i] = s.NextInt()
	}
	return res
}
func (s *Scanner) NextInt64s(N int) []int64 {
	res := make([]int64, N)
	for i := 0; i < N; i++ {
		res[i] = s.NextInt64()
	}
	return res
}
func Min(nums ...int) int {
	ans := math.MaxInt32
	for _, num := range nums {
		if num < ans {
			ans = num
		}
	}
	return ans
}
func Max(nums ...int) int {
	ans := math.MinInt32
	for _, num := range nums {
		if num > ans {
			ans = num
		}
	}
	return ans
}

func digitLen(x int64) int {
	return int(math.Floor(math.Log10(float64(x)))) + 1
}

func main() {
	sc := NewScanner()
	wr := bufio.NewWriter(os.Stdout)
	defer wr.Flush()

	TC := sc.NextInt()
	for tc := 0; tc < TC; tc++ {
		a := sc.NextInt()
		b := sc.NextInt()
		c := sc.NextInt()

		x := int64(1)
		y := int64(1)
		for digitLen(x) < c {
			x *= 2
			y *= 2
		}
		for digitLen(x) < a {
			x *= 3
		}
		for digitLen(y) < b {
			y *= 5
		}
		fmt.Fprintln(wr, x, y)
	}
}

package main

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

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

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

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

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

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

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

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

		}
		return initial
	}
}

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

	}
	return m

}

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

}

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

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

	for i := 0; i < t; i++ {
		var a, b, c int
		fmt.Fscan(input, &a)
		fmt.Fscan(input, &b)
		fmt.Fscan(input, &c)
		var q, p, A, B int64
		q = 1
		p = 1
		A = 1
		B = 1

		for i := 0; i < c-1; i++ {
			p = 10 * p
		}
		for i := 0; i < a-1; i++ {
			A = 10 * A
		}
		for i := 0; i < b-1; i++ {
			B = 10 * B
		}

		for i := 1; i > 0; i++ {
			if q > p && q < 10*p {
				break
			} else {
				q = q * 7
			}
		}

		var t int64
		t = q

		for i := 1; i > 0; i++ {
			if q > A && q < A*10 {
				break
			} else {
				q = q * 2
			}
		}

		for i := 1; i > 0; i++ {
			if t > B && t < B*10 {
				break
			} else {
				t = t * 3
			}
		}

		fmt.Println(q)
		fmt.Println(t)

	}

}

package main

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

func gcd(x, y int) int {
	return gcd(x, x%y)
}

func foo(base, power, lower_bound int) int {
	for ; base < lower_bound; base = base * power {

	}
	return base
}

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

	var lb [10]int
	prime := [10]int{0, 5, 25, 125, 3125, 15625, 390625, 1953125, 48828125, 244140625}
	for i := 0; i <= 9; i++ {
		lb[i] = int(math.Pow10(i - 1))
		// ub[i] = int(math.Pow10(i) - 1)
	}

	var t int
	fmt.Fscanf(in, "%d\n", &t)
	for case_idx := 0; case_idx < t; case_idx++ {
		var x, y, z, a, b int
		fmt.Fscanf(in, "%d %d %d\n", &x, &y, &z)
		a = foo(prime[z], 2, lb[x])
		b = foo(prime[z], 3, lb[y])
		fmt.Fprintf(out, "%d %d\n", a, b)
	}
	out.Flush()

}

package main

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

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

func main() {
	defer out.Flush()

	var t int
	Fscan(in, &t)

	for cases := 0; cases < t; cases++ {
		var a, b, c, answerA, answerB, getC int
		Fscan(in, &a, &b, &c)

		answerA = 1
		answerB = 1
		for i := 0; i < a-1; i++ {
			answerA *= 10
		}
		for i := 0; i < b-1; i++ {
			answerB *= 10
		}

		if !(a == b && b == c) {
			getC = 1
			for i := 0; i < c-1; i++ {
				getC *= 10
			}

			if answerA > answerB {
				answerA += getC
			} else {
				answerB += getC
			}
		}

		Fprintln(out, answerA, answerB)
	}
}

package main

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

func run(or io.Reader, ow io.Writer) {
	in := bufio.NewReader(or)
	out := bufio.NewWriter(ow)
	defer out.Flush()
	check := func(x int) bool {
		for i := 2; i*i <= x; i++ {
			if x%i == 0 {
				return false
			}
		}
		return true
	}
	a := make([]int, 10)
	for i := 0; i < 10; i++ {
		for j := int(math.Pow10(i)); ; j++ {
			if check(j) {
				a[i] = j
				//fmt.Fprintln(out, a[i])
				break
			}
		}
	}

	solve := func() {
		var x, y, z int
		fmt.Fscan(in, &x, &y, &z)
		o := int(math.Pow10(z - 1))
		fmt.Fprint(out, a[x-z]*o, " ", a[y-z]*o, )
		fmt.Fprintln(out)
	}

	T := 1
	fmt.Fscan(in, &T)
	for o := 0; o < T; o++ {
		solve()
	}

}

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

package main

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

func run(or io.Reader, ow io.Writer) {
	in := bufio.NewReader(or)
	out := bufio.NewWriter(ow)
	defer out.Flush()
	check := func(x int) bool {
		for i := 2; i*i <= x; i++ {
			if x%i == 0 {
				return false
			}
		}
		return true
	}
	a := make([]int, 10)
	for i := 0; i < 10; i++ {
		for j := int(math.Pow10(i)); ; j++ {
			if check(j) {
				a[i] = j
				//fmt.Fprintln(out, a[i])
				break
			}
		}
	}

	solve := func() {
		var x, y, z int
		fmt.Fscan(in, &x, &y, &z)
		o := int(math.Pow10(z - 1))
		fmt.Fprint(out, a[x-z]*o, " ", a[y-z]*o, " ", o)
		fmt.Fprintln(out)
	}

	T := 1
	fmt.Fscan(in, &T)
	for o := 0; o < T; o++ {
		solve()
	}

}

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

package main

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

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

	solve := func(Case int) {
		var a, b, c int
		Fscan(in, &a, &b, &c)
		if a > b {
			a, b = b, a
		}
		if b == 1 {
			Fprintln(out, 1, 1)
			return
		}
		x := "1" + strings.Repeat("0", a-1)
		y := strings.Repeat("1", b-c+1) + strings.Repeat("0", c-1)
		Fprintln(out, x, y)
	}

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

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

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


package main

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

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

func main() {
    //io
    scanner := bufio.NewReader(os.Stdin)
    writer := bufio.NewWriter(os.Stdout)
    //---
    var n int
    fmt.Fscan(scanner, &n)
    writer.WriteString(strconv.Itoa(n / 2 * 2 + n - (n / 2)) + "\n")
    for i := 2; i <= n; i += 2 {
        writer.WriteString(strconv.Itoa(i) + " ")
    }

    for i := 1; i <= n; i += 2 {
        writer.WriteString(strconv.Itoa(i) + " ")
    }

    for i := 2; i <= n; i += 2 {
        writer.WriteString(strconv.Itoa(i) + " ")
    }
    writer.Flush()
}

// Try Codeforces
// author: Leonardone @ NEETSDKASU
package main

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

func main() {
	var n int
	fmt.Scan(&n)
	ans := make([]int, 0, n*2)
	for i := 2; i <= n; i += 2 {
		ans = append(ans, i)
	}
	for i := 1; i <= n; i += 2 {
		ans = append(ans, i)
	}
	for i := 2; i <= n; i += 2 {
		ans = append(ans, i)
	}
	writer := bufio.NewWriter(os.Stdout)
	writer.WriteString(strconv.Itoa(len(ans)))
	writer.WriteString("\n")
	for i, x := range ans {
		if i > 0 {
			writer.WriteString(" ")
		}
		writer.WriteString(strconv.Itoa(x))
	}
	writer.WriteString("\n")
	writer.Flush()
}


package main

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

type SegTree struct {
	val []int
	n   int
}

func NewSegTree(n int) *SegTree {
	size := calcTreeSize(n)
	return &SegTree{
		val: make([]int, size),
		n:   n,
	}
}

func (s *SegTree) Add(l int, r int, val int) {
	s.add(1, 0, s.n-1, l, r, val)
}

func (s *SegTree) Sum(i int) int {
	return s.sum(1, 0, s.n-1, i)
}

func (s *SegTree) add(i int, l int, r int, ql int, qr int, qv int) {
	if l >= ql && r <= qr {
		s.val[i] += qv
		return
	}
	m := (l + r) / 2
	if qr <= m {
		s.add(i*2, l, m, ql, qr, qv)
	} else if ql > m {
		s.add(i*2+1, m+1, r, ql, qr, qv)
	} else {
		s.add(i*2, l, m, ql, m, qv)
		s.add(i*2+1, m+1, r, m+1, qr, qv)
	}
}

func (s *SegTree) sum(i int, l int, r int, qi int) int {
	if l == qi && r == qi {
		return s.val[i]
	}
	m := (l + r) / 2
	if qi <= m {
		return s.sum(i*2, l, m, qi) + s.val[i]
	} else {
		return s.sum(i*2+1, m+1, r, qi) + s.val[i]
	}
}

func calcTreeSize(length int) int {
	size := 1
	for size < length {
		size *= 2
	}
	return size * 2
}

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

var (
	n, m   int
	weight []int
	index  []int
	last   []int
	color  []int
	stamp  int
	edge   [][]int
)

func dfs(u int, f int, c int) {
	color[u] = c
	index[u] = stamp
	last[u] = stamp
	stamp++

	for _, v := range edge[u] {
		if v != f {
			dfs(v, u, 1-c)
			last[u] = last[v]
		}
	}
}

func main() {
	fmt.Fscan(reader, &n, &m)

	var tree [2]*SegTree
	tree[0] = NewSegTree(n)
	tree[1] = NewSegTree(n)

	weight = make([]int, n)
	index = make([]int, n)
	last = make([]int, n)
	color = make([]int, n)
	edge = make([][]int, n)

	for i := range weight {
		fmt.Fscan(reader, &weight[i])
	}

	for i := 0; i < n-1; i++ {
		var u, v int
		fmt.Fscan(reader, &u, &v)
		u--
		v--
		edge[u] = append(edge[u], v)
		edge[v] = append(edge[v], u)
	}
	dfs(0, -1, 0)

	for i := 0; i < m; i++ {
		var x, y, z int
		fmt.Fscan(reader, &x, &y)
		y--
		if x == 1 {
			fmt.Fscan(reader, &z)
			tree[color[y]].Add(index[y], last[y], z)
			tree[1-color[y]].Add(index[y], last[y], -z)
		} else {
			w := tree[color[y]].Sum(index[y]) + weight[y]
			fmt.Println(w)
		}
	}
}

package main

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

// github.com/EndlessCheng/codeforces-go
func CF383C(_r io.Reader, _w io.Writer) {
	out := bufio.NewWriter(_w)
	defer out.Flush()
	buf := make([]byte, 4096)
	_i := len(buf)
	rc := func() byte {
		if _i == len(buf) {
			_r.Read(buf)
			_i = 0
		}
		b := buf[_i]
		_i++
		return b
	}
	r := func() (x int) {
		b := rc()
		for ; '0' > b; b = rc() {
		}
		for ; '0' <= b; b = rc() {
			x = x*10 + int(b&15)
		}
		return
	}
	r1 := func() byte {
		b := rc()
		for ; '0' > b; b = rc() {
		}
		return b
	}

	n, q := r(), r()
	a := make([]int, n)
	for i := range a {
		a[i] = r()
	}
	g := make([][]int, n+1)
	for i := 1; i < n; i++ {
		v, w := r(), r()
		g[v] = append(g[v], w)
		g[w] = append(g[w], v)
	}

	tree := make([]int, n+1)
	add := func(i, v int) {
		for ; i <= n; i += i & -i {
			tree[i] += v
		}
	}
	addR := func(l, r, v int) { add(l, v); add(r, -v) }
	query := func(i int) (v int) {
		for ; i > 0; i &= i - 1 {
			v += tree[i]
		}
		return
	}

	type node struct{ dfn, sz, d int }
	nodes := make([]node, n+1)
	dfn := 0
	var f func(v, fa, d int) int
	f = func(v, fa, d int) int {
		dfn++
		nodes[v].dfn = dfn
		nodes[v].d = d
		sz := 1
		for _, w := range g[v] {
			if w != fa {
				sz += f(w, v, d+1)
			}
		}
		nodes[v].sz = sz
		return sz
	}
	f(1, 0, 0)

	for ; q > 0; q-- {
		op, v := r1(), r()
		o := nodes[v]
		if op == '1' {
			val := r()
			if o.d&1 > 0 {
				val = -val
			}
			addR(o.dfn, o.dfn+o.sz, val)
		} else {
			ans := query(o.dfn)
			if o.d&1 > 0 {
				ans = -ans
			}
			Fprintln(out, a[v-1]+ans)
		}
	}
}

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

package main

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

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

	var n, q, v, w, op, val int
	Fscan(in, &n, &q)
	a := make([]int, n)
	for i := range a {
		Fscan(in, &a[i])
	}
	g := make([][]int, n)
	for i := 1; i < n; i++ {
		Fscan(in, &v, &w)
		v--
		w--
		g[v] = append(g[v], w)
		g[w] = append(g[w], v)
	}

	tree := make([]int, n+1)
	add := func(i, v int) {
		for ; i <= n; i += i & -i {
			tree[i] += v
		}
	}
	addR := func(l, r, v int) { add(l, v); add(r, -v) }
	query := func(i int) (v int) {
		for ; i > 0; i &= i - 1 {
			v += tree[i]
		}
		return
	}

	type node struct{ dfn, sz, d int }
	nodes := make([]node, n)
	dfn := 0
	var f func(v, fa, d int) int
	f = func(v, fa, d int) int {
		dfn++
		nodes[v].dfn = dfn
		nodes[v].d = d
		sz := 1
		for _, w := range g[v] {
			if w != fa {
				sz += f(w, v, d+1)
			}
		}
		nodes[v].sz = sz
		return sz
	}
	f(0, -1, 0)

	for ; q > 0; q-- {
		Fscan(in, &op, &v)
		v--
		o := nodes[v]
		if op == 1 {
			Fscan(in, &val)
			if o.d&1 > 0 {
				val = -val
			}
			addR(o.dfn, o.dfn+o.sz, val)
		} else {
			ans := query(o.dfn)
			if o.d&1 > 0 {
				ans = -ans
			}
			Fprintln(out, a[v]+ans)
		}
	}
}

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

package main

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

const MAXCNT = 200001

var value [MAXCNT]int
var edge [MAXCNT][]int
var depth [MAXCNT]int
var left [MAXCNT]int
var right [MAXCNT]int
var seg [MAXCNT*8]int

func dfs(now int, pre int, d int, order *int) {
    //fmt.Println(now, pre, d, *order)
    depth[now] = d
    *order += 1
    left[now] = *order
    for _, v := range edge[now] {
        if(v == pre) { continue }
        dfs(v, now, d+1, order)
    }
    *order += 1
    right[now] = *order
}

func update(root int, L int, R int, g int, v int) {
    //fmt.Println(root)
    if(L == R) {
        seg[root] += v
        return
    }
    mid := (L+R)>>1
    if(g <= mid) {
        update(root<<1, L, mid, g, v)
    } else {
        update(root<<1|1, mid+1, R, g, v)
    }
    seg[root] = seg[root<<1] + seg[root<<1|1]
}

func query(root int, L int, R int, l int, r int) int {
    //fmt.Println(root)
    if(L == l && R == r) {
        return seg[root]
    }
    mid := (L+R) >> 1
    if(r <= mid) {
        return query(root<<1, L, mid, l, r)
    } else if (mid < l) {
        return query(root<<1|1, mid+1, R, l, r)
    }
    return query(root<<1, L, mid, l, mid) + query(root<<1|1, mid+1, R, mid+1, r)
}

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

func main() {
    var n, m int
    fmt.Fscan(reader, &n, &m)
    //fmt.Scanf("%d %d", &n, &m)
    for i := 1; i <= n; i++ {
        fmt.Fscan(reader, &value[i])
        //fmt.Scanf("%d", &value[i])
    }
    for i := 1; i < n; i++ {
        var x, y int
        fmt.Fscan(reader, &x, &y)
        //fmt.Scanf("%d %d", &x, &y)
        if(edge[x] == nil) { edge[x] = make([]int, 0) }
        if(edge[y] == nil) { edge[y] = make([]int, 0) }
        edge[x] = append(edge[x], y);
        edge[y] = append(edge[y], x);
    }

    //for i := 1; i <= n; i++ {
    //    for _, v := range edge[i] {
    //        fmt.Printf("%d %d\n", i, v)
    //    }
    //}

    var order int
    dfs(1, 0, 1, &order);

    //for i := 1; i <= n; i++ {
    //    fmt.Printf("%d %d %d\n", i, left[i], right[i])
    //}
    //fmt.Println(order)

    for i := 1; i <= m; i++ {
        var t int
        fmt.Fscan(reader, &t)
        //fmt.Scanf("%d", &t)
        if(t == 1) {
            var x, v int
            fmt.Fscan(reader, &x, &v)
            //fmt.Scanf("%d %d", &x, &v);
            var flag int = -1
            if(depth[x]&1 == 1) {
                flag = 1
            }
            update(1, 1, order, left[x], flag*v);
            update(1, 1, order, right[x], -1*flag*v);
        } else {
            var x int
            fmt.Fscan(reader, &x)
            //fmt.Scanf("%d", &x);
            var flag int = -1
            if(depth[x]&1 == 0) {
                flag = 1
            }
            fmt.Printf("%d\n", flag*query(1, 1, order, right[x], order) + value[x]);
        }
    }
    return
}

package main

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

type SegTree struct {
	val []int
	n   int
}

func NewSegTree(n int) *SegTree {
	size := calcTreeSize(n)
	return &SegTree{
		val: make([]int, size),
		n:   n,
	}
}

func (s *SegTree) Add(l int, r int, val int) {
	s.add(1, 0, s.n, l, r, val)
}

func (s *SegTree) Sum(i int) int {
	return s.sum(1, 0, s.n, i)
}

func (s *SegTree) add(i int, l int, r int, ql int, qr int, qv int) {
	if i >= len(s.val) {
		return
	}

	if l >= ql && r <= qr {
		s.val[i] += qv
		return
	}
	m := (l + r) / 2
	if qr <= m {
		s.add(i*2, l, m, ql, qr, qv)
	} else if ql > m {
		s.add(i*2+1, m+1, r, ql, qr, qv)
	} else {
		s.add(i*2, l, m, ql, m, qv)
		s.add(i*2+1, m+1, r, m+1, qr, qv)
	}
}

func (s *SegTree) sum(i int, l int, r int, qi int) int {
	if i >= len(s.val) {
		return 0
	}

	if l == qi && r == qi {
		return s.val[i]
	}
	m := (l + r) / 2
	if qi <= m {
		return s.sum(i*2, l, m, qi) + s.val[i]
	} else {
		return s.sum(i*2+1, m+1, r, qi) + s.val[i]
	}
}

func calcTreeSize(length int) int {
	size := 1
	for size < length {
		size *= 2
	}
	return size * 2
}

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

var (
	n, m   int
	weight []int
	index  []int
	last   []int
	color  []int
	stamp  int
	edge   [][]int
)

func dfs(u int, f int, c int) {
	color[u] = c
	index[u] = stamp
	last[u] = stamp
	stamp++

	for _, v := range edge[u] {
		if v != f {
			dfs(v, u, 1-c)
			last[u] = last[v]
		}
	}
}

func main() {
	fmt.Fscan(reader, &n, &m)

	var tree [2]*SegTree
	tree[0] = NewSegTree(n)
	tree[1] = NewSegTree(n)

	weight = make([]int, n)
	index = make([]int, n)
	last = make([]int, n)
	color = make([]int, n)
	edge = make([][]int, n)

	for i := range weight {
		fmt.Fscan(reader, &weight[i])
	}

	for i := 0; i < n-1; i++ {
		var u, v int
		fmt.Fscan(reader, &u, &v)
		u--
		v--
		edge[u] = append(edge[u], v)
		edge[v] = append(edge[v], u)
	}
	dfs(0, -1, 0)

	for i := 0; i < m; i++ {
		var x, y, z int
		fmt.Fscan(reader, &x, &y)
		y--
		if x == 1 {
			fmt.Fscan(reader, &z)
			tree[color[y]].Add(index[y], last[y], z)
			tree[1-color[y]].Add(index[y], last[y], -z)
		} else {
			w := tree[color[y]].Sum(index[y]) + weight[y]
			fmt.Println(w)
		}
	}
}

package main

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

type SegTree struct {
	val []int
	n   int
}

func NewSegTree(n int) *SegTree {
	size := calcTreeSize(n)
	return &SegTree{
		val: make([]int, size),
		n:   n,
	}
}

func (s *SegTree) Add(l int, r int, val int) {
	s.add(1, 0, s.n, l, r, val)
}

func (s *SegTree) Sum(i int) int {
	return s.sum(1, 0, s.n, i)
}

func (s *SegTree) add(i int, l int, r int, ql int, qr int, qv int) {
	if i >= len(s.val) {
		return
	}

	if l >= ql && r <= qr {
		s.val[i] += qv
		return
	}
	m := (l + r) / 2
	if qr <= m {
		s.add(i*2, l, m, ql, qr, qv)
	} else if ql > m {
		s.add(i*2+1, m+1, r, ql, qr, qv)
	} else {
		s.add(i*2, l, m, ql, m, qv)
		s.add(i*2+1, m+1, r, m+1, qr, qv)
	}
}

func (s *SegTree) sum(i int, l int, r int, qi int) int {
	if i >= len(s.val) {
		return 0
	}

	if l == qi && r == qi {
		return s.val[i]
	}
	m := (l + r) / 2
	if qi <= m {
		return s.sum(i*2, l, m, qi) + s.val[i]
	} else {
		return s.sum(i*2+1, m+1, r, qi) + s.val[i]
	}
}

func calcTreeSize(length int) int {
	size := 1
	for size < length {
		size *= 2
	}
	return size * 2
}

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

var (
	n, m   int
	weight []int
	index  []int
	last   []int
	color  []int
	stamp  int
	edge   [][]int
)

func dfs(u int, f int, c int) {
	color[u] = c
	index[u] = stamp
	last[u] = stamp
	stamp++

	for _, v := range edge[u] {
		if v != f {
			dfs(v, u, 1-c)
			last[u] = last[v]
		}
	}
}

func main() {
	fmt.Fscan(reader, &n, &m)

	var tree [2]*SegTree
	tree[0] = NewSegTree(n)
	tree[1] = NewSegTree(n)

	weight = make([]int, n)
	index = make([]int, n)
	last = make([]int, n)
	color = make([]int, n)
	edge = make([][]int, n)

	for i := range weight {
		fmt.Fscan(reader, &weight[i])
	}

	for i := 0; i < n-1; i++ {
		var u, v int
		fmt.Fscan(reader, &u, &v)
		u--
		v--
		edge[u] = append(edge[u], v)
		edge[v] = append(edge[v], u)
	}
	dfs(0, -1, 0)

	for i := 0; i < n; i++ {
		for last[i] >= n || last[i] < index[i] {
			fmt.Println("shit")
		}
	}

	for i := 0; i < m; i++ {
		var x, y, z int
		fmt.Fscan(reader, &x, &y)
		y--
		if x == 1 {
			fmt.Fscan(reader, &z)
			tree[color[y]].Add(index[y], last[y], z)
			tree[1-color[y]].Add(index[y], last[y], -z)
		} else {
			w := tree[color[y]].Sum(index[y]) + weight[y]
			fmt.Println(w)
		}
	}
}


package main

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

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

	var buf bytes.Buffer

	tc := readNum(reader)

	for tc > 0 {
		tc--
		l, r := readTwoNums(reader)
		res := solve(l, r)
		buf.WriteString(fmt.Sprintf("%d\n", res))
	}

	fmt.Print(buf.String())
}

func readString(reader *bufio.Reader) string {
	s, _ := reader.ReadString('\n')
	for i := 0; i < len(s); i++ {
		if s[i] == '\n' || s[i] == '\r' {
			return s[:i]
		}
	}
	return s
}

func normalize(s string) string {

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

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

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

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

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

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

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

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

	return i
}

func solve(l int, r int) int64 {

	n := r - l + 1
	f := make([]int, n+1)

	for i := l; i+1 <= r; i++ {
		for j := 2; i*j <= r; j++ {
			f[i*j-l]++
		}
	}

	var ans int64

	for k := l + 2; k <= r; k++ {
		tot := int64(k-l) * int64(k-l-1) / 2
		tmp1 := int64(f[k-l]) * int64(f[k-l]-1) / 2
		var tmp2 int64
		if k%6 == 0 && k/2 >= l {
			tmp2++
		}
		if k%15 == 0 && k*2/5 >= l {
			tmp2++
		}
		ans += tot - tmp1 - tmp2
	}

	return ans
}

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

func lcm(a, b int) int {
	g := gcd(a, b)
	return a / g * b
}

func search(l, r int, f func(int) bool) int {
	for l < r {
		mid := (l + r) / 2
		if f(mid) {
			r = mid
		} else {
			l = mid + 1
		}
	}
	return r
}

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

package main

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

type void struct{}
var member void

var (
	reader bufio.Reader
	writer bufio.Writer
)

const MAXN = 400000

func main() {
	inp, err := os.Open("in.txt")
	if err == nil {
		os.Stdin = inp
		outp, _ := os.Create("out.txt")
		os.Stdout = outp
		defer outp.Close()
		defer inp.Close()
	}
	reader = *bufio.NewReader(os.Stdin)
	writer = *bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	divs := make([][]int, MAXN + 1)
	for i := 1; i <= MAXN; i++ {
		for j := i * 2; j <= MAXN; j += i {
			divs[j] = append(divs[j], i)
		}
	}

	/*for i := 1; i <= 100; i++ {
		printf("%v : ", i)
		for _, x := range divs[i] {
			printf("%v ", x)
		}
		printf("\n")
	}*/

	var T int
	T = 1
	scan(&T)

	for ; T > 0; T-- {
		var l, r int
		scan(&l, &r)

		var length int64 = int64(r - l + 1)
		var big int64 = length * (length - 1) * (length - 2) / 6

		var cnt int64 = 0
		for k := l + 2; k <= r; k++ {
			var n int = len(divs[2 * k])
			for i := 0; i < n; i++ {
				if divs[2 * k][i] < l {
					continue
				}
				for j := i + 1; j < n - 1; j++ {
					if k % divs[2 * k][i] == 0 && k % divs[2 * k][j] == 0 ||
						 divs[2 * k][i] + divs[2 * k][j] > k {
						cnt++
					}
				}
			}
		}

		printf("%v\n", big - cnt)
	}
}

func scan(a ...interface{}) (n int, err error) {
	return fmt.Fscan(&reader, a...)
}

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


package main

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

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 b, k, t1 int
	arr := []int{}
	scanf("%d %d\n", &b, &k)
	for i := 0; i < k; i++ {
		scanf("%d", &t1)
		arr = append(arr, t1)
	}
	pb := 1
	ans := 0
	for i := k - 1; i >= 0; i-- {

		t1 = arr[i] * pb
		t1 %= 2
		pb *= b
		pb %= 2
		t1 %= 2
		ans += t1

	}

	if ans%2 == 0 {
		printf("even")
	} else {
		printf("odd")
	}
}

package main

import "fmt"

func main() {
	var b, k int
	fmt.Scan(&b)
	fmt.Scan(&k)

	rbt := isOdd(b)
	sum := false
	for i := 0; i < k; i++ {
		bt := rbt
		if i == k-1 {
			bt = true
		}
		var a int
		fmt.Scan(&a)
		at := isOdd(a)
		s := false
		if at && bt {
			s = true
		}
		if (sum && !s) || (s && !sum) {
			sum = true
		} else {
			sum = false
		}
	}

	if sum {
		fmt.Println("odd")
	} else {
		fmt.Println("even")
	}
}

func isOdd(n int) bool {
	if n%2 == 0 {
		return false
	}
	return true
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var a, b int
	fmt.Fscan(reader, &a, &b)
	k := make([]int, b)
	for i := 0; i < b; i++ {
		fmt.Fscan(reader, &k[i])
	}
	if a%2 == 0 {
		if k[b-1]%2 == 1 {
			fmt.Println("odd")
		} else {
			fmt.Println("even")
		}
		return
	}
	parity := 0
	for i := 0; i < b; i++ {
		parity += k[i] % 2
	}
	if parity%2 == 1 {
		fmt.Println("odd")
	} else {
		fmt.Println("even")
	}
}

package main

import "fmt"

func main() {
	var b, k int
	fmt.Scan(&b, &k)
	a := make([]int, k)
	for i := 0; i < k; i++ {
		fmt.Scan(&a[k-i-1])
	}
	counter := 0
	for i := 0; i < k; i++ {
		if a[i]%2 == 0 || (b%2 == 0 && i > 0) {
			continue
		}
		counter++
	}
	if counter%2 == 0 {
		fmt.Println("even")
	} else {
		fmt.Println("odd")
	}
}

package main

import "fmt"

func main() {
	var b, k, a int
	fmt.Scan(&b, &k)
	even := true
	for i := 0; i < k; i++ {
		fmt.Scan(&a)
		if a%2 == 0 || (b%2 == 0 && i < k-1) {
			continue
		}
		even = !even
	}
	if even {
		fmt.Println("even")
	} else {
		fmt.Println("odd")
	}
}

package main

import (
	"fmt"
)

func main() {
	var b,k int
	fmt.Scan(&b,&k)
	last:=0
	count:=0
	for i:=0;i<k;i++{
		fmt.Scan(&last)
		if b%2!=0 && last%2!=0{
			count++
		}
	}
	if (b%2!=0 && count%2!=0) || (b%2==0 && last%2!=0){
		fmt.Println("odd")
	} else{
		fmt.Println("even")
	}
}

package main

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

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

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

func main() {
	var b,k int
	scan(&b,&k)
	last:=0
	count:=0
	for i:=0;i<k;i++{
		scan(&last)
		if b%2!=0 && last%2!=0{
			count++
		}
	}
	if (b%2!=0 && count%2!=0) || (b%2==0 && last%2!=0){
		fmt.Println("odd")
	} else{
		fmt.Println("even")
	}
}

package main

import "fmt"

func printEO(a int) {
	if a == 0 {
		fmt.Printf("even")
	} else {
		fmt.Printf("odd")
	}
	return
}

func main() {
	b, k := 0, 0
	fmt.Scanf("%d %d\n", &b, &k)
	s := b % 2
	s1 := 0
	a := []int{}
	for i := 0; i < k; i++ {
		a = append(a, 0)
		fmt.Scanf("%d", &a[i])

	}
	if s == 0 {
		printEO(a[k-1] % 2)
		return
	} else {
		for i := 0; i < k; i++ {
			if a[i]%2 == 1 {
				s1 = 1 - s1
			}
		}
		printEO(s1)
		return
	}

	return
}

package main

import (
	"fmt"
)

func main(){
	var b, k int
	fmt.Scan(&b, &k)
	var a [100005]int
	var count int
	for i := 0;i < k;i++ {
		fmt.Scan(&a[i])
		if a[i] & 1 == 1 {
			count++
		}
	}
	if (b % 2 == 0 && a[k-1] % 2 == 1) || (b % 2 == 1 && count % 2 == 1) {
		fmt.Println("odd")
	} else {
		fmt.Println("even")
	}
}

package main

import "fmt"

func main() {
    var b, k int32
    fmt.Scanf("%d %d\n", &b, &k)
    var x, tmp int
    for i := int32(0); i < k; i++ {
        fmt.Scanf("%d", &tmp)
        x ^= (tmp & 1)
    }

    if b & 1 == 0 {
		if tmp & 1 == 1 {
			fmt.Println("odd")
		} else {
			fmt.Println("even")
		}
    } else {
        if x & 1 == 1 {
            fmt.Println("odd")
        } else {
            fmt.Println("even")
        }
    }
}

package main

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

func main() {
    var b, k int32
    fmt.Scanf("%d %d\n", &b, &k)
    var x, tmp int
    input := bufio.NewReader(os.Stdin)
    is, _ := input.ReadString('\n')
    iss := strings.Split(strings.TrimSpace(is), " ")
    for _, v := range iss {
        tmp, _ = strconv.Atoi(v)

        x ^= (tmp & 1)
    }

    if b & 1 == 0 {
		if tmp & 1 == 1 {
			fmt.Println("odd")
		} else {
			fmt.Println("even")
		}
    } else {
        if x & 1 == 1 {
            fmt.Println("odd")
        } else {
            fmt.Println("even")
        }
    }
}

package main

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

var reader *bufio.Reader
var writer *bufio.Writer

var inputFile = flag.String("input", "", "")

func init() {
	flag.Parse()
	var i io.Reader
	if *inputFile != "" {
		i, _ = os.Open(*inputFile)
	} else {
		i = os.Stdin
	}
	reader = bufio.NewReaderSize(i, 1<<20)
	writer = bufio.NewWriterSize(os.Stdout, 1<<20)
}

func println(a ...interface{}) {
	_, _ = fmt.Fprintln(writer, a...)
}

func printf(format string, a ...interface{}) {
	_, _ = fmt.Fprintf(writer, format, a...)
}

func scanf(format string, a ...interface{}) {
	_, _ = fmt.Fscanf(reader, format, a...)
}

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

func NextInt64() int64 {
	var res int64
	scan(&res)
	return res
}

func NextInt() int {
	var res int
	scan(&res)
	return res
}

func NextIntArray(n int) []int {
	res := make([]int, n)
	for i := range res {
		scan(&res[i])
	}
	return res
}

func NextString() string {
	var res string
	scan(&res)
	return res
}

func NextBigInt() *big.Int {
	n := new(big.Int)
	n, _ = n.SetString(NextString(), 10)
	return n
}

func main() {
	defer writer.Flush()

	b := NextInt()
	k := NextInt()

	a := NextIntArray(k)

	if b%2 == 0 {
		if a[k-1]%2 == 0 {
			println("even")
		} else {
			println("odd")
		}
		return
	}
	var s int
	for i := 0; i < k; i++ {
		s = (s + a[i]) % 2
	}

	if s%2 == 0 {
		println("even")
	} else {
		println("odd")
	}
}

package main

import (
	"fmt"
)

//go:generate go run main.go < input.txt > output.txt
func main() {
	var b, k int
	fmt.Scan(&b, &k)
	last := 0
	count := 0
	for i := 0; i < k; i++ {
		fmt.Scan(&last)
		if b%2 != 0 && last%2 != 0 {
			count++
		}
	}
	if (b%2 != 0 && count%2 != 0) || (b%2 == 0 && last%2 != 0) {
		fmt.Println("odd")
	} else {
		fmt.Println("even")
	}
}

package main

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

var in = bufio.NewReaderSize(os.Stdin, 2<<16)

func main() {
	var b, k int
	fmt.Fscan(in, &b, &k)
	sum := 0
	for i := 0; i < k; i++ {
		var a int
		fmt.Fscan(in, &a)
		if i+1 == k {
			sum += a
		} else {
			sum += a * b
		}
	}
	if sum%2 == 0 {
		fmt.Println("even")
	} else {
		fmt.Println("odd")
	}
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var a, b int
	fmt.Fscan(reader, &a, &b)
	k := make([]int, b)
	for i := 0; i < b; i++ {
		fmt.Fscan(reader, &k[i])
	}
	if a%2 == 1 {
		if k[b-1]%2 == 1 {
			fmt.Println("odd")
		} else {
			fmt.Println("even")
		}
		return
	}
	parity := 0
	for i := 0; i < b; i++ {
		parity += k[i] % 2
	}
	if parity%2 == 1 {
		fmt.Println("odd")
	} else {
		fmt.Println("even")
	}
}

package main

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

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

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

func main() {
	var b,k int
	scan(&b,&k)
	last:=0
	count:=0
	for i:=0;i<k;i++{
		scan(&last)
		if b%2!=0 && last%2!=0{
			count++
		}
	}
	if (b%2!=0 && count%2!=0) || (b%2==0 && last%2!=0){
		print("odd")
	} else{
		print("even")
	}
}

package main

import "fmt"

func printEO(a int) {
	if a == 0 {
		fmt.Printf("even")
	} else {
		fmt.Printf("odd")
	}
	return
}

func main() {
	b, k := 0, 0
	fmt.Scanf("%d %d", &b, &k)
	s := b % 2
	s1 := 0
	a := []int{}
	for i := 0; i < k; i++ {
		a = append(a, 0)
		fmt.Scanf("%d", &a[i])

	}
	if s == 0 {
		printEO(a[k-1] % 2)
		return
	} else {
		for i := 0; i < k; i++ {
			if a[i]%2 == 1 {
				s1 = 1 - s1
			}
		}
		printEO(s1)
		return
	}

	return
}

package main

import (
	"fmt"
)

func main(){
	var b, k int
	fmt.Scan(&b, &k)
	var a [100005]int
	var count int
	for i := 0;i < k;i++ {
		fmt.Scan(&a[i])
		if a[i] & 1 == 1 {
			count++
		}
	}
	if (b == 2 && a[k-1] == 1) || (b > 2 && count % 2 == 1) {
		fmt.Println("odd")
	} else {
		fmt.Println("even")
	}
}

package main

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

func main() {
    var b, k int32
    fmt.Scanf("%d %d\n", &b, &k)
    var x, tmp int
    input := bufio.NewReader(os.Stdin)
    is, _ := input.ReadString('\n')
    iss := strings.Split(is[:len(is)-1], " ")
    for _, v := range iss {
        tmp, _ = strconv.Atoi(v)
       fmt.Println(tmp)
       x ^= (tmp & 1)
    }

    if b & 1 == 0 {
		if tmp & 1 == 1 {
			fmt.Println("odd")
		} else {
			fmt.Println("even")
		}
    } else {
        if x & 1 == 1 {
            fmt.Println("odd")
        } else {
            fmt.Println("even")
        }
    }
}

package main

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

func main() {
    var b, k int32
    fmt.Scanf("%d %d\n", &b, &k)
    var x, tmp int
    input := bufio.NewReader(os.Stdin)
    is, _ := input.ReadString('\n')
    iss := strings.Split(is, " ")
    for _, v := range iss {
        tmp, err := strconv.Atoi(v)
        fmt.Println(tmp, err)
        x ^= (tmp & 1)
    }

    if b & 1 == 0 {
		if tmp & 1 == 1 {
			fmt.Println("odd")
		} else {
			fmt.Println("even")
		}
    } else {
        if x & 1 == 1 {
            fmt.Println("odd")
        } else {
            fmt.Println("even")
        }
    }
}

package main

import "fmt"

func main() {
    var b, k int32
    fmt.Scanf("%d %d\n", &b, &k)
    var x, tmp int
    for i := int32(0); i < k; i++ {
        fmt.Scanf("%d", &tmp)
        x ^= (tmp & 1)
    }

    if b & 1 == 0 {
        fmt.Println("even")
    } else {
        if x & 1 == 1 {
            fmt.Println("odd")
        } else {
            fmt.Println("even")
        }
    }
}

package main

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

func main() {
    var b, k int32
    fmt.Scanf("%d %d\n", &b, &k)
    var x, tmp int
    input := bufio.NewReader(os.Stdin)
    is, _ := input.ReadString('\n')
    iss := strings.Split(is[:len(is)-1], " ")
    for _, v := range iss {
        tmp, _ = strconv.Atoi(v)
        x ^= (tmp & 1)
    }

    if b & 1 == 0 {
		if tmp & 1 == 1 {
			fmt.Println("odd")
		} else {
			fmt.Println("even")
		}
    } else {
        if x & 1 == 1 {
            fmt.Println("odd")
        } else {
            fmt.Println("even")
        }
    }
}

package main

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

func main() {
    var b, k int32
    fmt.Scanf("%d %d\n", &b, &k)
    var x, tmp int
    input := bufio.NewReader(os.Stdin)
    is, _ := input.ReadString('\n')
    iss := strings.Split(is, " ")
    for _, v := range iss {
        tmp, _ = strconv.Atoi(v)
        x ^= (tmp & 1)
    }

    if b & 1 == 0 {
		if tmp & 1 == 1 {
			fmt.Println("odd")
		} else {
			fmt.Println("even")
		}
    } else {
        if x & 1 == 1 {
            fmt.Println("odd")
        } else {
            fmt.Println("even")
        }
    }
}

package main

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

var reader *bufio.Reader
var writer *bufio.Writer

var inputFile = flag.String("input", "", "")

func init() {
	flag.Parse()
	var i io.Reader
	if *inputFile != "" {
		i, _ = os.Open(*inputFile)
	} else {
		i = os.Stdin
	}
	reader = bufio.NewReaderSize(i, 1<<20)
	writer = bufio.NewWriterSize(os.Stdout, 1<<20)
}

func println(a ...interface{}) {
	_, _ = fmt.Fprintln(writer, a...)
}

func printf(format string, a ...interface{}) {
	_, _ = fmt.Fprintf(writer, format, a...)
}

func scanf(format string, a ...interface{}) {
	_, _ = fmt.Fscanf(reader, format, a...)
}

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

func NextInt64() int64 {
	var res int64
	scan(&res)
	return res
}

func NextInt() int {
	var res int
	scan(&res)
	return res
}

func NextIntArray(n int) []int {
	res := make([]int, n)
	for i := range res {
		scan(&res[i])
	}
	return res
}

func NextString() string {
	var res string
	scan(&res)
	return res
}

func NextBigInt() *big.Int {
	n := new(big.Int)
	n, _ = n.SetString(NextString(), 10)
	return n
}

func main() {
	defer writer.Flush()

	b := NextInt()
	k := NextInt()

	a := NextIntArray(k)

	if b%2 == 0 {
		if a[k-1]%2 == 0 {
			println("even")
		} else {
			println("odd")
		}
		return
	}
	var s int
	for i, s := 0, 0; i < k; i, s = i+1, (s+a[i])%2 {
	}

	if s%2 == 0 {
		println("even")
	} else {
		println("odd")
	}
}

package main

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

//go:generate sh -c "go run main.go < input.txt > output.txt"
func main() {
	reader := bufio.NewReader(os.Stdin)

	l1, _ := reader.ReadString('\n')
	l1 = l1[:len(l1)-1]
	vals := strings.Split(l1, " ")
	b, _ := strconv.Atoi(vals[0])
	_, _ = strconv.Atoi(vals[1]) // k unused

	l2, _ := reader.ReadString('\n')
	l2 = l2[:len(l2)-1]
	arr := strings.Split(l2, " ")

	total := 0
	for i, v := range arr {
		num, _ := strconv.Atoi(v)
		total += num * pow(b, len(arr)-i-1)
	}

	if total%2 == 0 {
		fmt.Println("even")
	} else {
		fmt.Println("odd")
	}
}

func pow(a, b int) int {
	ret := 1
	for i := 0; i < b; i++ {
		ret *= a
	}
	return ret
}


package main

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

type pii struct {
	x, y int
}
type P []pii

func (p P) Len() int {
	return len(p)
}

func (p P) Less(i, j int) bool {
	return p[i].x < p[j].x
}

func (p P) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

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

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

	var l, r int
	ok := true
	for l < n {
		if l > 0 && b[l] == b[l-1] && cnt[b[l]-1] > 0 {
			cnt[b[l]-1]--
			l++
			continue

		}
		for a[r] != b[l] && r < n-1 {
			cnt[a[r]-1]++
			r++
		}

		if r == n-1 && a[r] != b[l] {
			ok = false
		}
		//fmt.Fprintln(out, r, l)
		//fmt.Fprintln(out, a[r], b[l])
		l++
		if r < n-1 {
			r++
		}
	}
	if ok {
		fmt.Fprintln(out, "YES")
	} else {
		fmt.Fprintln(out, "NO")
	}

}
func main() {
	defer out.Flush()
	t := 1
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		solve()
	}
}

/*
5
5
1 2 3 3 2
1 3 3 2 2
5
1 2 4 2 1
4 2 2 1 1
5
2 4 5 5 2
2 2 4 5 5
3
1 2 3
1 2 3
3
1 1 2
2 1 1
*/

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)

		aCnt := make(map[int]int)
		aPos := make(map[int]int)
		as := 0

		for i := 0; i < n; i++ {
			Fscan(in, &a[i])
		}

		for i := n - 1; i >= 0; i-- {
			if aCnt[a[i]] == 0 {
				as++
				aPos[a[i]] = as
			}
			aCnt[a[i]]++
		}

		bCnt := make(map[int]int)
		bPos := make(map[int]int)
		bs := 0
		for i := 0; i < n; i++ {
			Fscan(in, &b[i])
		}

		for i := n - 1; i >= 0; i-- {
			if bCnt[b[i]] == 0 {
				bs++
				bPos[b[i]] = bs
			}
			bCnt[b[i]]++
		}

		ans := "YES"
		for k, v := range aPos {
			if bPos[k] != v {
				ans = "NO"
				break
			}
		}

		if ans == "YES" {

			i := 0
			p := 0
			blast := -1
			alast := -1

			cnt := make(map[int]int)
			for i < n {
				for i < n && p < n && a[p] == b[i] {
					alast = a[p]
					aCnt[a[p]]--
					p++
					blast = b[i]
					i++
				}
				if i < n {
					if b[i] == blast && cnt[b[i]] > 0 && alast == b[i] {
						cnt[b[i]]--
						blast = b[i]
						i++
					} else {
						if p < n && aCnt[b[i]] > 0 {
							cnt[a[p]]++
							alast = a[p]
							p++
						} else {
							ans = "NO"
							break
						}
					}
				}
			}
		}
		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 pii struct {
	x, y int
}
type P []pii

func (p P) Len() int {
	return len(p)
}

func (p P) Less(i, j int) bool {
	return p[i].x < p[j].x
}

func (p P) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

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

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

	var l, r int
	ok := true
	for l < n {
		if r < n && a[r] == b[l] {
			l++
			r++
			continue
		}

		if cnt[b[l]-1] > 0 && b[l] == b[l-1] {
			cnt[b[l]-1]--
			l++
		} else if r < n {
			cnt[a[r]-1]++
			r++
		} else {
			ok = false
			break
		}
	}
	if ok {
		fmt.Fprintln(out, "YES")
	} else {
		fmt.Fprintln(out, "NO")
	}

}
func main() {
	defer out.Flush()
	t := 1
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		solve()
	}
}

/*
5
5
1 2 3 3 2
1 3 3 2 2
5
1 2 4 2 1
4 2 2 1 1
5
2 4 5 5 2
2 2 4 5 5
3
1 2 3
1 2 3
3
1 1 2
2 1 1
*/

package main

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

/*
3
1
5
5
2
2 3
3 2
3
2 4 1
1 4 2
---
YES
NO
NO
========
4
8
1 2 1 4 3 4 5 1
1 1 4 5 1 2 3 4
6
1 2 1 5 2 1
5 1 2 1 1 2
5
1 2 2 1 3
2 2 1 1 3
8
1 2 1 3 1 4 2 5
3 1 1 1 4 2 2 5
---
NO
NO
YES
YES
======
4
7
3 1 2 4 1 5 2
3 4 1 1 5 2 2
7
2 1 4 5 4 1 6
2 5 4 4 1 1 6
6
3 6 3 1 2 2
6 3 3 1 2 2
6
1 5 2 4 1 2
5 4 1 1 2 2
---
YES
YES
YES
YES
=======
2
6
2 1 3 2 3 4
1 2 2 3 3 4
7
3 1 2 1 3 3 2
1 1 3 3 3 2 2
---
YES
YES
======
1
7
5 2 1 3 2 3 4
5 1 2 2 3 3 4
---
YES

*/

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

	b := make([]int, n)

	equal := true

	for i := range b {
		scanf("%d", &b[i])

		if a[i] != b[i] {
			equal = false
		}
	}
	scanf("\n")

	if equal {
		fmt.Fprintln(writer, "YES")
		return
	}

	prevB := -1
	shiftB := 0

	setB := make(map[int]int)

	i := n - 1
	for ; i-shiftB >= 0; i-- {
		if a[i] != b[i-shiftB] {
			if b[i-shiftB] == prevB {
				setB[b[i-shiftB]]++
				shiftB++
				i++
			} else if _, ok := setB[a[i]]; ok {
				setB[a[i]]--
				if setB[a[i]] == 0 {
					delete(setB, a[i])
				}
				shiftB--
			} else {
				fmt.Fprintln(writer, "NO")
				return
			}
		} else {
			prevB = b[i-shiftB]
		}
	}

	for ; i >= 0; i-- {
		setB[a[i]]--
		if setB[a[i]] == 0 {
			delete(setB, a[i])
		} else if setB[a[i]] < 0 {
			fmt.Fprintln(writer, "NO")
			return
		}
	}

	if len(setB) > 0 {
		fmt.Fprintln(writer, "NO")
	} else {
		fmt.Fprintln(writer, "YES")
	}
}

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

const MOD int64 = 1000000007

var n int

var a, b []int

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

		a = make([]int, n)
		b = make([]int, n)

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

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

		solve()
	}
}

type pair struct {
	v int
	idx []int
}

//a b c d

//20 12 -- 4
//4  2  -- 4

func solve()  {
	//a == 3 3 4 5 3 6 4 3 1 4 1 1 3

	//b == 4 6 ... . . .. 33

	i, j := 0, 0
	mp := make([]int, n + 1)

	for ;i < n; {
		curB := b[i]

		if j < n {
			curA := a[j]

			if curA == curB {
				i++
				j++
				continue
			}

			//2 1

			//3 5 4 3 3 4
			//3 5 4 3 3

			if i > 0 {
				if b[i - 1] == b[i] && mp[b[i]] > 0 {
					mp[b[i]]--
					i++
					continue
				}
			}

			mp[a[j]]++
			j++

		} else {

			if i > 0 {
				if b[i - 1] == b[i] && mp[b[i]] > 0 {
					mp[b[i]]--
					i++
					continue
				}
			}
			fmt.Println("NO")
			return
		}
	}

	for _, v := range mp {
		if v > 0 {
			fmt.Println("NO")
			return
		}
	}

	fmt.Println("YES")

	//1 5 4 4 6 7 3 3 6 5 2 1 3 3
}

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

package main

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

type Box struct {
	val   int
	count int
}

func getBoxes(a []int) []Box {
	boxes := []Box{}
	curval := a[len(a)-1]
	curcount := 1
	for curindex := len(a) - 2; curindex >= 0; curindex-- {
		if curval != a[curindex] {
			boxes = append(boxes, Box{val: curval, count: curcount})
			curval = a[curindex]
			curcount = 1
		} else {
			curcount++
		}
	}
	boxes = append(boxes, Box{val: curval, count: curcount})
	return boxes
}

func possible(a []int, b []int) bool {
	aboxes := getBoxes(a)
	bboxes := getBoxes(b)
	// want bboxes >= aboxes
	bindex := 0
	acounts := map[int]int{}
	bcounts := map[int]int{}
	for _, abox := range aboxes {
		val := abox.val
		acounts[val] += abox.count
		if bindex < len(bboxes) && val == bboxes[bindex].val {
			bbox := bboxes[bindex]
			bcounts[bbox.val] += bbox.count
			bindex++
		}
		if bcounts[val] < acounts[val] {
			return false
		}
	}
	return true
}

func main() {
	input := bufio.NewReader(os.Stdin)
	t := readInt(input)
	for i := 0; i < t; i++ {
		readInt(input)
		a := readArrInt(input)
		b := readArrInt(input)
		if possible(a, b) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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

// github.com/EndlessCheng/codeforces-go
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var T, n int
o:
	for Fscan(in, &T); T > 0; T-- {
		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])
		}
		c := make([]int, n+1)
		for i, j := n-1, n-1; i >= 0; i-- {
			if i < n-1 && b[i] == b[i+1] {
				c[b[i]]++ // a 中 <=j 的任意位置可以塞个 b[i]
				continue
			}
			for ; a[j] != b[i]; j-- {
				if c[a[j]] == 0 {
					Fprintln(out, "NO")
					continue o
				}
				c[a[j]]--
			}
			j--
		}
		Fprintln(out, "YES")
	}
}

package main

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

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

var t int
var n int

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

	Fscan(in, &t)
	for ; t > 0; t-- {
		Fscan(in, &n)
		a, b := make([]int, n), make([]int, n)
		for i := range a {
			Fscan(in, &a[i])
		}
		for i := range b {
			Fscan(in, &b[i])
		}

		ans := "YES"
		p1, p2 := n-1, n-1
		cnt := make(map[int]int)
		cur := -1
		for ; p2 >= 0; p2-- {
			if b[p2] == cur {
				cnt[b[p2]]++
			} else {
				vis := false
				for p1 >= p2 {
					if a[p1] == b[p2] {
						vis = true
						p1--
						break
					}
					cnt[a[p1]]--
					if cnt[a[p1]] < 0 {
						ans = "NO"
						goto out
					}
					p1--
				}
				if !vis {
					ans = "NO"
					goto out
				}
			}
			cur = b[p2]
		}
	out:
		Fprintln(out, ans)
	}
}

package main

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

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

var T int
var N int

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

	Fscan(in, &T)
	for K := 1; K <= T; K++ {
		Fscan(in, &N)
		a, b := make([]int, N), make([]int, N)
		for i := range a {
			Fscan(in, &a[i])
		}
		for i := range b {
			Fscan(in, &b[i])
		}
		if K == 32 {
			Println(a, b)
		}
		aa, bb := []int{}, []int{}
		vis := make(map[int]bool)
		for i := N - 1; i >= 0; i-- {
			if !vis[a[i]] {
				aa = append(aa, a[i])
				vis[a[i]] = true
			}
		}
		vis = make(map[int]bool)
		for i := N - 1; i >= 0; i-- {
			if !vis[b[i]] {
				bb = append(bb, b[i])
				vis[b[i]] = true
			}
		}
		if len(aa) != len(bb) {
			Fprintln(out, "NO")
		}
		for i := range aa {
			if aa[i] != bb[i] {
				Fprintln(out, "NO")
				goto H1
			}
		}
		Fprintln(out, "YES")
	H1:
	}
}

package main

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

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

var T int
var N int

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

	Fscan(in, &T)
	for K := 0; K < T; K++ {
		Fscan(in, &N)
		a, b := make([]int, N), make([]int, N)
		for i := range a {
			Fscan(in, &a[i])
		}
		for i := range b {
			Fscan(in, &b[i])
		}
		aa, bb := []int{}, []int{}
		vis := make(map[int]bool)
		for i := N - 1; i >= 0; i-- {
			if !vis[a[i]] {
				aa = append(aa, a[i])
				vis[a[i]] = true
			}
		}
		vis = make(map[int]bool)
		for i := N - 1; i >= 0; i-- {
			if !vis[b[i]] {
				bb = append(bb, b[i])
				vis[b[i]] = true
			}
		}
		if len(aa) != len(bb) {
			Fprintln(out, "NO")
		}
		for i := range aa {
			if aa[i] != bb[i] {
				Fprintln(out, "NO")
				goto H1
			}
		}
		Fprintln(out, "YES")
	H1:
	}
}

package main

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

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

var T int
var N int

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

	Fscan(in, &T)
	for K := 0; K < T; K++ {
		Fscan(in, &N)
		a, b := make([]int, N), make([]int, N)
		for i := range a {
			Fscan(in, &a[i])
		}
		for i := range b {
			Fscan(in, &b[i])
		}
			if K == 33 || K == 32 || K == 31 {
				Println(a)
				Println(b)
			}
		aa, bb := []int{}, []int{}
		vis := make(map[int]bool)
		for i := N - 1; i >= 0; i-- {
			if !vis[a[i]] {
				aa = append(aa, a[i])
				vis[a[i]] = true
			}
		}
		vis = make(map[int]bool)
		for i := N - 1; i >= 0; i-- {
			if !vis[b[i]] {
				bb = append(bb, b[i])
				vis[b[i]] = true
			}
		}
		if len(aa) != len(bb) {
			Fprintln(out, "NO")
		}
		for i := range aa {
			if aa[i] != bb[i] {
				Fprintln(out, "NO")
				goto H1
			}
		}
		Fprintln(out, "YES")
	H1:
	}
}

package main

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

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

var T int
var N int

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

	Fscan(in, &T)
	for K := 0; K < T; K++ {
		Fscan(in, &N)
		a, b := make([]int, N), make([]int, N)
		for i := range a {
			Fscan(in, &a[i])
		}
		for i := range b {
			Fscan(in, &b[i])
		}
		if K == 32 {
			Println(a)
			Println(b)
		}
		aa, bb := []int{}, []int{}
		vis := make(map[int]bool)
		for i := N - 1; i >= 0; i-- {
			if !vis[a[i]] {
				aa = append(aa, a[i])
				vis[a[i]] = true
			}
		}
		vis = make(map[int]bool)
		for i := N - 1; i >= 0; i-- {
			if !vis[b[i]] {
				bb = append(bb, b[i])
				vis[b[i]] = true
			}
		}
		if len(aa) != len(bb) {
			Fprintln(out, "NO")
		}
		for i := range aa {
			if aa[i] != bb[i] {
				Fprintln(out, "NO")
				goto H1
			}
		}
		Fprintln(out, "YES")
	H1:
	}
}

package main

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

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

var T int
var N int

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

	Fscan(in, &T)
	for K := 0; K < T; K++ {
		Fscan(in, &N)
		a, b := make([]int, N), make([]int, N)
		for i := range a {
			Fscan(in, &a[i])
		}
		for i := range b {
			Fscan(in, &b[i])
		}
		if K == 31 {
			Println(a)
			Println(b)
		}
		aa, bb := []int{}, []int{}
		vis := make(map[int]bool)
		for i := N - 1; i >= 0; i-- {
			if !vis[a[i]] {
				aa = append(aa, a[i])
				vis[a[i]] = true
			}
		}
		vis = make(map[int]bool)
		for i := N - 1; i >= 0; i-- {
			if !vis[b[i]] {
				bb = append(bb, b[i])
				vis[b[i]] = true
			}
		}
		if len(aa) != len(bb) {
			Fprintln(out, "NO")
		}
		for i := range aa {
			if aa[i] != bb[i] {
				Fprintln(out, "NO")
				goto H1
			}
		}
		Fprintln(out, "YES")
	H1:
	}
}

package main

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

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

var T int
var N int

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

	Fscan(in, &T)
	for ; T > 0; T-- {
		Fscan(in, &N)
		a, b := make([]int, N), make([]int, N)
		for i := range a {
			Fscan(in, &a[i])
		}
		for i := range b {
			Fscan(in, &b[i])
		}
		aa, bb := []int{}, []int{}
		vis := make(map[int]bool)
		for i := N - 1; i >= 0; i-- {
			if !vis[a[i]] {
				aa = append(aa, a[i])
				vis[a[i]] = true
			}
		}
		vis = make(map[int]bool)
		for i := N - 1; i >= 0; i-- {
			if !vis[b[i]] {
				bb = append(bb, b[i])
				vis[b[i]] = true
			}
		}
		if len(aa) != len(bb) {
			Fprintln(out, "NO")
		}
		for i := range aa {
			if aa[i] != bb[i] {
				Fprintln(out, "NO")
				goto H1
			}
		}
		Fprintln(out, "YES")
	H1:
	}
}

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)

		aCnt := make(map[int]int)
		aPos := make(map[int]int)
		as := 0

		for i := 0; i < n; i++ {
			Fscan(in, &a[i])
		}

		for i := n - 1; i >= 0; i-- {
			if aCnt[a[i]] == 0 {
				as++
				aPos[a[i]] = as
			}
			aCnt[a[i]]++
		}

		bCnt := make(map[int]int)
		bPos := make(map[int]int)
		bs := 0
		for i := 0; i < n; i++ {
			Fscan(in, &b[i])
		}

		for i := n - 1; i >= 0; i-- {
			if bCnt[b[i]] == 0 {
				bs++
				bPos[b[i]] = bs
			}
			bCnt[b[i]]++
		}

		ans := "YES"
		for k, v := range aPos {
			if bPos[k] != v {
				ans = "NO"
				break
			}
		}

		if ans == "YES" {

			i := 0
			p := 0
			blast := -1
			alast := -1

			cnt := make(map[int]int)
			for i < n {
				for i < n && p < n && a[p] == b[i] {
					alast = a[p]
					p++
					blast = b[i]
					i++
				}
				if i < n {
					if b[i] != blast {
						if p < n {
							cnt[a[p]]++
							alast = a[p]
							p++
						} else {
							ans = "NO"
							break
						}
					} else {
						if cnt[b[i]] > 0 && alast == b[i] {
							cnt[b[i]]--
							blast = b[i]
							i++
						} else {
							ans = "NO"
							break
						}
					}
				}
			}
		}
		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)

		a := make([]int, n)
		b := make([]int, n)

		aCnt := make(map[int]int)

		for i := 0; i < n; i++ {
			Fscan(in, &a[i])
		}

		for i := 0; i < n; i++ {
			Fscan(in, &b[i])
		}

		ans := "YES"
		i := 0
		p := 0
		blast := -1
		alast := -1
		for i < n {
			for i < n && p < n && a[p] == b[i] {
				alast = a[p]
				p++
				blast = b[i]
				i++
			}
			if i < n {
				if b[i] != blast {
					if p < n {
						aCnt[a[p]]++
						alast = a[p]
						p++
					} else {
						ans = "NO"
						break
					}
				} else {
					if aCnt[b[i]] > 0 && alast == b[i] {
						aCnt[b[i]]--
						blast = b[i]
						i++
					} else {
						ans = "NO"
						break
					}
				}
			}
		}
		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)

		a := make([]int, n)
		b := make([]int, n)

		aCnt := make(map[int]int)

		for i := 0; i < n; i++ {
			Fscan(in, &a[i])
		}

		for i := 0; i < n; i++ {
			Fscan(in, &b[i])
		}

		ans := "YES"
		i := 0
		p := 0
		last := -1
		for i < n {
			for i < n && p < n && a[p] == b[i] {
				p++
				last = b[i]
				i++
			}
			if i < n {
				if b[i] != last {
					if p < n {
						aCnt[a[p]]++
						p++
					} else {
						ans = "NO"
						break
					}
				} else {
					if aCnt[b[i]] > 0 {
						aCnt[b[i]]--
						last = b[i]
						i++
					} else {
						ans = "NO"
						break
					}
				}
			}
		}
		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)

		a := make([]int, n)
		b := make([]int, n)

		aCnt := make(map[int]int)
		aPos := make(map[int]int)
		as := 0

		for i := 0; i < n; i++ {
			Fscan(in, &a[i])
		}

		for i := n - 1; i >= 0; i-- {
			if aCnt[a[i]] == 0 {
				as++
				aPos[a[i]] = as
			}
			aCnt[a[i]]++
		}

		bCnt := make(map[int]int)
		bPos := make(map[int]int)
		bs := 0
		for i := 0; i < n; i++ {
			Fscan(in, &b[i])
		}

		for i := n - 1; i >= 0; i-- {
			if bCnt[b[i]] == 0 {
				bs++
				bPos[b[i]] = bs
			}
			bCnt[b[i]]++
		}

		ans := "YES"
		for k, v := range aPos {
			if bPos[k] != v {
				ans = "NO"
				break
			}
		}
		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"
	"sort"
)

type pii struct {
	x, y int
}
type P []pii

func (p P) Len() int {
	return len(p)
}

func (p P) Less(i, j int) bool {
	return p[i].x < p[j].x
}

func (p P) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

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

func solve() {
	var n int
	fmt.Fscan(in, &n)
	a := make([]int, n)
	b := make([]int, n)
	A := make([]pii, n+1)
	B := make([]pii, n+1)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &a[i])
		A[a[i]].x = i
		A[a[i]].y++

	}
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &b[i])
		B[b[i]].x = i
		B[b[i]].y++
	}

	work := func(p P, t []int) []int {
		sort.Sort(p)
		var s []int
		for _, v := range p {
			//fmt.Fprintln(out, s[v.x], v.x, v.y)
			for i := 0; i < v.y; i++ {
				s = append(s, t[v.x])
			}
		}
		return s
	}

	workA := work(P(A), a)
	workB := work(P(B), b)
	ok := true
	for i, _ := range workA {
		//	fmt.Fprintln(out, workA[i], workB[i])
		if workA[i] != workB[i] {
			ok = false
			break
		}
	}
	if ok {
		fmt.Fprintln(out, "YES")
	} else {
		fmt.Fprintln(out, "NO")
	}

}
func main() {
	defer out.Flush()
	t := 1
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		solve()
	}
}

package main

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

/*
3
1
5
5
2
2 3
3 2
3
2 4 1
1 4 2
---
YES
NO
NO
========
4
8
1 2 1 4 3 4 5 1
1 1 4 5 1 2 3 4
6
1 2 1 5 2 1
5 1 2 1 1 2
5
1 2 2 1 3
2 2 1 1 3
8
1 2 1 3 1 4 2 5
3 1 1 1 4 2 2 5
---
NO
NO
YES
YES

======

1
5
1 2 3 3 2
1 3 3 2 2
---
YES
*/

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

	b := make([]int, n)

	equal := true
	numToCnt := make(map[int]int)

	for i := range b {
		scanf("%d", &b[i])

		if a[i] != b[i] {
			equal = false
		}

		numToCnt[b[i]]++
	}
	scanf("\n")

	if equal {
		fmt.Fprintln(writer, "YES")
		return
	}

	prevB := -1
	shiftB := 0

	setB := make(map[int]int)

	i := n - 1
	for ; i-shiftB >= 0; i-- {
		if a[i] != b[i-shiftB] {
			if b[i-shiftB] == prevB {
				setB[b[i-shiftB]]++
				shiftB++
				i++
			} else if _, ok := setB[a[i]]; ok {
				setB[b[i-shiftB]]++
				setB[a[i]]--
				if setB[a[i]] == 0 {
					delete(setB, a[i])
				}
			} else {
				fmt.Fprintln(writer, "NO")
				return
			}
		} else {
			prevB = b[i-shiftB]
		}
	}

	for ; i >= 0; i-- {
		setB[a[i]]--
		if setB[a[i]] == 0 {
			delete(setB, a[i])
		} else if setB[a[i]] < 0 {
			fmt.Fprintln(writer, "NO")
			return
		}
	}

	if len(setB) > 0 {
		fmt.Fprintln(writer, "NO")
	} else {
		fmt.Fprintln(writer, "YES")
	}
}

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

func main() {
	var R,x1,y1,x2,y2 int64
	fmt.Scan(&R, &x1, &y1, &x2, &y2)
    x := x1 - x2
    y := y1 - y2
    if (x*x + y*y >= R * R) {
        fmt.Print(x1,y1,R)
    } else {
        if (x == 0 && y == 0) {
            dist := float64(R) / 2
            fmt.Print(float64(x1) + dist, float64(y1), dist)
        } else {
            l := math.Sqrt(float64(x*x+y*y))
            dist := (float64(R) + l) / 2
            xd := float64(x) / l * dist
            yd := float64(y) / l * dist
            fmt.Print(float64(x2) + xd, float64(y2) + yd, dist)
        }
    }
}

package main

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

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

	var flatR, x1, y1, x2, y2 float64
	Fscan(in, &flatR, &x1, &y1, &x2, &y2)
	x2 -= x1
	y2 -= y1
	if x2 == 0 && y2 == 0 {
		Fprint(out, x1+flatR/2, y1, flatR/2)
		return
	}
	if x2*x2+y2*y2 >= flatR*flatR {
		Fprint(out, x1, y1, flatR)
		return
	}
	r2 := math.Hypot(x2, y2)
	r := (r2 + flatR) / 2
	k := (r - r2) / r2
	Fprint(out, x1-k*x2, y1-k*y2, r)
}

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

package main

import (
	"fmt"
	"math"
)

type Point struct {
	x, y float64
}

var R int
var p1, p2 Point

func main() {
	fmt.Scanf("%d %g %g %g %g", &R, &p1.x, &p1.y, &p2.x, &p2.y)
	diff := Point {
		x: p1.x - p2.x,
		y: p1.y - p2.y,
	}
	z := math.Sqrt(float64(math.Pow(float64(diff.y), 2) + math.Pow(float64(diff.x), 2)))
	r := (float64(R) + z) / 2
	if r > float64(R) {
		fmt.Printf("%g %g %g", p1.x, p1.y, float64(R))
		return
	}
	theta := math.Atan2(diff.y, diff.x)
	res := Point {
		x: p2.x + r * math.Cos(theta),
		y: p2.y + r * math.Sin(theta),
	}
	fmt.Printf("%g %g %g", res.x, res.y, r)
}

package main

import (
	"fmt"
    "math"
)

func main() {
	var R,x1,y1,x2,y2 int64
	fmt.Scan(&R, &x1, &y1, &x2, &y2)
    x := x1 - x2
    y := y1 - y2
    if (x*x + y*y >= R * R) {
        fmt.Print(x1,y1,R)
    } else {
        if (x == 0 && y == 0) {
            dist := float64(R) / 2
            fmt.Print(float64(x1) + dist, float64(y1) + dist, dist)
        } else {
            l := math.Sqrt(float64(x*x+y*y))
            dist := (float64(R) + l) / 2
            xd := float64(x) / l * dist
            yd := float64(y) / l * dist
            fmt.Print(float64(x2) + xd, float64(y2) + yd, dist)
        }
    }
}

package main

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

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

	var flatR, x1, y1, x2, y2 int64
	Fscan(in, &flatR, &x1, &y1, &x2, &y2)
	x2 -= x1
	y2 -= y1
	if x2 == 0 && y2 == 0 {
		Fprint(out, x1, y1, 0)
		return
	}
	if x2*x2+y2*y2 >= flatR*flatR {
		Fprint(out, x1, y1, flatR)
		return
	}
	r2 := math.Hypot(float64(x2), float64(y2))
	r := (r2 + float64(flatR)) / 2
	k := (r - r2) / r2
	Fprint(out, float64(x1)-k*float64(x2), float64(y1)-k*float64(y2), r)
}

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

package main

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

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

	var flatR, x1, y1, x2, y2 float64
	Fscan(in, &flatR, &x1, &y1, &x2, &y2)
	x2 -= x1
	y2 -= y1
	if x2 == 0 && y2 == 0 {
		Fprint(out, x1, y1, flatR)
		return
	}
	if x2*x2+y2*y2 >= flatR*flatR {
		Fprint(out, x1, y1, flatR)
		return
	}
	r2 := math.Hypot(x2, y2)
	r := (r2 + flatR) / 2
	k := (r - r2) / r2
	Fprint(out, x1-k*x2, y1-k*y2, r)
}

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

package main

import (
	"fmt"
	"math"
)

type Point struct {
	x, y float64
}

var R int
var p1, p2 Point

func main() {
	fmt.Scanf("%d %g %g %g %g", &R, &p1.x, &p1.y, &p2.x, &p2.y)
	diff := Point {
		x: p1.x - p2.x,
		y: p1.y - p2.y,
	}
	z := math.Sqrt(float64(math.Pow(float64(diff.y), 2) + math.Pow(float64(diff.x), 2)))
	r := (float64(R) + z) / 2
	theta := math.Atan2(diff.y, diff.x)
	res := Point {
		x: p2.x + r * math.Cos(theta),
		y: p2.y + r * math.Sin(theta),
	}
	fmt.Printf("%g %g %g", res.x, res.y, r)
}


package main

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

// github.com/EndlessCheng/codeforces-go
func CF75C(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	gcd := func(a, b int) int {
		for a != 0 {
			a, b = b%a, a
		}
		return b
	}

	var l, r, q int
	Fscan(in, &l, &r, &q)
	g := gcd(l, r)
	ds := []int{}
	for d := 1; d*d <= g; d++ {
		if g%d == 0 {
			ds = append(ds, d)
			if d*d < g {
				ds = append(ds, g/d)
			}
		}
	}
	sort.Ints(ds)
	for ; q > 0; q-- {
		Fscan(in, &l, &r)
		if i := sort.SearchInts(ds, r+1); i > 0 && ds[i-1] >= l {
			Fprintln(out, ds[i-1])
		} else {
			Fprintln(out, -1)
		}
	}
}

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

package main

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

var scanner *bufio.Scanner
var writer *bufio.Writer

func getI64() int64 {
  scanner.Scan()
  x, _ := strconv.ParseInt(scanner.Text(), 10, 64)
  return x
}
func getI() int {
  return int(getI64())
}
func getF() float64 {
  scanner.Scan()
  x, _ := strconv.ParseFloat(scanner.Text(), 64)
  return x
}
func getS() string {
  scanner.Scan()
  return scanner.Text()
}

func main() {
  scanner = bufio.NewScanner(os.Stdin)
  scanner.Split(bufio.ScanWords)
  writer = bufio.NewWriter(os.Stdout)
  defer writer.Flush()

  a, b := getI(), getI()
  if a > b {
    a, b = b, a
  }
  isFactor := map[int]bool{}
  for d := 1; d*d <= a; d++ {
    if a%d == 0 {
      if b%d == 0 {
        isFactor[d] = true
      }
      c := a/d
      if b%c == 0 {
        isFactor[c] = true
      }
    }
  }
  factors := []int{}
  for d := range isFactor {
    factors = append(factors, d)
  }
  sort.Ints(factors)
  for _, d := range factors {
    fmt.Fprintf(os.Stderr, "%d ", d)
  }
  fmt.Fprintf(os.Stderr, "\n")
  n := getI()
  for i := 0; i < n; i++ {
    low, high := getI(), getI()
    result := -1
    for j := len(factors)-1; j >= 0; j-- {
      d := factors[j]
      if low <= d && d <= high {
        result = d
        break
      }
    }
    writer.WriteString(fmt.Sprintf("%d\n", result))
  }
}

package main

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

var scanner *bufio.Scanner
var writer *bufio.Writer

func getI64() int64 {
  scanner.Scan()
  x, _ := strconv.ParseInt(scanner.Text(), 10, 64)
  return x
}
func getI() int {
  return int(getI64())
}
func getF() float64 {
  scanner.Scan()
  x, _ := strconv.ParseFloat(scanner.Text(), 64)
  return x
}
func getS() string {
  scanner.Scan()
  return scanner.Text()
}

func main() {
  scanner = bufio.NewScanner(os.Stdin)
  scanner.Split(bufio.ScanWords)
  writer = bufio.NewWriter(os.Stdout)
  defer writer.Flush()

  a, b := getI(), getI()
  if a > b {
    a, b = b, a
  }
  isFactor := map[int]bool{}
  for d := 1; d*d <= a; d++ {
    if a%d == 0 && b%d == 0 {
      isFactor[d] = true
      c := a/d
      if b%c == 0 {
        isFactor[c] = true
      }
    }
  }
  factors := []int{}
  for factor := range isFactor {
    factors = append(factors, factor)
  }
  sort.Ints(factors)
  n := getI()
  for i := 0; i < n; i++ {
    low, high := getI(), getI()
    result := -1
    for j := len(factors)-1; j >= 0; j-- {
      d := factors[j]
      if low <= d && d <= high {
        result = d
        break
      }
    }
    writer.WriteString(fmt.Sprintf("%d\n", result))
  }
}

package main

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

var scanner *bufio.Scanner
var writer *bufio.Writer

func getI64() int64 {
  scanner.Scan()
  x, _ := strconv.ParseInt(scanner.Text(), 10, 64)
  return x
}
func getI() int {
  return int(getI64())
}
func getF() float64 {
  scanner.Scan()
  x, _ := strconv.ParseFloat(scanner.Text(), 64)
  return x
}
func getS() string {
  scanner.Scan()
  return scanner.Text()
}

func main() {
  scanner = bufio.NewScanner(os.Stdin)
  scanner.Split(bufio.ScanWords)
  writer = bufio.NewWriter(os.Stdout)
  defer writer.Flush()

  a, b := getI(), getI()
  if a > b {
    a, b = b, a
  }
  isFactor := map[int]bool{}
  for d := 1; d*d <= a; d++ {
    if a%d == 0 && b%d == 0 {
      isFactor[d] = true
      isFactor[a/d] = true
      isFactor[b/d] = true
    }
  }
  factors := []int{}
  for factor := range isFactor {
    factors = append(factors, factor)
  }
  sort.Ints(factors)
  n := getI()
  for i := 0; i < n; i++ {
    low, high := getI(), getI()
    result := -1
    for j := len(factors)-1; j >= 0; j-- {
      d := factors[j]
      if low <= d && d <= high {
        result = d
        break
      }
    }
    writer.WriteString(fmt.Sprintf("%d\n", result))
  }
}