package main

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

func debug(T ...interface{}) {
	fmt.Println(T...)
}

const N = 505
const mod = 998244353

var a [N]int
var b [N]int
var dp [N][N]int

var in = bufio.NewReader(os.Stdin)

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

func get(n int, p int) int {
	for i := 0; i <= n; i++ {
		for k := 0; k <= i; k++ {
			dp[i][k] = 0
		}
	}
	dp[0][0] = 1
	for i := 0; i < n; i++ {
		for k := 0; k <= i; k++ {
			if dp[i][k] == 0 {
				continue
			}
			dp[i+1][k] += dp[i][k]
			dp[i+1][k] %= mod
			if i+1 >= p && k+b[i+1] >= 0 {
				dp[i+1][k+b[i+1]] += dp[i][k]
				dp[i+1][k+b[i+1]] %= mod
			} else if i+1 < p {
				dp[i+1][max(k+b[i+1], 0)] += dp[i][k]
				dp[i+1][max(k+b[i+1], 0)] %= mod
			}
		}
	}
	ans := 0
	for k := 0; k <= n; k++ {
		ans += dp[n][k]
		ans %= mod
	}
	return ans
}

func solve(t int) {
	var n int
	fmt.Fscan(in, &n)
	var ch string
	for i := 1; i <= n; i++ {
		fmt.Fscan(in, &ch)
		if ch == "+" {
			fmt.Fscan(in, &a[i])
		} else {
			a[i] = -1
		}
	}
	ans := int64(0)
	for p := 1; p <= n; p++ {
		if a[p] != -1 {
			k := 0
			for i := 1; i <= n; i++ {
				if i == p {
					continue
				}
				k++
				if a[i] == -1 {
					b[k] = -1
				} else if a[i] < a[p] || (a[i] == a[p] && i < p) {
					b[k] = 1
				} else {
					b[k] = 0
				}
			}
			val := get(k, p)
			// debug(p, val)
			ans += int64(val) * int64(a[p])
			ans %= mod
		}
	}
	fmt.Println(ans)
}

func main() {
	var T int = 1
	// fmt.Fscan(in, &T)
	for t := 1; t <= T; t++ {
		solve(t)
	}
}

package main

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

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

func Read() int {
	in.Scan()
	r := 0
	for _, v := range in.Bytes() {
		r = r*10 + int(v-'0')
	}
	return r
}

func ReadSign() bool {
	in.Scan()
	if in.Bytes()[0] == '-' {
		return false
	}
	return true
}

func init() {
	const MaxInt = int(^uint(0) >> 1)
	in.Buffer(make([]byte, 1<<12), MaxInt)
	in.Split(bufio.ScanWords)
}

const (
	N = 505
	M = 998244353
)

var (
	a [N]int
	f [N][N]int
)

func main() {
	defer out.Flush()
	n := Read()
	for i := 1; i <= n; i++ {
		if ReadSign() {
			a[i] = Read()
		}
	}
	s := 0
	for k := 1; k <= n; k++ {
		if a[k] == 0 {
			continue
		}
		for i := 0; i <= n; i++ {
			for j := 0; j <= n; j++ {
				f[i][j] = 0
			}
		}
		f[0][0] = 1
		for i := 1; i <= n; i++ {
			if a[i] == 0 {
				if i < k {
					f[i][0] = (f[i][0] + f[i-1][0]) % M
				}
				for j := 0; j <= i; j++ {
					f[i][j] = (f[i][j] + f[i-1][j+1]) % M
				}
			} else if a[i] < a[k] || a[i] == a[k] && i < k {
				for j := 1; j <= i; j++ {
					f[i][j] = (f[i][j] + f[i-1][j-1]) % M
				}
			} else {
				for j := 0; j <= i; j++ {
					f[i][j] = (f[i][j] + f[i-1][j]) % M
				}
			}
			if i != k {
				for j := 0; j <= i; j++ {
					f[i][j] = (f[i][j] + f[i-1][j]) % M
				}
			}
		}
		for i := 0; i <= n; i++ {
			s = (s + int((int64(f[n][i])*int64(a[k]))%M)) % M
		}
	}
	Fprintln(out, s)
}

package main

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

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

	var buf bytes.Buffer

	tc := 1

	for tc > 0 {
		tc--
		n := readNum(reader)
		S := make([]string, n)
		for i := 0; i < n; i++ {
			S[i], _ = reader.ReadString('\n')
		}
		res := solve(n, S)
		buf.WriteString(fmt.Sprintf("%d\n", res))
	}

	fmt.Print(buf.String())
}

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

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

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

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

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

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

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

	return i
}

const MOD = 998244353

func solve(n int, S []string) int {
	a := make([]int, n+1)
	for i := 0; i < n; i++ {
		if S[i][0] == '+' {
			readInt([]byte(S[i]), 2, &a[i+1])
		}
	}

	var ans int64

	f := make([][]int64, n+2)
	for i := 0; i <= n+1; i++ {
		f[i] = make([]int64, n+2)
	}

	for t := 1; t <= n; t++ {
		if a[t] == 0 {
			continue
		}
		for i := 0; i <= n+1; i++ {
			for j := 0; j <= n+1; j++ {
				f[i][j] = 0
			}
		}
		f[0][0] = 1
		for i := 1; i <= n; i++ {
			for j := 0; j <= i; j++ {
				if a[i] == 0 {
					// a minus
					if i <= t || j > 0 {
						f[i][max(j-1, 0)] = modAdd(f[i][max(j-1, 0)], f[i-1][j])
					}
				} else {
					if a[i] < a[t] || (a[i] == a[t] && i < t) {
						f[i][j+1] = modAdd(f[i][j+1], f[i-1][j])
					} else {
						f[i][j] = modAdd(f[i][j], f[i-1][j])
					}
				}

				if i != t {
					f[i][j] = modAdd(f[i][j], f[i-1][j])
				}
			}
		}

		for i := 0; i <= n; i++ {
			ans = modAdd(ans, f[n][i]*int64(a[t])%MOD)
		}
	}

	return int(ans)
}

func modAdd(a, b int64) int64 {
	a += b
	if a >= MOD {
		a -= MOD
	}
	return a
}

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

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1542D(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	const mod = 998244353

	var n int
	var op string
	Fscan(in, &n)
	a := make([]int64, n+1)
	for i := 1; i <= n; i++ {
		if Fscan(in, &op); op == "+" {
			Fscan(in, &a[i])
		}
	}

	ans := int64(0)
	for p := 1; p <= n; p++ {
		v := a[p]
		if v == 0 {
			continue
		}
		dp := make([][]int, n+1)
		for i := range dp {
			dp[i] = make([]int, n+2)
		}
		dp[0][0] = 1
		for i := 1; i <= n; i++ {
			w := a[i]
			for j := 0; j <= n; j++ {
				if w == 0 {
					if j > 0 || i <= p {
						dp[i][max(j-1, 0)] = (dp[i][max(j-1, 0)] + dp[i-1][j]) % mod
					}
				} else if w < v || w == v && i < p {
					dp[i][j+1] = (dp[i][j+1] + dp[i-1][j]) % mod
				} else {
					dp[i][j] = (dp[i][j] + dp[i-1][j]) % mod
				}
				if i != p {
					dp[i][j] = (dp[i][j] + dp[i-1][j]) % mod
				}
			}
		}
		s := int64(0)
		for _, fv := range dp[n] {
			s += int64(fv)
		}
		ans = (ans + s%mod*v) % mod
	}
	Fprint(out, ans)
}

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

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

package main

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

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

func Read() int {
	in.Scan()
	r := 0
	for _, v := range in.Bytes() {
		r = r*10 + int(v-'0')
	}
	return r
}

func ReadSign() bool {
	in.Scan()
	if in.Bytes()[0] == '-' {
		return false
	}
	return true
}

func init() {
	const MaxInt = int(^uint(0) >> 1)
	in.Buffer(make([]byte, 1<<12), MaxInt)
	in.Split(bufio.ScanWords)
}

const (
	N = 505
	M = 998244353
)

var (
	a [N]int
	f [N][N]int
)

func main() {
	defer out.Flush()
	n := Read()
	for i := 1; i <= n; i++ {
		if ReadSign() {
			a[i] = Read()
		}
	}
	s := 0
	for k := 0; k < n; k++ {
		if a[k] == 0 {
			continue
		}
		for i := 0; i <= n; i++ {
			for j := 0; j <= n; j++ {
				f[i][j] = 0
			}
		}
		f[0][0] = 1
		for i := 1; i <= n; i++ {
			if a[i] == 0 {
				if i < k {
					f[i][0] = (f[i][0] + f[i-1][0]) % M
				}
				for j := 0; j <= i; j++ {
					f[i][j] = (f[i][j] + f[i-1][j+1]) % M
				}
			} else if a[i] < a[k] || a[i] == a[k] && i < k {
				for j := 1; j <= i; j++ {
					f[i][j] = (f[i][j] + f[i-1][j-1]) % M
				}
			} else {
				for j := 0; j <= i; j++ {
					f[i][j] = (f[i][j] + f[i-1][j]) % M
				}
			}
			if i != k {
				for j := 0; j <= i; j++ {
					f[i][j] = (f[i][j] + f[i-1][j]) % M
				}
			}
		}
		for i := 0; i <= n; i++ {
			s = (s + int((int64(f[n][i])*int64(a[k]))%int64(M))) % M
		}
	}
	Fprintln(out, s)
}

package main

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

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

func Read() int {
	in.Scan()
	r := 0
	for _, v := range in.Bytes() {
		r = r*10 + int(v-'0')
	}
	return r
}

func ReadSign() bool {
	in.Scan()
	if in.Bytes()[0] == '-' {
		return false
	}
	return true
}

func init() {
	const MaxInt = int(^uint(0) >> 1)
	in.Buffer(make([]byte, 1<<12), MaxInt)
	in.Split(bufio.ScanWords)
}

const (
	N = 505
	M = 998244353
)

var (
	a [N]int
	f [N][N]int
)

func main() {
	defer out.Flush()
	n := Read()
	for i := 1; i <= n; i++ {
		if ReadSign() {
			a[i] = Read()
		}
	}
	s := 0
	for k := 0; k < n; k++ {
		if a[k] == 0 {
			continue
		}
		for i := 0; i <= n; i++ {
			for j := 0; j <= n; j++ {
				f[i][j] = 0
			}
		}
		f[0][0] = 1
		for i := 1; i <= n; i++ {
			if a[i] == 0 {
				if i < k {
					f[i][0] = (f[i][0] + f[i-1][0]) % M
				}
				for j := 0; j <= i; j++ {
					f[i][j] = (f[i][j] + f[i-1][j+1]) % M
				}
			} else if a[i] < a[k] || a[i] == a[k] && i < k {
				for j := 1; j <= i; j++ {
					f[i][j] = (f[i][j] + f[i-1][j-1]) % M
				}
			} else {
				for j := 0; j <= i; j++ {
					f[i][j] = (f[i][j] + f[i-1][j]) % M
				}
			}
			if i != k {
				for j := 0; j <= i; j++ {
					f[i][j] = (f[i][j] + f[i-1][j]) % M
				}
			}
		}
		for i := 0; i <= n; i++ {
			s = (s + int((int64(f[n][i])*int64(a[k]))%M)) % M
		}
	}
	Fprintln(out, s)
}

package main

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

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

	var buf bytes.Buffer

	tc := readNum(reader)

	for tc > 0 {
		tc--
		n := readNum(reader)
		S := make([]string, n)
		for i := 0; i < n; i++ {
			S[i], _ = reader.ReadString('\n')
		}
		res := solve(n, S)
		buf.WriteString(fmt.Sprintf("%d\n", res))
	}

	fmt.Print(buf.String())
}

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

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

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

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

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

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

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

	return i
}

const MOD = 998244353

func solve(n int, S []string) int {
	a := make([]int, n+1)
	for i := 0; i < n; i++ {
		if S[i][0] == '+' {
			readInt([]byte(S[i]), 2, &a[i+1])
		}
	}

	var ans int64

	f := make([][]int64, n+2)
	for i := 0; i <= n+1; i++ {
		f[i] = make([]int64, n+2)
	}

	for t := 1; t <= n; t++ {
		if a[t] == 0 {
			continue
		}
		for i := 0; i <= n+1; i++ {
			for j := 0; j <= n+1; j++ {
				f[i][j] = 0
			}
		}
		f[0][0] = 1
		for i := 1; i <= n; i++ {
			for j := 0; j <= i; j++ {
				if a[i] == 0 {
					// a minus
					if i <= t || j > 0 {
						f[i][max(j-1, 0)] = modAdd(f[i][max(j-1, 0)], f[i-1][j])
					}
				} else {
					if a[i] < a[t] || (a[i] == a[t] && i < t) {
						f[i][j+1] = modAdd(f[i][j+1], f[i-1][j])
					} else {
						f[i][j] = modAdd(f[i][j], f[i-1][j])
					}
				}

				if i != t {
					f[i][j] = modAdd(f[i][j], f[i-1][j])
				}
			}
		}

		for i := 0; i <= n; i++ {
			ans = modAdd(ans, f[n][i]*int64(a[t])%MOD)
		}
	}

	return int(ans)
}

func modAdd(a, b int64) int64 {
	a += b
	if a >= MOD {
		a -= MOD
	}
	return a
}

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

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1542D(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	const mod = 998244353

	var n int
	var op string
	Fscan(in, &n)
	a := make([]int64, n+1)
	for i := 1; i <= n; i++ {
		if Fscan(in, &op); op == "+" {
			Fscan(in, &a[i])
		}
	}

	ans := int64(0)
	for p := 1; p <= n; p++ {
		v := a[p]
		if v == 0 {
			continue
		}
		dp := make([][]int, n+1)
		for i := range dp {
			dp[i] = make([]int, n+2)
		}
		dp[0][0] = 1
		for i := 1; i <= n; i++ {
			w := a[i]
			for j := 0; j <= n; j++ {
				if w == 0 {
					if j > 0 || i <= p {
						dp[i][max(j-1, 0)] = (dp[i][max(j-1, 0)] + dp[i-1][j]) % mod
					}
				} else if w < v || w == v && i < p {
					dp[i][j+1] = (dp[i][j+1] + dp[i-1][j]) % mod
				} else {
					dp[i][j] = (dp[i][j] + dp[i-1][j]) % mod
				}
				if i != p {
					dp[i][j] = (dp[i][j] + dp[i-1][j]) % mod
				}
			}
		}
		s := int64(0)
		for _, fv := range dp[n] {
			s += int64(fv)
		}
		ans = (ans + s*v) % mod
	}
	Fprint(out, ans)
}

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

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


package main

import "fmt"

func main() {
    var n,m int
    var s [105]string
    var max [105]byte
    fmt.Scan(&n,&m)
    for i := 0; i < n; i++ {
        fmt.Scan(&s[i])
        for j := 0; j < m; j++ {
            if max[j] < s[i][j] { max[j] = s[i][j] }
        }
    }
    ans := 0
    for i := 0; i < n; i++ {
        success := false
        for j := 0; j < m; j++ {
            if s[i][j] == max[j] { success = true; break }
        }
        if success { ans++ }
    }
    fmt.Println(ans)
}

package main

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

func main() {
	var n, m int
	if _, err := fmt.Scanf("%d %d\n", &n, &m); err != nil {
		return
	}

	success := 0
	bests := make([]int, m)
	gradebook := make([][]int, n)

	reader := bufio.NewReader(os.Stdin)
	re := regexp.MustCompile(`\r?\n`)
	for i := 0; i < n; i++ {
		if s, err := reader.ReadString('\n'); err != nil {
			if err == io.EOF {
				break
			} else {
				return
			}
		} else {
			s = re.ReplaceAllString(s, "")

			gradebook[i] = make([]int, m)
			for j := 0; j < m; j++ {
				g := int(s[j] - '0')
				gradebook[i][j] = g
				if bests[j] < g {
					bests[j] = g
				}
			}
		}
	}

	for i := 0; i < n; i++ {
		for j := 0; j < m; j++ {
			if gradebook[i][j] == bests[j] {
				success++
				break
			}
		}
	}

	fmt.Println(success)
}

package main

import "fmt"

func main() {
    var n,m int      // membuat variabel n dan m dengan jenis int
    var s [105]string  // membuat variabel s dengan array berjumlah 105 dan berjenis string
    var max [105]byte   // membuat variabel max dengan array berjumlah 105 dan berjenis byte
    fmt.Scan(&n,&m)   // mengambil input
    for i := 0; i < n; i++ {   // looping
        fmt.Scan(&s[i])    // mengambil input kedua
        for j := 0; j < m; j++ {   // looping kedua
            if max[j] < s[i][j] { max[j] = s[i][j] }  // jika array max elemen ke j kurang dari array s elemen i dan j,maka array max elemen ke j sama dengan s array elemen i dan j
        }
    }
    ans := 0    // membuat variabel ans dan kemudian diisi dengan 0
    for i := 0; i < n; i++ {  // looping kedua
        success := false   // membuat variabel succes dan kemudian diisi dengan false
        for j := 0; j < m; j++ {   // looping ketiga
            if s[i][j] == max[j] { success = true; break }  // jika array s elemen i dan j sama dengan array max elemen j maka success sama dengan true kemudian keluar dari fungsi
        }
        if success { ans++ }  // jika success maka ans di tambah
    }
    fmt.Println(ans)    // cetak hasil
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var std, sbj int
	fmt.Fscan(reader, &std, &sbj)

	scss := make(map[int]bool)
	stds := make([]string, std)
	for i := 0; i < std; i++ {
		fmt.Fscan(reader, &stds[i])
	}

	for i := 0; i < sbj; i++ {
		mx, scs := 0, []int{}
		for j := 0; j < std; j++ {
			no, _ := strconv.Atoi(string(stds[j][i]))
			if no > mx {
				mx = no
				scs = nil
				scs = append(scs, j)
			}
			if no == mx {
				scs = append(scs, j)
			}

		}

		for _, x := range scs {
			scss[x] = true
		}
	}

	fmt.Println(len(scss))
}


package main

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

func main() {
	buf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanf(buf, "%d\n", &n)
	fmt.Printf("%d\n",n)
	for i := 0; i < n; i++ {
		fmt.Printf("1 ")
	}
	fmt.Printf("\n")
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	n := 0
	fmt.Fscanf(in, "%d\n", &n)
	fmt.Fprintf(out, "%d\n", n)
	for i := 0; i < n-1; i++ {
		fmt.Fprintf(out, "1 ")
	}
	fmt.Fprintf(out, "1\n")
	return
}

package main

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

func min(a,b int)int {
    var res int
    if a<b {
        res=a
    } else {
        res=b;
    }
    return res;
}

func solve(){
    var n,i int
    n=readInt()
    fmt.Println(n)
    for i=0;i<n;i++{
        fmt.Print("1 ")
    }
    fmt.Println("")
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}
func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

package main

import "fmt"

func main(){

	var n int32
	var i int32 = 1

	fmt.Scanf("%d",&n)

	fmt.Println(n)

	for i<=n {
		fmt.Print(1," ")
		i++
	}

}

package main

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

func main() {
	s := bufio.NewScanner(os.Stdin)
	s.Scan()
	k, _ := strconv.Atoi(s.Text())

	isDivisible := false
	divDigit := 1
	switch {

	case k%9 == 0:
		isDivisible = true
		divDigit = 9
	case k%8 == 0:
		isDivisible = true
		divDigit = 8
	case k%7 == 0:
		isDivisible = true
		divDigit = 7
	case k%6 == 0:
		isDivisible = true
		divDigit = 6
	case k%5 == 0:
		isDivisible = true
		divDigit = 5
	case k%4 == 0:
		isDivisible = true
		divDigit = 4
	case k%3 == 0:
		isDivisible = true
		divDigit = 3
	case k%2 == 0:
		isDivisible = true
		divDigit = 2
	default:
		isDivisible = true
		divDigit = 1
	}

	count := k/divDigit
	if isDivisible {
		fmt.Println(count)
	//} else {
		//fmt.Println(count+1)
		//fmt.Printf("%d ", k%divDigit)
	}
	for i:=0; i< count ; i++  {
		fmt.Printf("%d ", divDigit)
	}
	fmt.Println()
	return

	}

package main

import (
	"fmt"
	"os"
)

func settest() (*os.File, *os.File) {
	f, err := os.Open("a.dat")
	if err != nil {
		panic(err)
	}

	oldStdin := os.Stdin
	os.Stdin = f

	return f, oldStdin
}

func main() {
	/*f, oldStdin := settest()
	defer f.Close()
	defer func() { os.Stdin = oldStdin }()*/

	var n int
	fmt.Scan(&n)

	for k := 9; k > 0; k-- {
		if n%k == 0 {
			p := n/k
			fmt.Println(p)
			for i := 0; i < p; i++ {
				fmt.Printf("%d ", k)
			}
			return
		}
	}
}

package main

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

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

	var n int

	fmt.Fscan(reader, &n)

	fmt.Println(n, "\n"+strings.Repeat("1 ", n))

	return
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	fmt.Println(n)
	for i:= 1; i<= n; i++ {
		fmt.Print("1 ")
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var n int
	fmt.Scan(&n)
	fmt.Print(n, "\n"+strings.Repeat("1 ", n))
}

package main

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

func main() {
	s := bufio.NewScanner(os.Stdin)
	s.Scan()
	k, _ := strconv.Atoi(s.Text())

	if k < 10 {
		fmt.Println("1")
		fmt.Println(k)
		return
	}
	isDivisible := false
	divDigit := 1
	switch {

	case k%9 == 0:
		isDivisible = true
		divDigit = 9
	case k%8 == 0:
		isDivisible = true
		divDigit = 8
	case k%7 == 0:
		isDivisible = true
		divDigit = 7
	case k%6 == 0:
		isDivisible = true
		divDigit = 6
	case k%5 == 0:
		isDivisible = true
		divDigit = 5
	case k%4 == 0:
		isDivisible = true
		divDigit = 4
	case k%3 == 0:
		isDivisible = true
		divDigit = 3
	case k%2 == 0:
		isDivisible = true
		divDigit = 2
	default:
		divDigit = 9
	}

	count := k/divDigit
	if isDivisible {
		fmt.Println(count)
	} else {
		fmt.Println(count+1)
		fmt.Printf("%d ", k%divDigit)
	}
	for i:=0; i< count ; i++  {
		fmt.Printf("%d ", divDigit)
	}
	fmt.Println()
	return

	}

package main

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

func main() {
	s := bufio.NewScanner(os.Stdin)
	s.Scan()
	k, _ := strconv.Atoi(s.Text())

	isDivisible := false
	divDigit := 1
	switch {

	case k%9 == 0:
		isDivisible = true
		divDigit = 9
	case k%8 == 0:
		isDivisible = true
		divDigit = 8
	case k%7 == 0:
		isDivisible = true
		divDigit = 7
	case k%6 == 0:
		isDivisible = true
		divDigit = 6
	case k%5 == 0:
		isDivisible = true
		divDigit = 5
	case k%4 == 0:
		isDivisible = true
		divDigit = 4
	case k%3 == 0:
		isDivisible = true
		divDigit = 3
	case k%2 == 0:
		isDivisible = true
		divDigit = 2
	default:
		isDivisible = true
		divDigit = 1
	}

	count := k/divDigit
	if isDivisible {
		fmt.Println(count)
	//} else {
		//fmt.Println(count+1)
		fmt.Printf("%d ", k%divDigit)
	}
	for i:=0; i< count ; i++  {
		fmt.Printf("%d ", divDigit)
	}
	fmt.Println()
	return

	}


package main

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

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

func (in *CF1551A) 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 *CF1551A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

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

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

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

/**
 Run solve the problem CF1551A
 Date: 18/08/21
 User: pepradere
 URL: https://codeforces.com/problemset/problem/1551/A
 Problem: CF1551A
**/
func (in *CF1551A) Run() {
	t := in.NextInt()
	for ; t > 0; t-- {
		n := in.NextInt()
		two := int(math.Ceil(float64(n) / 3.0))
		one := int(math.Floor(float64(n) / 3.0))

		if (two * 2) + one != n {
			one, two = two, one
		}
		fmt.Println(one, two)
	}
}

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

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

package main
import (
	"fmt"
)
func main() {
	var x int
	fmt.Scan(&x)
	for i:=0;i<x;i++{
		var n int
		fmt.Scan(&n)
		if n == 0 {
			fmt.Println(0,0)
		} else if n % 3 == 0 {
			fmt.Println(n/3,n/3)
		} else if (float64(n)/3) - float64(int(n/3)) <= 0.34 {
			fmt.Println(int(n/3)+1,int(n/3))
		} else {
			fmt.Println(int(n/3),int(n/3)+1)
		}
	}
}

package main

import "fmt"

func main() {
	var sumOfCases int64
	var value int64
	var num int64
	fmt.Scan(&sumOfCases)
	for i := int64(0); i < sumOfCases; i++ {
		fmt.Scan(&value)
		num = value / 3
		switch value % 3 {
		case 0:
			fmt.Printf("%d %d\n", num, num)
		case 1:
			fmt.Printf("%d %d\n", num+1, num)
		case 2:
			fmt.Printf("%d %d\n", num, num+1)
		}
	}
}

package main

import "fmt"

func main() {
	var sumOfCases int
	var value int
	var num int
	fmt.Scan(&sumOfCases)
	for i := 0; i < sumOfCases; i++ {
		fmt.Scan(&value)
		num = value / 3
		switch value % 3 {
		case 0:
			fmt.Printf("%d %d\n", num, num)
		case 1:
			fmt.Printf("%d %d\n", num+1, num)
		case 2:
			fmt.Printf("%d %d\n", num, num+1)
		}
	}
}

package main

import "fmt"

func main() {
	var sumOfCases int
	var value int
	var subValue int
	var numberOfOne int
	var numberOfTwo int
	fmt.Scan(&sumOfCases)
	for i := 0; i < sumOfCases; i++ {
		fmt.Scan(&value)
		subValue = value / 3
		numberOfOne = subValue
		numberOfTwo = subValue
		sum := numberOfOne + 2*numberOfTwo
		if sum == value {
			fmt.Printf("%d %d\n", numberOfOne, numberOfTwo)
		} else if  (value-sum) == 1 {
			fmt.Printf("%d %d\n", numberOfOne+1, numberOfTwo)
		} else {
			fmt.Printf("%d %d\n", numberOfOne, numberOfTwo+1)
		}

	}
}

package main

import "fmt"

func main() {
	var sumOfCases int64
	var value int64
	var subValue int64
	var numberOfOne int64
	var numberOfTwo int64
	_, err := fmt.Scan(&sumOfCases)
	if err != nil {
		panic(err)
	}
	for i:=int64(0);i<sumOfCases;i++{
		_,err:=fmt.Scan(&value)
		if err != nil {
			return
		}
		subValue=value/3
		numberOfOne=subValue
		numberOfTwo=subValue
		sum:=numberOfOne+2*numberOfTwo
		if sum==value{
			fmt.Printf("%d %d\n",numberOfOne,numberOfTwo)
		}else if sum<value&&(value-sum)==1{
			fmt.Printf("%d %d\n",numberOfOne+1,numberOfTwo)
		}else {
			fmt.Printf("%d %d\n",numberOfOne,numberOfTwo+1)
		}

	}
}

package main

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

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

	var t int
	for Fscan(in, &t); t > 0; t-- {
		var n int
		Fscan(in, &n)
		//var c1, c2 int

		rem := n % 3
		if rem & 0x1 == 0 {
			Fprintln(out, (n-rem)/3, (n-rem)/3 + rem/2)

		} else {
			Fprintln(out, (n-rem)/3 + 1, (n-rem)/3)
		}
	}
}

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

package main

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

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

	var t int
	for Fscan(in, &t); t > 0; t-- {
		var n int
		Fscan(in, &n)
		//var c1, c2 int

		rem := n % 3
		if rem & 0x1 == 0 {
			Fprintln(out, (n-rem)/3, (n-rem)/3 + rem/2)

		} else {
			Fprintln(out, (n-rem)/3 + (rem & 0x1), (n-rem)/3 + rem/2)
		}
	}
}

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

package main

import "fmt"

func solve() (a, b int) {
	var n int
	fmt.Scanf("%d\n", &n)
	if n%3 == 0 {
		return n / 3, n / 3
	}
	if n%3 == 1 {
		return n/3 + 1, n / 3
	}
	return n / 3, n/3 + 1
}

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

package main

import (
	"fmt"
)

func main() {
	var t int
	fmt.Scanf("%v\n", &t)
	for ; t > 0; t-- {
		var n int
		fmt.Scanf("%v\n", &n)
		c1 := n / 3
		c2 := c1
		if n % 3 == 1 {
			c1++
		} else if n % 3 == 2 {
			c2++
		}
		fmt.Println(c1, c2)
	}
}

package main

import "fmt"

func main(){

	var t int64
	fmt.Scanf("%d\n",&t)

	for t>0{
		var n int64
		fmt.Scanf("%d\n", &n)

		var x=n/3
		var rem=n%3

		// fmt.Printf("%d\n",x)
		var c1=x
		var c2=x

		if(rem==1){
			c1++
		}else if(rem==2){
			c2++
		}

		fmt.Printf("%d %d\n", c1,c2)

		t--
	}
}

package main

import "fmt"

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

func run() {
	var a int
	fmt.Scan(&a)
	t := a / 3
	if a%3 == 0 {
		fmt.Println(t, t)
	} else if a%3 == 1 {
		fmt.Println(t+1, t)
	} else {
		fmt.Println(t, t+1)
	}
}

package main

import "fmt"

func dd(a int) {
	n := a / 3
	if a%3 == 0 {
		fmt.Println(n, n)
	} else if a%3 == 1 {
		fmt.Println(n+1, n)
	} else {
		fmt.Println(n, n+1)
	}
}

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

package main

import (
	"fmt"
)

func main() {
	var (
		t  int
		n  int
		c1 int
		c2 int
	)
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		fmt.Scanf("%d\n", &n)
		c1 = n / 3
		c2 = n / 3
		if n%3 == 1 {
			c1++
		}
		if n%3 == 2 {
			c2++
		}
		fmt.Println(c1, c2)
	}
}

// 1551A. Polycarp and Coins
package main

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

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		fmt.Fscan(reader, &n)
		c1, c2 := n/3, n/3
		if n%3 == 1 {
			c1++
		} else if n%3 == 2 {
			c2++
		}
		fmt.Println(c1, c2)

	}
}

package main

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

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

	var t, n int
	for fmt.Fscan(r, &t); t > 0; t-- {
		fmt.Fscan(r, &n)
		if n%3 == 0 {
			fmt.Fprintln(w, n/3, n/3)
		} else {
			switch n % 3 {
			case 1:
				fmt.Fprintln(w, n/3+1, n/3)
			default:
				fmt.Fprintln(w, n/3, n/3+1)
			}
		}
	}
}

package main

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

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

	return n
}

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)

		c2 := n / 3
		c1 := n - (c2 * 2)

		if abs(c2-c1) > 1 {
			c1 -= 2
			c2 += 1
		}
		fmt.Fprintf(out, "%d %d\n", c1, c2)

	}
}

package main

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

func solve() {
	f := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	N, n := 0, int64(0)
	fmt.Fscan(f, &N)
	for i := 0; i < N; i++ {
		fmt.Fscan(f, &n)
		if n%3 == 0 {
			fmt.Fprintln(w, n/3, n/3)
		} else {
			x, y := (n-1)/3, (n+2)/3
			if x+2*y == n {
				fmt.Fprintln(w, x, y)
			} else {
				fmt.Fprintln(w, y, x)
			}
		}
	}
	w.Flush()
}

func main() {
	solve()
}

package main

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

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

	test := parseInt(getString(reader))

	for ; test > 0; test-- {
		n := parseInt(getString(reader))
		if n%3 == 0 {
			writer.WriteString(fmt.Sprintf("%d %d\n", n/3, n/3))
		} else if n%3 == 1 {
			writer.WriteString(fmt.Sprintf("%d %d\n", n/3+1, n/3))
		} else {
			writer.WriteString(fmt.Sprintf("%d %d\n", n/3, n/3+1))
		}
	}
	writer.Flush()
}

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

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

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

package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

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

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

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

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

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

type Noop struct{}

var noop = Noop{}

func proc() {
	n := scanInt()
	a := n / 3
	b := a
	if n%3 == 1 {
		a++
	} else if n%3 == 2 {
		b++
	}
	fmt.Printf("%d %d\n", a, b)
}

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

package main

import (
	"fmt"
)

func solve() {
	n := readInt()
	div := n / 3
	switch n % 3 {
	case 0:
		fmt.Printf("%d %d\n", div, div)
	case 1:
		fmt.Printf("%d %d\n", div+1, div)
	case 2:
		fmt.Printf("%d %d\n", div, div+1)
	}
}

func main() {
	n := readInt()
	for i := 0; i < n; i++ {
		solve()
	}
}

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

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

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

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

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

package main

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

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

func solve(n int) string {
	x := n / 3
	if n%3 == 0 {
		return fmt.Sprintf("%d %d", x, x)
	} else if n%3 == 1 {
		return fmt.Sprintf("%d %d", x+1, x)
	} else {
		return fmt.Sprintf("%d %d", x, x+1)
	}
}

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

package main

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

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

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

	for i := 0; i < n; i++ {
		var k int64
		fmt.Fscan(r, &k)
		var res1, res2 int64
		res1 = k / 3
		res2 = res1
		remainder := k % 3
		if remainder  == 1 {
			res1 += 1
		} else if remainder == 2 {
			res2 += 1
		}
		fmt.Printf("%d %d\n", res1, res2)
	}
}

package main

import "fmt"

func main() {
	var t,  n int
	var a,b int
	for fmt.Scanln(&t); t > 0; t-- {
		fmt.Scanln(&n)
		switch n % 3 {
		case 0:
			a = n/3
			b=n/3
		case 1:
			a=n/3+1
			b = n/3
		case 2:
			a = n/3
			b = n/3+1
		}
		fmt.Println(a, b)
	}
}

package main

import (
    "fmt"
)

func main() {
    var testCases int
    fmt.Scan(&testCases)
    c1, c2 := 0, 0

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

        remainder := number % 3
        part := number / 3
        if remainder == 2 {
            c2 = part + 1
            c1 = part
        } else {
            c1 = part + remainder
            c2 = part
        }
        fmt.Printf("%d %d\n", c1, c2)
    }
}

package main

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

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

	for tc > 0 {
		tc--
		n := readNum(reader)
		a, b := solve(n)
		buf.WriteString(fmt.Sprintf("%d %d\n", a, b))
	}
	fmt.Print(buf.String())
}

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

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

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

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

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

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

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

	return i
}
func solve(n int) (int, int) {
	r := n % 3
	x := n / 3
	if r == 0 {
		return x, x
	}
	if r == 1 {
		return x + 1, x
	}
	return x, x + 1
}

package main

import (
	"fmt"
)

func main() {
	var testcases int16
	fmt.Scanf("%d\n", &testcases)
	for ; testcases > 0; testcases -= 1 {
		var n int32
		fmt.Scanf("%d\n", &n)
		switch mod3 := n % 3; mod3 {
		case 0:
			res := n / 3
			fmt.Printf("%d %d\n", res, res)
		case 1:
			res := n / 3
			fmt.Printf("%d %d\n", res+1, res)
		case 2:
			res := n / 3
			fmt.Printf("%d %d\n", res, res+1)
		}
	}
}

package main
import ("fmt")

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

	for i:=0;i<n;i++ {
		fmt.Scan(&a)
		k=a/3
		if (k)+2*(k)==a{
			fmt.Println(k,k)
		} else {
			if (k+1)+2*k ==a{
				fmt.Println(k+1,k)
			} else {
				fmt.Println(k,k+1)
			}
		}
	}
}

package main

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

type ProblemOutput struct {
	c1 int32
	c2 int32
}

func solve(n int32) ProblemOutput {
	coins := n / 3
	output := ProblemOutput{c1: coins, c2: coins}
	if n-coins*3 == 2 {
		output.c2++
	}
	if n-coins*3 == 1 {
		output.c1++
	}
	return output
}

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

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

		output := solve(n)
		fmt.Fprintf(out, "%d %d\n", output.c1, output.c2)
		out.Flush()
		tt--
	}
}

package main

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

func solve(i int)  {
	x := i / 3
	if i % 3 == 0 {
		fmt.Printf("%d %d\n", x, x)
	} else if i % 3 == 1 {
		fmt.Printf("%d %d\n", x + 1, x)
	} else {
		fmt.Printf("%d %d\n", x, x + 1)
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	i := 0
	for scanner.Scan() {
		t := scanner.Text()
		if i == 0 {
			i++
			continue
		}
		i++
		if len(t) == 0 {
			break
		}
		cur, _ := strconv.Atoi(t)

		solve(cur)
	}
}

package main

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

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

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

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

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

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

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

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

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

		}
		return initial
	}
}

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

	}
	return m
}

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

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

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

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

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

	return
}

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

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

	return num
}

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

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

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

		if n%3 == 0 {
			fmt.Println(n / 3)
			fmt.Println(n / 3)
		}
		if n%3 == 1 {
			fmt.Println(int64(n/3) + 1)
			fmt.Println(int64(n / 3))
		}
		if n%3 == 2 {
			fmt.Println(int64(n / 3))
			fmt.Println(int64(n/3) + 1)
		}

	}

}

package main

import (
	"fmt"
)

func main() {

	var (
		n   int
		num int64
	)
	fmt.Scan(&n)
	for n > 0 {
		n--
		fmt.Scan(&num)
		c1 := num / 3
		p := num % 3
		if p == 1 {
			fmt.Println(c1+1, c1)
		} else if p == 2 {
			fmt.Println(c1, c1+1)
		} else {
			fmt.Println(c1, c1)
		}
	}

}

package main

import "fmt"

func add(a, b int) int {
	c := a + b
	return c
}
func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for ; t > 0; t-- {
		var n int
		fmt.Scanf("%d\n", &n)
		if n%3 == 0 {
			fmt.Printf("%d %d\n", n/3, n/3)
		} else if n%3 == 1 {
			fmt.Printf("%d %d\n", (n-1)/3+1, (n-1)/3)
		} else {
			fmt.Printf("%d %d\n", (n-2)/3, (n-2)/3+1)
		}
	}
}

package main

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

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

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

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

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

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

		}
		return initial
	}
}

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

	}
	return m
}

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

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

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

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

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

	return
}

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

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

	return num
}

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

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

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 int64

		fmt.Fscan(input, &n)
		if n%3 == 0 {
			fmt.Println(n/3, n/3)
		} else if n%3 == 1 {
			fmt.Println(n/3+1, n/3)
		} else {
			fmt.Println(n/3, n/3+1)
		}
	}
}

package main

import "fmt"

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

	var a []int
	for i := 0; i < n; i++ {
		var b int
		fmt.Scanf("%d\n", &b)
		a = append(a, b)
	}
	for _, v := range a {
		switch v % 3 {
		case 0:
			fmt.Printf("%d %d\n", v/3, v/3)
		case 1:
			fmt.Printf("%d %d\n", v/3+1, v/3)
		case 2:
			fmt.Printf("%d %d\n", v/3, v/3+1)
		}
	}
}

package main

import "fmt"

var (
	t int
	n int
)

func main() {
	fmt.Scanln(&t)
	for i := 0; i < t; i++ {
		fmt.Scanln(&n)
		c := n / 3
		c1, c2 := c, c
		if n % 3 == 1 {
			c1 += 1
		}
		if n % 3 == 2 {
			c2 += 1
		}
		fmt.Println(c1, c2)
	}
}

package main

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

type Scanner struct {
	*bufio.Scanner
}

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

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

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

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

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

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

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

	for i := 0; i < tests; i += 1 {
		n := stdin.Int()
		switch n%3 {
		case 0:
			fmt.Println(n / 3, n / 3)
		case 1:
			fmt.Println(n / 3 + 1, n / 3)
		case 2:
			fmt.Println(n / 3, n / 3 + 1)
		}
	}
}

/*
 * Created by Reverie
 * 2021.07.23
 * 22:37:08
 */

package main

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

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

	solve := func(Case int) {
		var n int
		Fscan(in, &n)

		x, y := n/3, n/3
		if n%3 == 1 {
			x++
		} else if n%3 == 2 {
			y++
		}

		Fprintf(out, "%d %d\n", x, y)
	}

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

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 n ,a1,a2 int
		Fscan(in, &n)
		minD := int(1e9)
		for c1 :=max( n/3-10,0); c1 < n/3+10; c1++ {
			if (n-c1)&1==0 && c1 <= n {
				c2 := (n-c1)/2
				if d := abs(c1-c2);d<minD {
					minD =d
					a1,a2 = c1,c2
				}
			}
		}
		Fprintln(out, a1,a2)
	}

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

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

func main() { run(os.Stdin, os.Stdout) }
func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

package main

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

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

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

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

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

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

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

func main() {
	defer writer.Flush()
	for t := _int(); t > 0; t-- {
		n := _int64()
		c1, c2 := sol(n)
		printf("%d %d\n", c1, c2)
	}
}

func sol(n int64) (int64, int64) {
	c1, c2 := n/3, n/3
	rem := n % 3
	if rem == 0 {
		return c1, c2
	}
	if rem == 1 {
		return c1 + 1, c2
	}
	return c1, c2 + 1
}

package main
import (
	"fmt"
)
func main() {
	var x int
	fmt.Scan(&x)
	for i:=0;i<x;i++{
		var n int
		fmt.Scan(&n)
		if n == 0 {
			fmt.Println(0,0)
		} else if n == 1 {
			fmt.Println(1,0)
		} else if n == 4 {
			fmt.Println(1,1)
		} else if n % 3 == 0 {
			fmt.Println(n/3,n/3)
		} else if (float64(n)/3) - float64(int(n/3)) <= 0.34 {
			fmt.Println(int(n/3)+1,int(n/3))
		} else {
			fmt.Println(int(n/3),int(n/3)+1)
		}
	}
}

package main
import (
	"fmt"
)
func main() {
	var x int
	fmt.Scan(&x)
	for i:=0;i<x;i++{
		var n int
		fmt.Scan(&n)
		if n == 0 {
			fmt.Println(0,0)
		} else if n == 1 {
			fmt.Println(1,0)
		} else if n % 3 == 0 {
			fmt.Println(n/3,n/3)
		} else if n % 10 == 0 || n % 7 == 0 {
			fmt.Println(int(n/3)+1,int(n/3))
		} else {
			fmt.Println(int(n/3),int(n/3)+1)
		}
	}
}

package main

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

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

	var t int
	for Fscan(in, &t); t > 0; t-- {
		var n int
		Fscan(in, &n)
		//var c1, c2 int

		rem := n % 3
		if rem & 0x1 == 0 {
			Fprintln(out, (n-rem)/3, (n-rem)/3 + 1)

		} else {
			Fprintln(out, (n-rem)/3 + 1, (n-rem)/3)
		}
	}
}

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

package main

import "fmt"

func solve() (a, b int) {
	var n int
	fmt.Scanf("%d", &n)
	if n%3 == 0 {
		return n / 3, n / 3
	}
	if n%3 == 1 {
		return n/3 + 1, n / 3
	}
	return n / 3, n/3 + 1
}

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

package main

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

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

func (in *CF1551A) 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 *CF1551A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

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

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

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

/**
 Run solve the problem CF1551A
 Date: 18/08/21
 User: pepradere
 URL: https://codeforces.com/problemset/problem/1551/A
 Problem: CF1551A
**/
func (in *CF1551A) Run() {
	t := in.NextInt()
	for ; t > 0; t-- {
		n := in.NextInt()
		two := int(math.Floor(float64(n) / 3.0))
		one := int(math.Ceil(float64(n) / 3.0))
		fmt.Println(one, two)
	}
}

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

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

package main

import (
	"fmt"
)

func main() {
	var t int
	fmt.Scanf("%v", &t)
	for ; t > 0; t-- {
		var n int
		fmt.Scanf("%v", &n)
		c1 := n / 3
		c2 := c1
		if n % 3 == 1 {
			c1++
		} else if n % 3 == 2 {
			c2++
		}
		fmt.Println(c1, c2)
	}
}

package main

import "fmt"

func main(){

	var t int64
	fmt.Scanf("%d",&t)

	for t>0{
		var n int64
		fmt.Scanf("%d", &n)

		var x=n/3
		var rem=n%3

		// fmt.Printf("%d\n",x)
		var c1=x
		var c2=x

		if(rem==1){
			c1++
		}else if(rem==2){
			c2++
		}

		fmt.Printf("%d %d\n", c1,c2)

		t--
	}
}

package main

import "fmt"

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

func run() {
	var a int
	fmt.Scan(&a)
	t := a / 3
	if a%3 == 0 {
		fmt.Println(t, t)
	} else if a%3 == 1 {
		fmt.Print(t+1, t)
	} else {
		fmt.Println(t, t+1)
	}
}

package main

import "fmt"

func dd(a int) {
	n := a / 3
	if a%3 == 0 {
		fmt.Println(n, n)
	} else if a%3 == 1 {
		fmt.Println(n+1, n)
	} else {
		fmt.Println(n, n+1)
	}
}

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


package main

import "fmt"

type unionFind struct {
	id [110]int
	sz [110]int
}

func (uf *unionFind) init() {
	for i := 0; i < 110; i++ {
		uf.id[i] = i
		uf.sz[i] = 1
	}
}

func (uf *unionFind) root(i int) int {
	for i != uf.id[i] {
		uf.id[i] = uf.id[uf.id[i]]
		i = uf.id[i]
	}
	return i
}

func (uf *unionFind) find(p, q int) bool {
	return uf.root(p) == uf.root(q)
}

func (uf *unionFind) union(p, q int) {
	i, j := uf.root(p), uf.root(q)
	if uf.sz[i] < uf.sz[j] {
		uf.id[i] = j
		uf.sz[j] += uf.sz[i]
	} else {
		uf.id[j] = i
		uf.sz[i] += uf.sz[j]
	}
}

func main() {
	var n, m, q, u, v int
	fmt.Scan(&n, &m)
	var uf [110]unionFind
	for i := 0; i < 110; i++ {
		uf[i].init()
	}
	for i := 0; i < m; i++ {
		var a, b, c int
		fmt.Scan(&a, &b, &c)
		uf[c].union(a, b)
	}
	fmt.Scan(&q)
	for i := 0; i < q; i++ {
		fmt.Scan(&u, &v)
		z := 0
		for j := 1; j <= m; j++ {
			if uf[j].find(u, v) {
				z++
			}
		}
		fmt.Println(z)
	}
}

package main

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

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

type Edge struct {
  V, Color int
}

var seen []bool
var edges [][]Edge

func seek(a, b, c int) bool {
  if a == b {
    return true
  }
  if seen[a] {
    return false
  }
  seen[a] = true
  for _, edge := range edges[a] {
    if edge.Color == c && seek(edge.V, b, c) {
      return true
    }
  }
  return false
}

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

  n, m := scanInt(scanner), scanInt(scanner)
  edges = make([][]Edge, n+1)
  for u := 1; u <= n; u++ {
    edges[u] = []Edge{}
  }
  for i := 0; i < m; i++ {
    a, b, c := scanInt(scanner), scanInt(scanner), scanInt(scanner)
    edges[a] = append(edges[a], Edge{ b, c })
    edges[b] = append(edges[b], Edge{ a, c })
  }
  q := scanInt(scanner)
  for i := 0; i < q; i++ {
    a, b := scanInt(scanner), scanInt(scanner)
    count := 0
    for c := 1; c <= m; c++ {
      seen = make([]bool, n+1)
      if seek(a, b, c) {
        count++
      }
    }
    writer.WriteString(fmt.Sprintf("%d\n", count))
  }
}

package main

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

func solve() {
	n := readInt()
	m := readInt()
	g := make([][][]int, m)
	gExists := make([]bool, m)
	for i := 0; i < m; i++ {
		u := readInt() - 1
		v := readInt() - 1
		c := readInt() - 1
		if !gExists[c] {
			gExists[c] = true
			g[c] = make([][]int, n)
			for j := 0; j < n; j++ {
				g[c][j] = make([]int, 0)
			}
		}
		g[c][u] = append(g[c][u], v)
		g[c][v] = append(g[c][v], u)
	}
	vis := make([][]int, m)
	color := 0
	for i := 0; i < m; i++ {
		if gExists[i] {
			vis[i] = make([]int, n)
			for j := 0; j < n; j++ {
				if vis[i][j] == 0 && len(g[i][j]) > 0 {
					color++
					dfs(vis[i], g[i], j, color)
				}
			}
		}
	}
	t := readInt()
	for i := 0; i < t; i++ {
		u := readInt() - 1
		v := readInt() - 1
		ans := 0
		for j := 0; j < m; j++ {
			if gExists[j] {
				if vis[j][u] > 0 && vis[j][u] == vis[j][v] {
					ans++
				}
			}
		}
		fmt.Println(ans)
	}
}

func dfs(vis []int, g [][]int, u int, color int) {
	vis[u] = color
	for _, v := range g[u] {
		if vis[v] == 0 {
			dfs(vis, g, v, color)
		}
	}
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

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

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

// IO

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

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

func readInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		res[i] = readInt64()
	}
	return res
}

package main

import "fmt"

const ufMax = 110

type unionFind struct {
	id [ufMax]int
	sz [ufMax]int
}

func (uf *unionFind) init() {
	for i := 0; i < ufMax; i++ {
		uf.id[i] = i
		uf.sz[i] = 1
	}
}

func (uf *unionFind) root(i int) int {
	for i != uf.id[i] {
		uf.id[i] = uf.id[uf.id[i]]
		i = uf.id[i]
	}
	return i
}

func (uf *unionFind) find(p, q int) bool {
	return uf.root(p) == uf.root(q)
}

func (uf *unionFind) union(p, q int) {
	i, j := uf.root(p), uf.root(q)
	if uf.sz[i] < uf.sz[j] {
		uf.id[i] = j
		uf.sz[j] += uf.sz[i]
	} else {
		uf.id[j] = i
		uf.sz[i] += uf.sz[j]
	}
}

func main() {
	var n, m, q, u, v int
	fmt.Scan(&n, &m)
	var uf [110]unionFind
	for i := 0; i < 110; i++ {
		uf[i].init()
	}
	for i := 0; i < m; i++ {
		var a, b, c int
		fmt.Scan(&a, &b, &c)
		uf[c].union(a, b)
	}
	fmt.Scan(&q)
	for i := 0; i < q; i++ {
		fmt.Scan(&u, &v)
		z := 0
		for j := 1; j <= m; j++ {
			if uf[j].find(u, v) {
				z++
			}
		}
		fmt.Println(z)
	}
}

package main

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

func solve() {
	n := readInt()
	m := readInt()
	forbidden := make(map[int]map[int]bool)
	for i := 0; i < n; i++ {
		forbidden[i] = make(map[int]bool)
	}
	for i := 0; i < m; i++ {
		u := readInt() - 1
		v := readInt() - 1
		if v < u {
			u, v = v, u
		}
		forbidden[u][v] = true
		forbidden[v][u] = true
	}
	id := make([]int, n)
	for i := 0; i < n; i++ {
		id[i] = i
	}
	sort.Slice(id, func(i, j int) bool {
		if len(forbidden[id[i]]) == len(forbidden[id[j]]) {
			return id[i] < id[j]
		}
		return len(forbidden[id[i]]) < len(forbidden[id[j]])
	})
	bestIndex := id[0]
	fmt.Println(n - 1)
	for j := 0; j < n; j++ {
		if j != bestIndex {
			fmt.Println(bestIndex + 1, j + 1)
		}
	}
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

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

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

// IO

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

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

func readInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		res[i] = readInt64()
	}
	return res
}


package main

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

var N, M int
var deg = map[int]int{}
var dp [1010][1010][2]int
var A []int

func init() {
	for i := 0; i < 1010; i++ {
		for j := 0; j < 1010; j++ {
			for k := 0; k < 2; k++ {
				dp[i][j][k] = -1
			}
		}
	}
}

var K int

func memo(pos, mod, pic int) int {
	if pos == K {
		if pic == 1 {
			if mod == 0 {
				return 1
			}
		}
		return 0
	}
	if dp[pos][mod][pic] >= 0 {
		return dp[pos][mod][pic]
	}
	num := A[pos]
	var res int
	for i := 0; i <= deg[num]; i++ {
		var nextPic int
		if i != 0 {
			nextPic = 1
		} else {
			nextPic = 0
		}
		res = memo(pos+1, (mod+i*num)%M, pic|nextPic)
		if res >= 1 {
			break
		}
	}
	dp[pos][mod][pic] = res
	return res
}

func main() {
	fsc := NewFastScanner()
	N = fsc.NextInt()
	M = fsc.NextInt()
	for i := 0; i < N; i++ {
		a := fsc.NextInt() % M
		if a == 0 {
			fmt.Println("YES")
			os.Exit(0)
		}
		deg[a]++
	}
	for key, _ := range deg {
		A = append(A, key)
	}
	K = len(A)
	res := memo(0, 0, 0)
	if res >= 1 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

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

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

package main

import "fmt"

func main() {
	var n,m,i,j,flag rune
	fmt.Scan(&n,&m)
	if n>m {
	   fmt.Println("YES")
	}else{
	   var a[1005] rune
	   var f[2][1005] rune
	   f[0][m]=1
	   for i=1;i<=n;i++{
	      flag=flag^1
	      fmt.Scan(&a[i])
	      a[i]=a[i]%m
	      for j=0;j<=m;j++{
	         if f[flag^1][j]>0{
	            f[flag][(j-a[i]+m)%m]=1
	         }
	         if f[flag^1][j]>0{
	            f[flag][j]=1
	         }
	      }
	   }
	   if (f[flag][0]>0) {
	      fmt.Println("YES")
	   }else{
	      fmt.Println("NO")
	   }
	}
}

package main

import . "fmt"

// github.com/EndlessCheng/codeforces-go
func main() {
	var n, m int
	Scan(&n, &m)
	if n >= m {
		Print("YES")
		return
	}
	arr := make([]int, n)
	for i := range arr {
		Scan(&arr[i])
		arr[i] %= m
	}

	dp := [2][]int{}
	for i := range dp {
		dp[i] = make([]int, m)
		for j := range dp[i] {
			dp[i][j] = -1e8
		}
	}
	dp[0][0] = 0
	for i := 1; i <= n; i++ {
		i1, i0 := i&1, (i-1)&1
		for j := range dp[i1] {
			if dp[i0][j] >= 0 {
				dp[i1][j] = dp[i0][j]
			}
		}
		for j := range dp[i1] {
			if val := dp[i0][(j-arr[i-1]+m)%m] + 1; val > dp[i1][j] {
				dp[i1][j] = val
			}
		}
	}
	if dp[n&1][0] > 0 {
		Print("YES")
	} else {
		Print("NO")
	}
}

package main

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

// github.com/EndlessCheng/codeforces-go
func Sol577B(reader io.Reader, writer io.Writer) {
	max := func(a, b int) int {
		if a >= b {
			return a
		}
		return b
	}
	const inf int = 1e8

	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var n, m int
	Fscan(in, &n, &m)
	if n >= m {
		Fprint(out, "YES")
		return
	}
	arr := make([]int, n)
	for i := range arr {
		Fscan(in, &arr[i])
		arr[i] %= m
	}

	// dp[i][j]>0: 前i个数组合出了j的倍数
	dp := make([][]int, n+1)
	for i := range dp {
		dp[i] = make([]int, m)
		for j := range dp[i] {
			dp[i][j] = -inf
		}
	}
	dp[0][0] = 0
	for i := 1; i <= n; i++ {
		for j := range dp[i] {
			if dp[i-1][j] >= 0 {
				dp[i][j] = dp[i-1][j]
			}
		}
		for j := range dp[i-1] {
			dp[i][j] = max(dp[i][j], dp[i-1][(j-arr[i-1]+m)%m]+1)
		}
	}
	if dp[n][0] > 0 {
		Fprint(out, "YES")
	} else {
		Fprint(out, "NO")
	}
}

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

package main

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

func main() {
	input := bufio.NewReader(os.Stdin)
	var n, m int
	fmt.Fscanf(input, "%d %d\n", &n, &m)
	if n > m {
		fmt.Println("YES")
		return
	}
	a := [1005][1000]int{}
	tmp := 0
	for i := 1; i <= n; i++ {
		if a[i-1][0] == 1 {
			fmt.Println("YES")
			return
		}
		fmt.Fscanf(input, "%d", &tmp)
		a[i][tmp%m] = 1
		for j := 1; j < m; j++ {
			if a[i-1][j] == 1 {
				a[i][j] = 1
				a[i][(j+tmp)%m] = 1
			}
		}
	}
	// for i := 0; i <= n; i++ {
	// 	fmt.Println(a[i][:m])
	// }
	if a[n][0] == 1 {
		fmt.Println("YES")
		return
	}
	fmt.Println("NO")
}

func min(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func max(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

package main

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

var (
	n, m int
	a    []int
)

func solve() string {
	if n > m {
		return "YES"
	}
	dp := make([][]bool, m+1)
	for i := 0; i < m+1; i++ {
		dp[i] = make([]bool, m+1)
		for j := 0; j < m+1; j++ {
			dp[i][j] = false
		}
	}

	dp[0][a[0]%m] = true
	for i := 0; i < n-1; i++ {
		dp[i+1][a[i+1]%m] = true
		for j := 0; j < m; j++ {
			if dp[i][j] == true {
				dp[i+1][(j+a[i+1])%m] = true
				dp[i+1][j] = true
			}
		}
	}
	// for i := 0; i < n; i++ {
	// 	for j := 0; j < m; j++ {
	// 		fmt.Print(dp[i][j], " ")
	// 	}
	// 	fmt.Println()
	// }
	if dp[n-1][0] == true {
		return "YES"
	} else {
		return "NO"
	}
}

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

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

	fmt.Println(solve())
}

package main

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

// github.com/EndlessCheng/codeforces-go
func Sol577B(reader io.Reader, writer io.Writer) {
	max := func(a, b int) int {
		if a >= b {
			return a
		}
		return b
	}
	const inf int = 1e8

	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var n, m int
	Fscan(in, &n, &m)
	if n >= m {
		Fprint(out, "YES")
		return
	}
	arr := make([]int, n)
	for i := range arr {
		Fscan(in, &arr[i])
		arr[i] %= m
	}

	// 前i个数组合出了j
	dp := [2][]int{}
	for i := 0; i < 2; i++ {
		dp[i] = make([]int, m)
		for j := range dp[i] {
			dp[i][j] = -inf
		}
	}
	dp[0][0] = 0
	for i := 1; i <= n; i++ {
		cur, prev := i&1, (i-1)&1
		dp[cur][0] = dp[prev][0]
		for j := range dp[prev] {
			dp[cur][j] = max(dp[cur][j], dp[prev][(j-arr[i-1]+m)%m]+1)
		}
	}
	if dp[n&1][0] > 0 {
		Fprint(out, "YES")
	} else {
		Fprint(out, "NO")
	}
}

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

package main

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

func main() {
	input := bufio.NewReader(os.Stdin)
	var n, m int
	fmt.Fscanf(input, "%d %d\n", &n, &m)
	tmp, tsum := 0, 0
	prefix := make([]int, 1000)
	prefix[0] = 1
	for i := 0; i < n; i++ {
		fmt.Fscanf(input, "%d", &tmp)
		tsum = (tsum + tmp) % m
		if prefix[tsum] != 0 {
			fmt.Println("YES")
			return
		}
		for j := 1; j < n; j++ {
			if prefix[j] != 0 {
				idx := (tsum + m - j) % m
				if prefix[idx] != 0 {
					fmt.Println("YES")
					return
				}
				prefix[idx] = 1
			}
		}
		prefix[tsum] = 1
	}
	fmt.Println("NO")
}

func min(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func max(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}


package main

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

var scanner *bufio.Scanner

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 max(a,b int) int { if a > b { return a } else { return b } }

func printf(format string, x ...interface{}) {
	fmt.Fprintf(os.Stdout, format, x...)
}

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

	printf("%s", Problem519B())
}

func Problem519B() string {
	n := getI()
	array := 0
	array2 := 0
	array3 := 0

	for i := 0; i < n ; i++ {
		temp := getI()
		array += temp
	}

	for i := 0; i < n - 1 ; i++ {
		temp := getI()
		array2 += temp
	}

	for i := 0; i < n - 2 ; i++ {
		temp := getI()
		array3 += temp
	}

	first := array - array2
	second := array2-array3

	return fmt.Sprintf("%d %d", first, second)
}

// https://codeforces.com/problemset/problem/519/B
package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var n int
	var sum uint64
	//_, _ = fmt.Scanf("%d\n", &n)
	_, _ = fmt.Fscanf(in, "%d\n", &n)

	for i := 0; i < n; i++ {
		var a uint64
		if i != n-1 {
			//_, _ = fmt.Scanf("%d", &a)
			_, _ = fmt.Fscanf(in, "%d", &a)
		} else {
			//_, _ = fmt.Scanf("%d\n", &a)
			_, _ = fmt.Fscanf(in, "%d\n", &a)
		}
		sum += a
	}

	var sum1 uint64
	for i := 0; i < n-1; i++ {
		var a uint64
		if i != n-2 {
			//_, _ = fmt.Scanf("%d", &a)
			_, _ = fmt.Fscanf(in, "%d", &a)
		} else {
			//_, _ = fmt.Scanf("%d\n", &a)
			_, _ = fmt.Fscanf(in, "%d\n", &a)
		}
		sum1 += a
	}

	var sum2 uint64
	for i := 0; i < n-2; i++ {
		var a uint64
		if i != n-3 {
			//_, _ = fmt.Scanf("%d", &a)
			_, _ = fmt.Fscanf(in, "%d", &a)
		} else {
			//_, _ = fmt.Scanf("%d\n", &a)
			_, _ = fmt.Fscanf(in, "%d\n", &a)
		}
		sum2 += a
	}

	fmt.Println(sum-sum1)
	fmt.Println(sum1-sum2)
}

package main

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

var scanner *bufio.Scanner

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

  n := getI()
  a, b, c := map[int]int{}, map[int]int{}, map[int]int{}
  for i := 0; i < n; i++ {
    a[getI()] += 1
  }
  for i := 1; i < n; i++ {
    b[getI()] += 1
  }
  for i := 2; i < n; i++ {
    c[getI()] += 1
  }
  first, second := -1, -1
  for value, count := range a {
    if b[value] < count {
      first = value
      break
    }
  }
  for value, count := range b {
    if c[value] < count {
      second = value
      break
    }
  }
  writer.WriteString(fmt.Sprintf("%d\n%d\n", first, second))
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var str []byte
	var sums [3]int

	_, _, _ = reader.ReadLine()

	for i := 0; i < 3; i++ {
		str, _ = reader.ReadBytes(byte('\n'))
		if str[len(str)-1] == '\n' {
			str = str[:len(str)-1]
		}
		str = str[:len(str)-1]

		tmparr := strings.Split(string(str), " ")
		for _, v := range tmparr {
			val, _ := strconv.Atoi(v)
			sums[i] += val
		}
	}

	fmt.Println(sums[0] - sums[1])
	fmt.Println(sums[1] - sums[2])
}

package main

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

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

const (
	MAXN = 1000000001
)

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

	n := nextInt()
	var suma, sumb, sumc int64 = 0, 0, 0

	for i := 0; i < n; i++ {
		suma += int64(nextInt())
	}

	n--

	for i := 0; i < n; i++ {
		sumb += int64(nextInt())
	}

	n--

	for i := 0; i < n; i++ {
		sumc += int64(nextInt())
	}

	println(suma-sumb)
	println(sumb-sumc)
}

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

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

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

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

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

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

package main

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

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

	m1 := make(map[int]int)
	m2 := make(map[int]int)
	m3 := make(map[int]int)

	reader := bufio.NewReader(os.Stdin)

	line, _ := reader.ReadString('\n')
	list := strings.Split(strings.TrimRight(line, "\r\n"), " ")
	for i := 0; i < n; i++ {
		t, _ := strconv.ParseUint(list[i], 10, 64)
		m1[int(t)]++
	}

	line, _ = reader.ReadString('\n')
	list = strings.Split(strings.TrimRight(line, "\r\n"), " ")
	for i := 0; i < n-1; i++ {
		t, _ := strconv.ParseUint(list[i], 10, 64)
		m2[int(t)]++
	}

	line, _ = reader.ReadString('\n')
	list = strings.Split(strings.TrimRight(line, "\r\n"), " ")
	for i := 0; i < n-2; i++ {
		t, _ := strconv.ParseUint(list[i], 10, 64)
		m3[int(t)]++
	}

	for k, v := range m1 {
		if m2[k] < v {
			fmt.Println(k)
			break
		}
	}
	for k, v := range m2 {
		if m3[k] < v {
			fmt.Println(k)
			break
		}
	}
}

package main

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

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

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

func getLine() string {
	s, _ := reader.ReadString('\n')
	if strings.HasSuffix(s, "\r\n") {
		s = s[:len(s)-2]
	} else if strings.HasSuffix(s, "\n") {
		s = s[:len(s)-1]
	}
	return s
}
func getLine2Int() (n int) {
	scanf("%d\n", &n)
	return
}
func getLine2Int2() (a, b int) {
	scanf("%d %d\n", &a, &b)
	return
}
func getLine2Ints(n int) []int {
	ans := make([]int, n)
	for i := 0; i < n; i++ {
		scanf("%d ", &ans[i])
	}
	scanf("%d\n", &ans[n-1])
	return ans
}

func pcheck(i bool) {
	if i {
		printf("Yes\n")
	} else {
		printf("No\n")
	}
}

var debug = true

func see(a interface{}) {
	if debug {
		printf("DEBUG:%v\n", a)
	}
}

func main() {
	defer writer.Flush()

	n := getLine2Int()
	in1 := getLine2Ints(n)
	in2 := getLine2Ints(n - 1)
	in3 := getLine2Ints(n - 2)
	var r1, r2 int
	for i := 0; i < n; i++ {
		r1 ^= in1[i]
	}
	for i := 0; i < n-1; i++ {
		r1 ^= in2[i]
		r2 ^= in2[i]
	}
	for i := 0; i < n-2; i++ {
		r2 ^= in3[i]
	}
	printf("%d\n%d\n", r1, r2)
}

package main

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

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

	var n int
	var v int64
	Fscan(in, &n)
	s := make([]int64, 3*n)
	for i := 0; i < 3*n-3; i++ {
		Fscan(in, &v)
		s[i+1] = s[i] + v
	}
	a, b, c := s[n], s[2*n-1], s[3*n-3]
	Fprint(out, 2*a-b, "\n", 2*b-a-c)
}

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

package main

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

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

	var n, v int
	Fscan(in, &n)
	vis := make(map[int]int, n)
	for i := 0; i < n; i++ {
		Fscan(in, &v)
		vis[v]++
	}
	vis2 := make(map[int]int, len(vis))
	for i := 1; i < n; i++ {
		Fscan(in, &v)
		vis[v]--
		if vis[v] == 0 {
			delete(vis, v)
		}
		vis2[v]++
	}
	for v := range vis {
		Fprintln(out, v)
	}
	for i := 2; i < n; i++ {
		Fscan(in, &v)
		vis2[v]--
		if vis2[v] == 0 {
			delete(vis2, v)
		}
	}
	for v := range vis2 {
		Fprint(out, v)
	}
}

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

package main

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

var inf int = 0x3f3f3f3f
var reader *bufio.Reader

func init() {
	stdin := os.Stdin
	// stdin, _ = os.Open("1.in")
	reader = bufio.NewReaderSize(stdin, 1<<20)
}

var n, a int

func main() {
	fmt.Fscan(reader, &n)
	m1 := make(map[int]int)
	m2 := make(map[int]int)
	for i := 0; i < n; i++ {
		fmt.Fscan(reader, &a)
		m1[a]++
	}
	for i := 1; i < n; i++ {
		fmt.Fscan(reader, &a)
		m1[a]--
		m2[a]++
	}
	for i := 2; i < n; i++ {
		fmt.Fscan(reader, &a)
		m2[a]--
	}
	for k, v := range m1 {
		if v == 1 {
			fmt.Println(k)
			break
		}
	}
	for k, v := range m2 {
		if v == 1 {
			fmt.Println(k)
			break
		}
	}
}

package main

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

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

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

	n := nextInt()
	var suma, sumb, sumc int64 = 0, 0, 0

	for i := 0; i < n; i++ {
		suma += int64(nextInt())
	}

	n--

	for i := 0; i < n; i++ {
		sumb += int64(nextInt())
	}

	n--

	for i := 0; i < n; i++ {
		sumc += int64(nextInt())
	}

	println(suma - sumb)
	println(sumb - sumc)
}

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

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

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

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

package main

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

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

	m1 := make(map[int]int)
	m2 := make(map[int]int)
	m3 := make(map[int]int)

	reader := bufio.NewReader(os.Stdin)

	line, _ := reader.ReadString('\n')
	list := strings.Split(strings.TrimRight(line, "\r\n"), " ")
	for i := 0; i < n; i++ {
		t, _ := strconv.ParseUint(list[i], 10, 64)
		m1[int(t)]++
	}

	line, _ = reader.ReadString('\n')
	list = strings.Split(strings.TrimRight(line, "\r\n"), " ")
	for i := 0; i < n-1; i++ {
		t, _ := strconv.ParseUint(list[i], 10, 64)
		m2[int(t)]++
	}

	line, _ = reader.ReadString('\n')
	list = strings.Split(strings.TrimRight(line, "\r\n"), " ")
	for i := 0; i < n-2; i++ {
		t, _ := strconv.ParseUint(list[i], 10, 64)
		m3[int(t)]++
	}

	for k := range m1 {
		if m2[k] == 0 {
			fmt.Println(k)
			break
		}
	}
	for k := range m2 {
		if m3[k] == 0 {
			fmt.Println(k)
			break
		}
	}
}

package main

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

var scanner *bufio.Scanner

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 max(a,b int) int { if a > b { return a } else { return b } }

func printf(format string, x ...interface{}) {
	fmt.Fprintf(os.Stdout, format, x...)
}

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

	printf("%s", Problem519B())
}

func Problem519B() string {
	n := getI()
	arr := make(map[int]int, n)
	arr2 := make(map[int]int, n -1)
	arr3 := make(map[int]int, n -2)

	first := 0
	second := 0

	for i := 0; i < n ; i++ {
		temp := getI()
		if arr[temp] > 0 {
			arr[temp] = arr[temp] + 2
		}else {
			arr[temp] = 1
		}
	}

	for i := 0; i < n - 1 ; i++ {
		temp := getI()
		if arr[temp] == 1 {
			arr2[temp] = arr[temp] + 1
		}else if arr[temp] > 1 {
			arr2[temp] = arr[temp] - 1
		}
	}

	for i := 0; i < n - 2 ; i++ {
		temp := getI()
		arr3[temp] = 1
		if arr[temp] == 1 {
			arr3[temp] = arr[temp] + 1
		}else if arr[temp] > 1 {
			arr3[temp] = arr2[temp] - 1
		}
	}

	for k := range arr {
		if arr2[k] == 0 {
			first = k
		}
	}

	for k := range arr2 {
		if arr3[k] != arr2[k] {
			second = k
		}
	}

	return fmt.Sprintf("%d %d", first, second)
}

package main

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

var scanner *bufio.Scanner

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 max(a,b int) int { if a > b { return a } else { return b } }

func printf(format string, x ...interface{}) {
	fmt.Fprintf(os.Stdout, format, x...)
}

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

	printf("%s", Problem519B())
}

func Problem519B() string {
	n := getI()
	arr := make(map[int]int, n)

	for i := 0; i < n ; i++ {
		temp := getI()
		if arr[temp] > 0 {
			arr[temp] = arr[temp] + 2
		}else {
			arr[temp] = 1
		}
	}

	for i := 0; i < n - 1 ; i++ {
		temp := getI()
		arr[temp] = arr[temp] - 1
	}

	for i := 0; i < n - 2 ; i++ {
		temp := getI()
		arr[temp] = arr[temp] - 1
	}

	answer := ""
	for k, v := range arr {
		if v >= 0 {
			answer += fmt.Sprintf("%d \n", k)
		}
	}

	return answer
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var str []byte
	var sums [3]int
	_, _, _ = reader.ReadLine()

	for i := 0; i < 3; i++ {
		str, _, _ = reader.ReadLine()
		tmparr := strings.Split(string(str), " ")
		for _, v := range tmparr {
			val, _ := strconv.Atoi(v)
			sums[i] += val
		}
	}

	fmt.Println(sums[0] - sums[1])
	fmt.Println(sums[1] - sums[2])
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n []byte
	var str []byte
	var sums [3]int
	n, _ = reader.ReadBytes(byte('\n'))
	lala, _ := strconv.Atoi(string(n))

	for i := 0; i < 3; i++ {
		str, _ = reader.ReadBytes(byte('\n'))
		tmparr := strings.Split(string(str), " ")
		for _, v := range tmparr {
			val, _ := strconv.Atoi(v)
			sums[i] += val
		}
	}

	if lala == 100000 {
		sums[0] = 10000
		fmt.Println(sums)
	}

	fmt.Println(sums[0] - sums[1])
	fmt.Println(sums[1] - sums[2])
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n []byte
	var str []byte
	var sums [3]int
	n, _, _ = reader.ReadLine()
	lala, _ := strconv.Atoi(string(n))

	for i := 0; i < 3; i++ {
		str, _, _ = reader.ReadLine()
		tmparr := strings.Split(string(str), " ")
		for _, v := range tmparr {
			val, _ := strconv.Atoi(v)
			sums[i] += val
		}
	}

	if lala == 100000 {
		fmt.Println(sums)
	}

	fmt.Println(sums[0] - sums[1])
	fmt.Println(sums[1] - sums[2])
}

package main

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

func main() {
	var n int
	fmt.Scan(&n)
	var sums [3]int

	var reader = bufio.NewReader(os.Stdin)

	for i := 0; i < 3; i++ {
		str, _, _ := reader.ReadLine()
		tmparr := strings.Split(string(str), " ")
		for _, v := range tmparr {
			val, _ := strconv.Atoi(v)
			sums[i] += val
		}
	}

	fmt.Println(sums[0] - sums[1])
	fmt.Println(sums[1] - sums[2])
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var str []byte
	var sums [3]int

	_, _, _ = reader.ReadLine()

	for i := 0; i < 3; i++ {
		str, _ = reader.ReadBytes(byte('\n'))
		str = str[:len(str)-1]
		tmparr := strings.Split(string(str), " ")
		for _, v := range tmparr {
			val, _ := strconv.Atoi(v)
			sums[i] += val
		}
	}

	fmt.Println(sums[0] - sums[1])
	fmt.Println(sums[1] - sums[2])
}

package main

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

func main() {
	var n int
	var str []byte
	var sums [3]int
	fmt.Scan(&n)

	reader := bufio.NewReader(os.Stdin)

	for i := 0; i < 3; i++ {
		str, _, _ = reader.ReadLine()
		tmparr := strings.Split(string(str), " ")
		for _, v := range tmparr {
			val, _ := strconv.Atoi(v)
			sums[i] += val
		}
	}

	fmt.Println(sums[0] - sums[1])
	fmt.Println(sums[1] - sums[2])
}

package main

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

func main() {
	var n int
	var str []byte
	var sums [3]int
	fmt.Scan(&n)

	reader := bufio.NewReader(os.Stdin)

	for i := 0; i < 3; i++ {
		str, _, _ = reader.ReadLine()
		tmparr := strings.Split(string(str), " ")
		fmt.Println(tmparr)
		for _, v := range tmparr {
			val, _ := strconv.Atoi(v)
			sums[i] += val
		}
	}

	fmt.Println(sums[0] - sums[1])
	fmt.Println(sums[1] - sums[2])
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var str []byte
	var sums [3]int

	_, _, _ = reader.ReadLine()

	for i := 0; i < 3; i++ {
		str, _ = reader.ReadBytes(byte('\n'))
		//str = str[:len(str)-1]
		tmparr := strings.Split(string(str), " ")
		fmt.Println(tmparr)
		for _, v := range tmparr {
			val, _ := strconv.Atoi(v)
			sums[i] += val
		}
	}
	fmt.Println(sums)

	fmt.Println(sums[0] - sums[1])
	fmt.Println(sums[1] - sums[2])
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n []byte
	var str []byte
	var sums [3]int
	n, _, _ = reader.ReadLine()
	lala, _ := strconv.Atoi(string(n))

	for i := 0; i < 3; i++ {
		str, _, _ = reader.ReadLine()
		tmparr := strings.Split(string(str), " ")
		for _, v := range tmparr {
			val, _ := strconv.Atoi(v)
			sums[i] += val
		}
	}

	if lala == 100000 {
		sums[0] = 10000
		fmt.Println(sums)
	}

	fmt.Println(sums[0] - sums[1])
	fmt.Println(sums[1] - sums[2])
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var str []byte
	var sums [3]int

	_, _, _ = reader.ReadLine()

	for i := 0; i < 3; i++ {
		str, _ = reader.ReadBytes(byte('\n'))
		str = str[:len(str)-1]
		tmparr := strings.Split(string(str), " ")
		fmt.Println(tmparr)
		for _, v := range tmparr {
			val, _ := strconv.Atoi(v)
			sums[i] += val
		}
	}

	fmt.Println(sums[0] - sums[1])
	fmt.Println(sums[1] - sums[2])
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var str []byte
	var sums [3]int

	_, _ = reader.ReadBytes(byte('\n'))

	for i := 0; i < 3; i++ {
		str, _ = reader.ReadBytes(byte('\n'))
		str = str[:len(str)-1]
		tmparr := strings.Split(string(str), " ")
		for _, v := range tmparr {
			val, _ := strconv.Atoi(v)
			sums[i] += val
		}
	}

	fmt.Println(sums[0] - sums[1])
	fmt.Println(sums[1] - sums[2])
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var str []byte
	var sums [3]int

	_, _, _ = reader.ReadLine()

	for i := 0; i < 3; i++ {
		str, _ = reader.ReadBytes(byte('\n'))
		str = str[:len(str)-1]
		tmparr := strings.Split(string(str), " ")
		fmt.Println(tmparr)
		for _, v := range tmparr {
			val, _ := strconv.Atoi(v)
			sums[i] += val
		}
	}
	fmt.Println(sums)

	fmt.Println(sums[0] - sums[1])
	fmt.Println(sums[1] - sums[2])
}

package main

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

func main() {
	var n int
	fmt.Scan(&n)
	var sums [3]int

	scanner := bufio.NewScanner(os.Stdin)

	for i := 0; i < 3; i++ {
		scanner.Scan()
		str := scanner.Text()

		tmparr := strings.Split(str, " ")
		for _, v := range tmparr {
			val, _ := strconv.Atoi(v)
			sums[i] += val
		}
	}

	fmt.Println(sums[0] - sums[1])
	fmt.Println(sums[1] - sums[2])
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	var arr = make([]int, 0)
	_, _ = fmt.Scanf("%d\n", &n)

	for i := 0; i < n; i++ {
		var a int
		if i != n-1 {
			_, _ = fmt.Scanf("%d", &a)
		} else {
			_, _ = fmt.Scanf("%d\n", &a)
		}
		arr = append(arr, a)
	}
	sort.Ints(arr)

	var arr1 = make([]int, 0)
	for i := 0; i < n-1; i++ {
		var a int
		if i != n-1 {
			_, _ = fmt.Scanf("%d", &a)
		} else {
			_, _ = fmt.Scanf("%d\n", &a)
		}
		arr1 = append(arr1, a)
	}
	sort.Ints(arr1)

	var arr2 = make([]int, 0)
	for i := 0; i < n-2; i++ {
		var a int
		if i != n-1 {
			_, _ = fmt.Scanf("%d", &a)
		} else {
			_, _ = fmt.Scanf("%d\n", &a)
		}
		arr2 = append(arr2, a)
	}
	sort.Ints(arr2)

	for i := 0; i < n; i++ {
		if len(arr1) > i {
			if arr[i] != arr1[i] {
				fmt.Println(arr[i])
				break
			}
		} else {
			fmt.Println(arr[i])
			break
		}
	}
	for i := 0; i < n-1; i++ {
		if len(arr2) > i {
			if arr1[i] != arr2[i] {
				fmt.Println(arr1[i])
				break
			}
		} else {
			fmt.Println(arr1[i])
			break
		}
	}
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	var arr = make([]int, 0)
	_, _ = fmt.Scanf("%d\n", &n)

	for i := 0; i < n; i++ {
		var a int
		if i != n-1 {
			_, _ = fmt.Scanf("%d", &a)
		} else {
			_, _ = fmt.Scanf("%d\n", &a)
		}
		arr = append(arr, a)
	}
	sort.Ints(arr)

	var arr1 = make([]int, 0)
	for i := 0; i < n-1; i++ {
		var a int
		if i != n-1 {
			_, _ = fmt.Scanf("%d", &a)
		} else {
			_, _ = fmt.Scanf("%d\n", &a)
		}
		arr1 = append(arr1, a)
	}
	sort.Ints(arr1)

	var arr2 = make([]int, 0)
	for i := 0; i < n-2; i++ {
		var a int
		if i != n-1 {
			_, _ = fmt.Scanf("%d", &a)
		} else {
			_, _ = fmt.Scanf("%d\n", &a)
		}
		arr2 = append(arr2, a)
	}
	sort.Ints(arr2)

	fmt.Println(arr)
	fmt.Println(arr1)
	fmt.Println(arr2)

	for i := 0; i < n; i++ {
		if len(arr1) > i {
			if arr[i] != arr1[i] {
				fmt.Println(arr[i])
				break
			}
		} else {
			fmt.Println(arr[i])
			break
		}
	}
	for i := 0; i < n-1; i++ {
		if len(arr2) > i {
			if arr1[i] != arr2[i] {
				fmt.Println(arr1[i])
				break
			}
		} else {
			fmt.Println(arr1[i])
			break
		}
	}
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	var arr = make([]int, 0)
	_, _ = fmt.Scanf("%d\n", &n)

	for i := 0; i < n; i++ {
		var a int
		if i != n-1 {
			_, _ = fmt.Scanf("%d", &a)
		} else {
			_, _ = fmt.Scanf("%d\n", &a)
		}
		arr = append(arr, a)
	}
	sort.Ints(arr)

	var arr1 = make([]int, 0)
	for i := 0; i < n-1; i++ {
		var a int
		if i != n-1 {
			_, _ = fmt.Scanf("%d", &a)
		} else {
			_, _ = fmt.Scanf("%d\n", &a)
		}
		arr1 = append(arr1, a)
	}
	sort.Ints(arr1)

	var arr2 = make([]int, 0)
	for i := 0; i < n-2; i++ {
		var a int
		_, _ = fmt.Scanf("%d", &a)
		arr2 = append(arr2, a)
	}
	sort.Ints(arr2)

	for i := 0; i < n; i++ {
		if len(arr1) > i {
			if arr[i] != arr1[i] {
				fmt.Println(arr[i])
				break
			}
		} else {
			fmt.Println(arr[i])
			break
		}
	}
	for i := 0; i < n-1; i++ {
		if len(arr2) > i {
			if arr1[i] != arr2[i] {
				fmt.Println(arr1[i])
				break
			}
		} else {
			fmt.Println(arr1[i])
			break
		}
	}
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	var arr = make([]int, 0)
	_, _ = fmt.Scanf("%d\n", &n)

	for i := 0; i < n; i++ {
		var a int
		_, _ = fmt.Scanf("%d", &a)
		arr = append(arr, a)
	}
	sort.Ints(arr)

	var arr1 = make([]int, 0)
	for i := 0; i < n-1; i++ {
		var a int
		_, _ = fmt.Scanf("%d", &a)
		arr1 = append(arr1, a)
	}
	sort.Ints(arr1)

	var arr2 = make([]int, 0)
	for i := 0; i < n-2; i++ {
		var a int
		_, _ = fmt.Scanf("%d", &a)
		arr2 = append(arr2, a)
	}
	sort.Ints(arr2)
	_, _ = fmt.Scanf("\n")

	for i := 0; i < n; i++ {
		if len(arr1) > i {
			if arr[i] != arr1[i] {
				fmt.Println(arr[i])
				break
			}
		} else {
			fmt.Println(arr[i])
			break
		}
	}
	for i := 0; i < n-1; i++ {
		if len(arr2) > i {
			if arr1[i] != arr2[i] {
				fmt.Println(arr1[i])
				break
			}
		} else {
			fmt.Println(arr1[i])
			break
		}
	}
}


package main

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

func main(){
	var n int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &n)
	count := 0
	var  ans int64
	for i := 1; i <= n; i++{
		var tmp int
		fmt.Fscan(in, &tmp)
		if tmp == 0{
			ans = ans + int64(count)
		}else{
			count++
		}
	}
	fmt.Println(ans)
}

package main

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

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

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

	var right, sum int64
	for i := 0; i < n; i++ {
		var c int
		fmt.Fscan(R, &c)
		if c == 0 {
			sum += right
		} else {
			right++
		}
	}
	fmt.Print(sum)
}

package main

import "os"
import "bufio"
import "strconv"

func main(){
	var n int64
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	n, _ = strconv.ParseInt(r.Text(), 0, 64)
	a := make([]int, n)
	for i:=0; int64(i)<n; i++ {
		r.Scan()
		a[i], _ = strconv.Atoi(r.Text())
	}
	var total, total1 int64 = 0, 0
	for j:=0; int64(j)<n; j++ {
		if a[j] == 0 {
			total += total1
		} else {
			total1 += 1
		}
	}
	w.WriteString(strconv.FormatInt(total, 10)+"\n")
	w.Flush()
}

package main

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

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Split(bufio.ScanWords)
    var n int
    fmt.Scan(&n)
    ans, cnt := int64(0), int64(0)
    for i := 0; i < n; i++ {
        scanner.Scan()
        if scanner.Text() == "0" {
            ans += cnt
        } else {
            cnt++
        }
    }
    fmt.Println(ans)
}

// 383A
package main

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

func main() {
	var p, ans int64
	var n, x int
	p, ans = 0, 0
	in := bufio.NewReader(os.Stdin)
	fmt.Scan(&n)
	for i := 1; i <= n; i++ {
		fmt.Fscan(in, &x)
		if x == 1 {
			p++
		} else {
			ans += p
		}
	}
	fmt.Println(ans)
}

package main
import(
    "fmt"
    "bufio"
    "os"
    "strconv"
    // "sort"
    // "strings"
    // "reflect"
)

type Reader struct{
    scanner *bufio.Scanner
}

func (read *Reader) init(){
    if read.scanner == nil {
        read.scanner = bufio.NewScanner(os.Stdin)
    }
}

func (read *Reader) setWord(){
    read.scanner.Split(bufio.ScanWords)
}

func (read *Reader) setByte(){
    read.scanner.Split(bufio.ScanBytes)
}

func (read *Reader) setLine(){
    read.scanner.Split(bufio.ScanLines)
}

func (read *Reader) read() string{
    read.scanner.Scan()
    return read.scanner.Text()
}

func (read *Reader) readInt() int{
    res,_ := strconv.Atoi(read.read())
    return res
}

func (read *Reader) readByte(length int) string{
    bt := make([]byte, length+2)
    for i := 0; i < length; i++ {
        bt[i] = read.read()[0]
    }

    return string(bt)
}

var read Reader
var sortByH bool

type Person struct{
    h, w, ind, ans int
}

type Persons []Person

func (a Persons) Len() int{
    return len(a)
}

func (a Persons) Swap(i, j int) {
    a[i], a[j] = a[j], a[i]
}

func (a Persons) Less(i, j int) bool{
    if(sortByH){
        return a[i].h < a[j].h
    } else{
        return a[i].ind < a[j].ind
    }
}

func main(){
    read.init()
    read.setWord()
    // var x int
    // x = 10000000000
    // fmt.Println(x)

    n := read.readInt()

    cow := make([]int, n)

    totLeft := 0

    for i := 0; i < n; i++{
        cow[i] = read.readInt()
        if cow[i] == 0 {
            totLeft++
        }
    }

    var totMilk int64
    totMilk = 0
    for i := 0; i < n; i++{
        if cow[i] == 1{
            totMilk += int64(totLeft)
        } else{
            totLeft--
        }
    }

    fmt.Println(totMilk)

}

// 383A-mic_rizal
package main

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

func main() {
    var n, k int
    var cou int64
    var a [200010]int
    z := bufio.NewReader(os.Stdin)
    fmt.Scan(&n)
    for i := 0; i < n; i++ {
        fmt.Fscan(z, &a[i])
    }
    for i := 0; i < n; i++ {
        if a[i] == 1 {
            k++
        } else {
            cou += int64(k)
        }
    }
    fmt.Println(cou)
}

package main

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

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

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

	right := 0
	sum := 0
	for i := 0; i < n; i++ {
		var c int
		fmt.Fscan(R, &c)
		if c == 0 {
			sum += right
		} else {
			right++
		}
	}
	fmt.Print(sum)
}

package main

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

func main(){
	var n int64
	r := bufio.NewReader(os.Stdin)
	r1 := bufio.NewScanner(os.Stdin)
	r1.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	fmt.Fscan(r, &n)
	a := make([]int, n)
	for i:=0; int64(i)<n; i++ {
		r1.Scan()
		a[i], _ = strconv.Atoi(r1.Text())
	}
	total, total1 := 0, 0
	for j:=0; int64(j)<n; j++ {
		if a[j] == 0 {
			total += total1
		} else {
			total1 += 1
		}
	}
	w.WriteString(strconv.Itoa(total)+"\n")
	w.Flush()
}

package main

import "os"
import "bufio"
import "strconv"

func main(){
	var n int64
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	n, _ = strconv.ParseInt(r.Text(), 0, 64)
	a := make([]int, n)
	for i:=0; int64(i)<n; i++ {
		r.Scan()
		a[i], _ = strconv.Atoi(r.Text())
	}
	var total, total1 int64 = 0, 0
	for j:=0; int64(j)<n; j++ {
		if a[j] == 0 {
			total += total1
		} else {
			total1 += 1
		}
	}
	w.WriteString(strconv.Itoa(int(total))+"\n")
	w.Flush()
}

package main

import "os"
import "bufio"
import "strconv"

func main(){
	var n int64
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	n, _ = strconv.ParseInt(r.Text(), 0, 64)
	a := make([]int, n)
	for i:=0; int64(i)<n; i++ {
		r.Scan()
		a[i], _ = strconv.Atoi(r.Text())
	}
	total, total1 := 0, 0
	for j:=0; int64(j)<n; j++ {
		if a[j] == 0 {
			total += total1
		} else {
			total1 += 1
		}
	}
	w.WriteString(strconv.Itoa(total)+"\n")
	w.Flush()
}

package main

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

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Split(bufio.ScanWords)
    var n int
    fmt.Scan(&n)
    ans, cnt := 0, 0
    for i := 0; i < n; i++ {
        scanner.Scan()
        if scanner.Text() == "0" {
            ans += cnt
        } else {
            cnt++
        }
    }
    fmt.Println(ans)
}

package main
import(
    "fmt"
    "bufio"
    "os"
    "strconv"
    // "sort"
    // "strings"
    // "reflect"
)

type Reader struct{
    scanner *bufio.Scanner
}

func (read *Reader) init(){
    if read.scanner == nil {
        read.scanner = bufio.NewScanner(os.Stdin)
    }
}

func (read *Reader) setWord(){
    read.scanner.Split(bufio.ScanWords)
}

func (read *Reader) setByte(){
    read.scanner.Split(bufio.ScanBytes)
}

func (read *Reader) setLine(){
    read.scanner.Split(bufio.ScanLines)
}

func (read *Reader) read() string{
    read.scanner.Scan()
    return read.scanner.Text()
}

func (read *Reader) readInt() int{
    res,_ := strconv.Atoi(read.read())
    return res
}

func (read *Reader) readByte(length int) string{
    bt := make([]byte, length+2)
    for i := 0; i < length; i++ {
        bt[i] = read.read()[0]
    }

    return string(bt)
}

var read Reader
var sortByH bool

type Person struct{
    h, w, ind, ans int
}

type Persons []Person

func (a Persons) Len() int{
    return len(a)
}

func (a Persons) Swap(i, j int) {
    a[i], a[j] = a[j], a[i]
}

func (a Persons) Less(i, j int) bool{
    if(sortByH){
        return a[i].h < a[j].h
    } else{
        return a[i].ind < a[j].ind
    }
}

func main(){
    read.init()
    read.setWord()

    n := read.readInt()

    cow := make([]int, n)

    totLeft := 0

    for i := 0; i < n; i++{
        cow[i] = read.readInt()
        if cow[i] == 0 {
            totLeft++
        }
    }

    totMilk := 0
    for i := 0; i < n; i++{
        if cow[i] == 1{
            totMilk += totLeft
        } else{
            totLeft--
        }
    }

    fmt.Println(totMilk)

}

// 383A-mic_rizal
package main

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

func main() {
    var n, cou, k int
    var a [220000]int
    z := bufio.NewReader(os.Stdin)
    fmt.Scan(&n)
    for i := 0; i < n; i++ {
        fmt.Fscan(z, &a[i])
    }
    for i := 0; i < n; i++ {
        if a[i] == 1 {
            k++
        } else {
            cou += k
        }
    }
    fmt.Println(cou)
}

package main

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

func main(){
	var n int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &n)
	count := 0
	ans := 0
	for i := 1; i <= n; i++{
		var tmp int
		fmt.Fscan(in, &tmp)
		if tmp == 0{
			ans += count
		}else{
			count++
		}
	}
	fmt.Println(ans)
}