You are given an undirected graph consisting of $$$n$$$ vertices and $$$n$$$ edges. It is guaranteed that the given graph is connected (i. e. it is possible to reach any vertex from any other vertex) and there are no self-loops and multiple edges in the graph.Your task is to calculate the number of simple paths of length at least $$$1$$$ in the given graph. Note that paths that differ only by their direction are considered the same (i. e. you have to calculate the number of undirected paths). For example, paths $$$[1, 2, 3]$$$ and $$$[3, 2, 1]$$$ are considered the same.You have to answer $$$t$$$ independent test cases.Recall that a path in the graph is a sequence of vertices $$$v_1, v_2, \ldots, v_k$$$ such that each pair of adjacent (consecutive) vertices in this sequence is connected by an edge. The length of the path is the number of edges in it. A simple path is such a path that all vertices in it are distinct.

The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) — the number of vertices (and the number of edges) in the graph. The next $$$n$$$ lines of the test case describe edges: edge $$$i$$$ is given as a pair of vertices $$$u_i$$$, $$$v_i$$$ ($$$1 \le u_i, v_i \le n$$$, $$$u_i \ne v_i$$$), where $$$u_i$$$ and $$$v_i$$$ are vertices the $$$i$$$-th edge connects. For each pair of vertices $$$(u, v)$$$, there is at most one edge between $$$u$$$ and $$$v$$$. There are no edges from the vertex to itself. So, there are no self-loops and multiple edges in the graph. The graph is undirected, i. e. all its edges are bidirectional. The graph is connected, i. e. it is possible to reach any vertex from any other vertex by moving along the edges of the graph. It is guaranteed that the sum of $$$n$$$ does not exceed $$$2 \cdot 10^5$$$ ($$$\sum n \le 2 \cdot 10^5$$$).

For each test case, print one integer: the number of simple paths of length at least $$$1$$$ in the given graph. Note that paths that differ only by their direction are considered the same (i. e. you have to calculate the number of undirected paths).

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func dfs(v int, g map[int][]int, cl *map[int]int, p *map[int]int) (bool, int, int) {
    (*cl)[v] = 1
    for i := range(g[v]) {
        to := g[v][i]
        if (*p)[v] == to {
            continue
        }
        if (*cl)[to] == 0 {
            (*p)[to] = v
            cyc, st, end := dfs(to, g, cl, p)
            if cyc {
                return cyc, st, end
            }
        } else {
            if (*cl)[to] == 1 {
                return true, to, v
            }
        }
    }
    (*cl)[v] = 2
    return false, -1, -1
}

func tree(curr int, g map[int][]int, vis map[int]bool, path map[int]bool) uint64 {
    var s uint64 = 0
    for _, i := range(g[curr]) {
        if !vis[i] && !path[i]{
            path[i] = true
            s += tree(i, g, vis, path)
            path[i] = false
        }
    }
   return s+1
}

func main() {
    var t, n, a, b int
    scanf("%d\n", &t)
    for i:=0; i<t; i++ {
        scanf("%d\n", &n)

        graph := make(map[int][]int)
        for j:=0; j<n; j++ {
            scanf("%d %d\n", &a, &b)
            graph[a] = append(graph[a], b)
            graph[b] = append(graph[b], a)
        }

        cl, p := make(map[int]int), make(map[int]int)

        var cyc bool
        var st, end int
        for i := range(graph) {
            cyc, st, end = dfs(i, graph, &cl, &p)
            if cyc {
                break
            }
        }

        vis := make(map[int]bool)
        vis[st] = true
        for i:=end; i != st; i=p[i] {
            vis[i] = true
        }

        var s uint64 = 0
        for i:=range(vis) {
                path := make(map[int]bool)
                cnt := tree(i, graph, vis, path)
                s += (cnt*(cnt-1))/2 + cnt*(uint64(n)-cnt)
        }

        printf("%d\n", s)
        writer.Flush()
    }
}

package main

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

// 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 int
		Fscan(in, &n)
		g := make([][]int, n)
		deg := make([]int, n)
		for i := 0; i < n; i++ {
			v, w := 0, 0
			Fscan(in, &v, &w)
			v--
			w--
			g[v] = append(g[v], w)
			g[w] = append(g[w], v)
			deg[v]++
			deg[w]++
		}
		ans := int64(0)

		q := []int{}
		for i, d := range deg {
			if d == 1 {
				q = append(q, i)
			}
		}
		for len(q) > 0 {
			v := q[0]
			q = q[1:]
			for _, w := range g[v] {
				if deg[w]--; deg[w] == 1 {
					q = append(q, w)
				}
			}
		}

		var f func(v, fa int) int
		f = func(v, fa int) int {
			sz := 1
			for _, w := range g[v] {
				if w != fa && deg[w] < 2 {
					s := f(w, v)
					ans += int64(s) * int64(sz)
					sz += s
				}
			}
			return sz
		}
		sz := 0
		for i, d := range deg {
			if d > 1 {
				s := f(i, -1)
				ans += 2 * int64(s) * int64(sz)
				sz += s
			}
		}
		Fprintln(out, ans)
	}

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

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

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func dfs(v int, g map[int][]int, cl *map[int]int, p *map[int]int) (bool, int, int) {
    (*cl)[v] = 1
    for i := range(g[v]) {
        to := g[v][i]
        if (*p)[v] == to {
            continue
        }
        if (*cl)[to] == 0 {
            (*p)[to] = v
            cyc, st, end := dfs(to, g, cl, p)
            if cyc {
                return cyc, st, end
            }
        } else {
            if (*cl)[to] == 1 {
                return true, to, v
            }
        }
    }
    (*cl)[v] = 2
    return false, -1, -1
}

func tree(curr int, g map[int][]int, vis map[int]bool, path map[int]bool) int {
    s := 0
    for _, i := range(g[curr]) {
        if !vis[i] && !path[i]{
            path[i] = true
            s += tree(i, g, vis, path)
            path[i] = false
        }
    }
   return s+1
}

func main() {
    var t, n, a, b int
    scanf("%d\n", &t)
    for i:=0; i<t; i++ {
        scanf("%d\n", &n)

        graph := make(map[int][]int)
        for j:=0; j<n; j++ {
            scanf("%d %d\n", &a, &b)
            graph[a] = append(graph[a], b)
            graph[b] = append(graph[b], a)
        }

        cl, p := make(map[int]int), make(map[int]int)

        var cyc bool
        var st, end int
        for i := range(graph) {
            cyc, st, end = dfs(i, graph, &cl, &p)
            if cyc {
                break
            }
        }

        vis := make(map[int]bool)
        vis[st] = true
        for i:=end; i != st; i=p[i] {
            vis[i] = true
        }

        s := 0
        for i:=range(vis) {
                path := make(map[int]bool)
                cnt := tree(i, graph, vis, path)
                s += (cnt*(cnt-1))/2 + cnt*(n-cnt)
        }

        printf("%d\n", s)
        writer.Flush()
    }
}

package main

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

// 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 int
		Fscan(in, &n)
		g := make([][]int, n)
		deg := make([]int, n)
		for i := 0; i < n; i++ {
			v, w := 0, 0
			Fscan(in, &v, &w)
			v--
			w--
			g[v] = append(g[v], w)
			g[w] = append(g[w], v)
			deg[v]++
			deg[w]++
		}
		ans := int64(0)

		q := []int{}
		for i, d := range deg {
			if d == 1 {
				q = append(q, i)
				deg[i] = 0
			}
		}
		for len(q) > 0 {
			v := q[0]
			q = q[1:]
			for _, w := range g[v] {
				deg[w]--
				if deg[w] == 1 {
					q = append(q, w)
				}
			}
		}

		var f func(v, fa int) int
		f = func(v, fa int) int {
			sz := 1
			for _, w := range g[v] {
				if w != fa && deg[w] == 0 {
					s := f(w, v)
					ans += int64(s) * int64(sz)
					sz += s
				}
			}
			return sz
		}

		sz := 0
		for i, d := range deg {
			if d > 0 {
				s := f(i, -1)
				ans += 2*int64(s) * int64(sz)
				sz += s
			}
		}

		Fprintln(out, ans)
	}

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

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

package main

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

// 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 int
		Fscan(in, &n)
		g := make([][]int, n)
		deg := make([]int, n)
		for i := 0; i < n; i++ {
			v, w := 0, 0
			Fscan(in, &v, &w)
			v--
			w--
			g[v] = append(g[v], w)
			g[w] = append(g[w], v)
			deg[v]++
			deg[w]++
		}
		ans := int64(0)

		q := []int{}
		for i, d := range deg {
			if d == 1 {
				q = append(q, i)
				deg[i] = 0
			}
		}
		for len(q) > 0 {
			v := q[0]
			q = q[1:]
			for _, w := range g[v] {
				deg[w]--
				if deg[w] == 1 {
					q = append(q, w)
				}
			}
		}

		var f func(v, fa int) int
		f = func(v, fa int) int {
			sz := 1
			for _, w := range g[v] {
				if w != fa && deg[w] <= 0 {
					s := f(w, v)
					ans += int64(s) * int64(sz)
					sz += s
				}
			}
			return sz
		}

		sz := 0
		for i, d := range deg {
			if d > 0 {
				s := f(i, -1)
				ans += 2 * int64(s) * int64(sz)
				sz += s
			}
		}

		Fprintln(out, ans)
	}

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

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


This is an interactive problem!Ehab plays a game with Laggy. Ehab has 2 hidden integers $$$(a,b)$$$. Laggy can ask a pair of integers $$$(c,d)$$$ and Ehab will reply with:  1 if $$$a \oplus c>b \oplus d$$$.  0 if $$$a \oplus c=b \oplus d$$$.  -1 if $$$a \oplus c<b \oplus d$$$. Operation $$$a \oplus b$$$ is the bitwise-xor operation of two numbers $$$a$$$ and $$$b$$$.Laggy should guess $$$(a,b)$$$ with at most 62 questions. You'll play this game. You're Laggy and the interactor is Ehab.It's guaranteed that $$$0 \le a,b<2^{30}$$$.

To print the answer, print "! a b" (without quotes). Don't forget to flush the output after printing the answer.

NoteIn the sample:The hidden numbers are $$$a=3$$$ and $$$b=1$$$.In the first query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 1 = 0$$$, so the answer is 1.In the second query: $$$3 \oplus 1 = 2$$$ and $$$1 \oplus 2 = 3$$$, so the answer is -1.In the third query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 0 = 1$$$, so the answer is 0.Then, we printed the answer.

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }
func flush(){ writer.Flush() }

func main(){
	var ans [100]int
	var a,b,val,i int
	a = 0
	b = 0
	fmt.Printf("? 0 0\n");
	fmt.Scanf("%d\n", &ans[0])
	val = 1<<29
	for i=1;i<=30;i++ {
		fmt.Printf("? %d %d\n", val|a, b)
		fmt.Scanf("%d\n", &ans[2*i-1])
		fmt.Printf("? %d %d\n", a, val|b)
		fmt.Scanf("%d\n", &ans[2*i])
		if (ans[2*i-1] == 1 && ans[2*i] == -1){

		} else if (ans[2*i-1]==-1 && ans[2*i]==1){
			a |= val
			b |= val
		} else if (ans[2*i-1] == ans[2*i]){
			if(ans[0] == 1) {
				a |= val;
			} else {
				b |= val;
			}
			ans[0] = ans[2*i];
		}
		val >>= 1
	}
	fmt.Printf("! %d %d\n", a, b)
}

package main

import (
	"fmt"
	"os"
)
// var A int = 323895
// var B int = 29071
// func ask(c, d int) int {
// 	xorAC, xorBD := A ^ c, B ^ d
// 	if xorAC > xorBD {
// 		return 1
// 	} else if xorAC < xorBD {
// 		return -1
// 	} else {
// 		return 0
// 	}
// }

func main() {
	var res int
//	res = ask(0, 0)
	fmt.Printf("? 0 0\n")
	os.Stdout.Sync()
	fmt.Scanf("%d\n", &res)

	a, b := 0, 0

	for i := 29;i >= 0;i -- {
		var r1, r2 int
		m := 1 << uint(i)

		if res == 1 {
//			r1 = ask(a | m, b | m)
//			r2 = ask(a | m, b)
			fmt.Printf("? %d %d\n", a | m, b | m)
			os.Stdout.Sync()
			fmt.Scanf("%d\n", &r1)
			fmt.Printf("? %d %d\n", a | m, b)
			os.Stdout.Sync()
			fmt.Scanf("%d\n", &r2)
			if r1 == 1 && r2 == 1 {
				// nothing to do
			} else if r1 == 1 && r2 == -1 {
				a, b = a | m, b | m
			} else if r1 == -1 {
				a = a | m
				res = r2
			}
		} else if res == -1 {
//			r1 = ask(a | m, b | m)
//			r2 = ask(a, b | m)
			fmt.Printf("? %d %d\n", a | m, b | m)
			os.Stdout.Sync()
			fmt.Scanf("%d\n", &r1)
			fmt.Printf("? %d %d\n", a, b | m)
			os.Stdout.Sync()
			fmt.Scanf("%d\n", &r2)
			if r1 == -1 && r2 == -1 {
				// nothing to do
			} else if r1 == -1 && r2 == 1 {
				a, b = a | m, b | m
			} else if r1 == 1 {
				b = b | m
				res = r2
			}
		} else if res == 0 {
//			r1 = ask(a | m, b)
			fmt.Printf("? %d %d\n", a | m, b)
			os.Stdout.Sync()
			fmt.Scanf("%d\n", &r1)
			if r1 == 1 {
				// nothing to do
			} else if r1 == -1 {
				a, b = a | m, b | m
			}
		}
	}
	fmt.Printf("! %d %d", a, b)
}

package main

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

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

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

func scanf(f string, a ...interface{}) {
	// fmt.Fscanf(reader, f, a...)
	fmt.Scanf(f, a...)
}

const NumDigits = 30

const ansA = 125
const ansB = 223432

func query(c, d int) int {
	printf("? %d %d\n", c, d)
	writer.Flush()

	var result int
	scanf("%d ", &result)
	return result

	// l := ansA ^ c
	// r := ansB ^ d
	// if l > r {
	// 	return 1
	// } else if l < r {
	// 	return -1
	// } else {
	// 	return 0
	// }
}

type Mask int

func (m Mask) String() string {
	sb := strings.Builder{}
	for i := 1; i <= NumDigits; i++ {
		mask := (1 << uint(NumDigits-i))
		if (int(m) & mask) != 0 {
			sb.WriteString("1")
		} else {
			sb.WriteString("0")
		}
	}
	return sb.String()
}

func main() {
	defer writer.Flush()

	diff := make([]int, NumDigits+1)
	diffMask := 0
	preResult := make([]int, NumDigits+1)
	// num == digits[1:30+1]
	preResult[0] = query(0, 0)
	for i := 1; i <= NumDigits; i++ {
		mask := (1 << uint(NumDigits-i))
		q := query(mask, diffMask^mask) // nums[:i] 까지는 동일하도록 만들고 비교시킴

		if preResult[i-1] != q {
			diff[i] = 1
			diffMask = diffMask | mask
			preResult[i] = query(0, diffMask) // nums[:i] 까지는 동일하도록 만들고 비교시킴
		} else {
			preResult[i] = q
		}
	}

	// get a
	a := 0
	for i := 1; i <= NumDigits; i++ {
		mask := (1 << uint(NumDigits-i))
		if diff[i] != 0 {
			if preResult[i-1] == 1 { // XXXX1 > XXXX0
				a = a | mask
			}
			continue
		}
		q := query(0, diffMask^mask)
		if q == 1 {
			a = a | mask
		}
	}
	// printf("%v\n", preResult)
	// printf("%v\n", Mask(diffMask))
	printf("! %d %d\n", a, a^diffMask)
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }
func flush(){ writer.Flush() }

func main(){
	var ans [100]int
	var a,b,val,i int
	a = 0
	b = 0
	printf("? 0 0\n");
	flush();
	scanf("%d\n", &ans[0])
	val = 1<<29
	for i=1;i<=30;i++ {
		printf("? %d %d\n", val|a, b)
		flush();
		scanf("%d\n", &ans[2*i-1])
		printf("? %d %d\n", a, val|b)
		flush();
		scanf("%d\n", &ans[2*i])
		if (ans[2*i-1] == 1 && ans[2*i] == -1){

		} else if (ans[2*i-1]==-1 && ans[2*i]==1){
			a |= val
			b |= val
		} else if (ans[2*i-1] == ans[2*i]){
			if(ans[0] == 1) {
				a |= val;
			} else {
				b |= val;
			}
			ans[0] = ans[2*i];
		}
		val >>= 1
	}
	printf("! %d %d\n", a, b)
}

package main

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

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

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

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

const NumDigits = 30

const ansA = 125
const ansB = 223432

func query(c, d int) int {
	// printf("? %d %d\n", c, d)
	// var result int
	// scanf("%d ", &result)
	// return result

	l := ansA ^ c
	r := ansB ^ d
	if l > r {
		return 1
	} else if l < r {
		return -1
	} else {
		return 0
	}
}

type Mask int

func (m Mask) String() string {
	sb := strings.Builder{}
	for i := 1; i <= NumDigits; i++ {
		mask := (1 << uint(NumDigits-i))
		if (int(m) & mask) != 0 {
			sb.WriteString("1")
		} else {
			sb.WriteString("0")
		}
	}
	return sb.String()
}

func main() {
	defer writer.Flush()

	diff := make([]int, NumDigits+1)
	diffMask := 0
	preResult := make([]int, NumDigits+1)
	// num == digits[1:30+1]
	preResult[0] = query(0, 0)
	for i := 1; i <= NumDigits; i++ {
		mask := (1 << uint(NumDigits-i))
		q := query(mask, diffMask^mask) // nums[:i] 까지는 동일하도록 만들고 비교시킴

		if preResult[i-1] != q {
			diff[i] = 1
			diffMask = diffMask | mask
			preResult[i] = query(0, diffMask) // nums[:i] 까지는 동일하도록 만들고 비교시킴
		} else {
			preResult[i] = q
		}
		query(mask, mask)
	}

	// get a
	a := 0
	for i := 1; i <= NumDigits; i++ {
		mask := (1 << uint(NumDigits-i))
		if diff[i] != 0 {
			if preResult[i-1] == 1 { // XXXX1 > XXXX0
				a = a | mask
			}
			continue
		}
		q := query(0, diffMask^mask)
		if q == 1 {
			a = a | mask
		}
	}
	// printf("%v\n", preResult)
	// printf("%v\n", Mask(diffMask))
	printf("! %d %d\n", a, a^diffMask)
}

package main

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

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

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

func scanf(f string, a ...interface{}) {
	// fmt.Fscanf(reader, f, a...)
	fmt.Scanf(f, a...)
}

const NumDigits = 30

const ansA = 125
const ansB = 223432

func query(c, d int) int {
	printf("? %d %d\n", c, d)
	writer.Flush()

	var result int
	scanf("%d ", &result)
	return result

	// l := ansA ^ c
	// r := ansB ^ d
	// if l > r {
	// 	return 1
	// } else if l < r {
	// 	return -1
	// } else {
	// 	return 0
	// }
}

type Mask int

func (m Mask) String() string {
	sb := strings.Builder{}
	for i := 1; i <= NumDigits; i++ {
		mask := (1 << uint(NumDigits-i))
		if (int(m) & mask) != 0 {
			sb.WriteString("1")
		} else {
			sb.WriteString("0")
		}
	}
	return sb.String()
}

func main() {
	defer writer.Flush()

	diff := make([]int, NumDigits+1)
	diffMask := 0
	preResult := make([]int, NumDigits+1)
	// num == digits[1:30+1]
	preResult[0] = query(0, 0)
	for i := 1; i <= NumDigits; i++ {
		mask := (1 << uint(NumDigits-i))
		q := query(mask, diffMask^mask) // nums[:i] 까지는 동일하도록 만들고 비교시킴

		if preResult[i-1] != q {
			diff[i] = 1
			diffMask = diffMask | mask
			preResult[i] = query(0, diffMask) // nums[:i] 까지는 동일하도록 만들고 비교시킴
		} else {
			preResult[i] = q
		}
		query(mask, mask)
	}

	// get a
	a := 0
	for i := 1; i <= NumDigits; i++ {
		mask := (1 << uint(NumDigits-i))
		if diff[i] != 0 {
			if preResult[i-1] == 1 { // XXXX1 > XXXX0
				a = a | mask
			}
			continue
		}
		q := query(0, diffMask^mask)
		if q == 1 {
			a = a | mask
		}
	}
	// printf("%v\n", preResult)
	// printf("%v\n", Mask(diffMask))
	printf("! %d %d\n", a, a^diffMask)
}


Three companies decided to order a billboard with pictures of their logos. A billboard is a big square board. A logo of each company is a rectangle of a non-zero area. Advertisers will put up the ad only if it is possible to place all three logos on the billboard so that they do not overlap and the billboard has no empty space left. When you put a logo on the billboard, you should rotate it so that the sides were parallel to the sides of the billboard.Your task is to determine if it is possible to put the logos of all the three companies on some square billboard without breaking any of the described rules.

The first line of the input contains six positive integers x1, y1, x2, y2, x3, y3 (1 ≤ x1, y1, x2, y2, x3, y3 ≤ 100), where xi and yi determine the length and width of the logo of the i-th company respectively.

If it is impossible to place all the three logos on a square shield, print a single integer "-1" (without the quotes). If it is possible, print in the first line the length of a side of square n, where you can place all the three logos. Each of the next n lines should contain n uppercase English letters "A", "B" or "C". The sets of the same letters should form solid rectangles, provided that:   the sizes of the rectangle composed from letters "A" should be equal to the sizes of the logo of the first company,  the sizes of the rectangle composed from letters "B" should be equal to the sizes of the logo of the second company,  the sizes of the rectangle composed from letters "C" should be equal to the sizes of the logo of the third company,  Note that the logos of the companies can be rotated for printing on the billboard. The billboard mustn't have any empty space. If a square billboard can be filled with the logos in multiple ways, you are allowed to print any of them. See the samples to better understand the statement.

6
BBBBBB
BBBBBB
AAAACC
AAAACC
AAAACC
AAAACC

package main

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

type logo struct{ x, y int }

func main() {
	//defer profile.Start(profile.ProfilePath(".")).Stop()
	defer flush()

	other := func(i int) (int, int) {
		if i == 0 {
			return 1, 2
		} else if i == 1 {
			return 0, 2
		} else {
			return 0, 1
		}
	}
	label := func(i int) string {
		return string('A' + i)
	}

	logos := make([]logo, 3)
	topi, width := 0, 0

	for i := 0; i < 3; i++ {
		x, y := nextInt(), nextInt()
		if x < y {
			x, y = y, x
		}
		if width < x {
			topi, width = i, x
		}
		logos[i].x, logos[i].y = x, y
	}

	ai, bi := other(topi)
	h := width - logos[topi].y
	vertical := false
	if a, b, top := logos[ai], logos[bi], logos[topi]; a.x == width && b.x == width {
		if top.y+a.y+b.y != width {
			printn(-1)
			return
		}
	} else {
		if a.x == h {
			a.x, a.y = a.y, a.x
		}
		if b.x == h {
			b.x, b.y = b.y, b.x
		}
		if a.y == h && b.y == h && a.x+b.x == width {
			logos[ai], logos[bi] = a, b
			vertical = true
		} else {
			printn(-1)
			return
		}
	}

	printn(width)
	for i := 0; i < logos[topi].y; i++ {
		for j := 0; j < width; j++ {
			printa(label(topi))
		}
		printn()
	}
	if vertical {
		for i := 0; i < h; i++ {
			for j := 0; j < logos[ai].x; j++ {
				printa(label(ai))
			}
			for j := 0; j < logos[bi].x; j++ {
				printa(label(bi))
			}
			printn()
		}
	} else {
		for i := 0; i < logos[ai].y; i++ {
			for j := 0; j < width; j++ {
				printa(label(ai))
			}
			printn()
		}
		for i := 0; i < logos[bi].y; i++ {
			for j := 0; j < width; j++ {
				printa(label(bi))
			}
			printn()
		}
	}
}

func init() {
	scanner.Split(bufio.ScanWords)
}

var scanner = bufio.NewScanner(os.Stdin)

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

func nextWord() string {
	return next()
}

func nextLine() string {
	defer scanner.Split(bufio.ScanWords)
	scanner.Split(bufio.ScanLines)
	return strings.TrimSpace(next())
}

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

var stdout = bufio.NewWriter(os.Stdout)

func printa(a ...interface{}) (int, error) {
	return fmt.Fprint(stdout, a...)
}

func printn(a ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, a...)
}

func printf(format string, a ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, format, a...)
}

func flush() error {
	return stdout.Flush()
}


You are given three integers $$$x, y$$$ and $$$n$$$. Your task is to find the maximum integer $$$k$$$ such that $$$0 \le k \le n$$$ that $$$k \bmod x = y$$$, where $$$\bmod$$$ is modulo operation. Many programming languages use percent operator % to implement it.In other words, with given $$$x, y$$$ and $$$n$$$ you need to find the maximum possible integer from $$$0$$$ to $$$n$$$ that has the remainder $$$y$$$ modulo $$$x$$$.You have to answer $$$t$$$ independent test cases. It is guaranteed that such $$$k$$$ exists for each test case.

The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 5 \cdot 10^4$$$) — the number of test cases. The next $$$t$$$ lines contain test cases. The only line of the test case contains three integers $$$x, y$$$ and $$$n$$$ ($$$2 \le x \le 10^9;~ 0 \le y < x;~ y \le n \le 10^9$$$). It can be shown that such $$$k$$$ always exists under the given constraints.

For each test case, print the answer — maximum non-negative integer $$$k$$$ such that $$$0 \le k \le n$$$ and $$$k \bmod x = y$$$. It is guaranteed that the answer always exists.

NoteIn the first test case of the example, the answer is $$$12339 = 7 \cdot 1762 + 5$$$ (thus, $$$12339 \bmod 7 = 5$$$). It is obvious that there is no greater integer not exceeding $$$12345$$$ which has the remainder $$$5$$$ modulo $$$7$$$.

package main

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

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

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

	var n, x, y int64
	for ; t > 0; t-- {
		fmt.Fscanf(reader, "%d %d %d\n", &x, &y, &n)
		temp := (n-y)/x
		fmt.Println(temp*x +y)
	}
}

package main

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

// https://codeforces.com/problemset/problem/1374/A
// A. Required Remainder
// time limit per test
// 1 second
// memory limit per test
// 256 megabytes
// input
// standard input
// output
// standard output

// You are given three integers x,y
// and n. Your task is to find the maximum integer k such that 0≤k≤n that kmodx=y, where mod

// is modulo operation. Many programming languages use percent operator % to implement it.

// In other words, with given x,y
// and n you need to find the maximum possible integer from 0 to n that has the remainder y modulo x

// .

// You have to answer t
// independent test cases. It is guaranteed that such k

// exists for each test case.
// Input

// The first line of the input contains one integer t
// (1≤t≤5⋅104) — the number of test cases. The next t

// lines contain test cases.

// The only line of the test case contains three integers x,y
// and n (2≤x≤109; 0≤y<x; y≤n≤109

// ).

// It can be shown that such k

// always exists under the given constraints.
// Output

// For each test case, print the answer — maximum non-negative integer k
// such that 0≤k≤n and kmodx=y. It is guaranteed that the answer always exists.

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

	var t int
	_, _ = fmt.Fscan(bufStdin, &t)

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

		nModx := n % x

		var k int
		if nModx == y {
			k = n
		} else if nModx > y {
			k = n - (nModx - y)
		} else {
			k = n - (nModx + (x - y))
		}

		_, _ = fmt.Fprintln(bufStdout, k)
	}
}

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

    defer w.Flush()

    var t int
    fmt.Fscan(r,  &t)
    for i := 0; i < t; i++ {
        var x, y, n int
        fmt.Fscan(r, &x, &y, &n)
        a := n % x
        if a >= y {
            fmt.Fprintln(w, n - a + y)
        } else {
            fmt.Fprintln(w, n - a - x + y)
        }
    }
}

package main

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

// parse integer from byte slice
func parseInt(a []byte, pos int) (ans, newpos int) {
	for pos < len(a) && a[pos] >= '0' && a[pos] <= '9' {
		pos, ans = pos+1, 10*ans+int(a[pos]-'0')
	}
	return ans, pos + 1
}

// https://codeforces.com/problemset/problem/1374/A
// комментарии к решению
// fmt.Scan для нас удобнее, но на большом входном потоке он падает по TLE,
// поэтому читаем []byte и парсим самостоятельно.
// Для буферизованного вывода используем fmt.Sprint , с заменой пробелов
// на \n. Кол-во замен и их размер (1 байт == ' ' на 1 байт == '\n') известно,
// поэтому будет сгенерирован оптимальный код без большого оверхеда
func taskSolution(in []byte, t int) string {
	ans := make([]int, t)
	var x, y, n int
	for i, pos := 0, 0; i < t; i += 1 {
		for in[pos] < '0' || in[pos] > '9' {
			pos += 1
		}
		x, pos = parseInt(in, pos)
		y, pos = parseInt(in, pos)
		n, pos = parseInt(in, pos)
		ans[i] = n - n%x + y
		if ans[i] > n {
			ans[i] -= x
		}
	}
	res := fmt.Sprint(ans)
	return strings.Replace(res[1:len(res)-1], " ", "\n", len(ans)-1)
}

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

	inRaw, err := ioutil.ReadAll(os.Stdin)
	if err != nil {
		panic(err)
	}

	fmt.Println(taskSolution(inRaw, t))
}

package main

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

const (
	SCANNER_BUF_SIZE = 2 << 20

	INF = int64(math.MaxInt64)
	MOD = 1e9 + 7
)

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

func init() {
	writer = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, SCANNER_BUF_SIZE), SCANNER_BUF_SIZE)
}

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

func sint64() int64 {
	scanner.Scan()
	bb := scanner.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func suint64() uint64 {
	scanner.Scan()
	bb := scanner.Bytes()
	i := uint64(0)
	for _, b := range bb {
		i *= 10
		i += uint64(b - '0')
	}
	return i
}

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

func gcd(a, b int64) int64 {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

func lcm(a, b int64) int64 {
	return a * b / gcd(a, b)
}

func abs(a int64) int64 {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r < a {
			a = r
		}
	}
	return a
}

func max(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r > a {
			a = r
		}
	}
	return a
}

func main() {
	defer writer.Flush()
	t := sint64()
	for ; t > 0; t-- {
		x := sint64()
		y := sint64()
		n := sint64()
		printf("%d\n", sol(x, y, n))
	}
}

func sol(x, y, n int64) int64 {
	diff := n - y
	return y + diff / x * x
}

package main

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

var in *bufio.Reader
var out *bufio.Writer

func printf(x string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(out, x, a...)
}

func scanf(x string, a ...interface{}) (n int, err error) {
	return fmt.Fscanf(in, x, a...)
}

func main() {
	out = bufio.NewWriterSize(os.Stdout, 8192)
	defer out.Flush()
	if false {
		file, err := os.Open("in.txt")
		if err != nil {
			log.Fatal(err)
		}
		in = bufio.NewReaderSize(file, 8192)
	} else {
		in = bufio.NewReaderSize(os.Stdin, 8192)
	}

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

	for ; t > 0; t-- {
		scanf("\n%d %d %d", &x, &y, &n)
		printf("%d\n", n-(n%x+x-y)%x)
	}
}

package main

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

func main(){
	var t,x,y,n int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		fmt.Fscan(in,&x,&y,&n)
		tmp := (n/x)*x
		if tmp+y <=n{
			fmt.Println(tmp+y)
		}else{
			fmt.Println(tmp+y-x)
		}
	}
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func main() {
  // STDOUT MUST BE FLUSHED MANUALLY!!!
  defer writer.Flush()

  var x, y, n, t int64

  scanf("%d\n", &t)
  var i int64
  i = 0
  for i < t {
    scanf("%d %d %d\n", &x, &y, &n)
    var lo int64
    var hi int64
    lo = 0
    hi = 1e9 + 1

    for lo + 1 < hi {
    	var mid int64
        mid = (lo + hi) / 2
        if x * mid + y > n {
            hi = mid
        } else {
            lo = mid
        }
    }
    printf("%d\n", lo * x + y)
    i += 1
  }
}

package main

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

var read *bufio.Reader = bufio.NewReader(os.Stdin)
var write *bufio.Writer = bufio.NewWriter(os.Stdout)

func main()  {
	defer write.Flush()
	var t int
	fmt.Fscan(read, &t)
	for ; t > 0; t-- {
		var x, y, n int
		fmt.Fscan(read, &x, &y, &n)
		k := (n - y) / x
		k = k * x + y
		fmt.Fprintln(write, k)
	}
}
/*

*/

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		var x, y, n int64
		fmt.Fscan(in, &x, &y, &n)
		res := n/x*x + y
		if res <= n {
			fmt.Fprintln(out, res)
		} else {
			fmt.Fprintln(out, res-x)
		}
	}
}

package main

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

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

	for tc > 0 {
		tc--
		x, y, n := readThreeNums(reader)
		fmt.Println(solve(x, y, n))
	}
}

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(x, y, n int) int64 {
	// k = a * x + y && k <= n
	// a * x + y <= n
	// a * x <= n - y
	// a <= (n - y) / x
	X := int64(x)
	Y := int64(y)
	N := int64(n)
	a := (N - Y) / X
	if (a+1)*X+Y <= N {
		a++
	} else if a*X+Y > N {
		a--
	}

	K := a*X + Y
	return K
}

package main

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

func main() {
	nCases := 0
	bufin := bufio.NewReader(os.Stdin)
	fmt.Scanln(&nCases)
	x, y, n := 0, 0, 0

	for i := 0; i < nCases; i++ {
		fmt.Fscan(bufin, &x, &y, &n)
		tmp := n/x*x + y
		if tmp > n {
			fmt.Println(tmp - x)
		} else {
			fmt.Println(tmp)
		}
	}
}

package main

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

func main() {
	var t, x, y, n int
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	buffer := make([]byte, 1000)
	scanner.Buffer(buffer, 4096)
	scanner.Scan()
	t, _ = strconv.Atoi(scanner.Text())

	for t > 0 {
		t--

		scanner.Scan()
		x, _ = strconv.Atoi(scanner.Text())
		scanner.Scan()
		y, _ = strconv.Atoi(scanner.Text())
		scanner.Scan()
		n, _ = strconv.Atoi(scanner.Text())

		z := (n - y) / x

		fmt.Println(z*x + y)
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		var x, y, n int
		fmt.Fscan(in, &x)
		fmt.Fscan(in, &y)
		fmt.Fscan(in, &n)
		xMult := n / x
		if xMult*x+y > n {
			xMult--
		}
		fmt.Println(xMult*x + y)
	}
}

package main

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

func main() {
	var cases int
	fmt.Scanf("%d\n", &cases)
	reader := bufio.NewReader(os.Stdin)
	for i := 0; i < cases; i++ {
		line := readLine(reader)
		var x,y,n int64
		sss := strings.Split(string(line), " ")
		x, _ = strconv.ParseInt(sss[0], 10, 64)
		y, _ = strconv.ParseInt(sss[1], 10, 64)
		n, _ = strconv.ParseInt(sss[2], 10, 64)
		left := n / x
		max1 := left * x + y
		if max1 <= n {
			fmt.Println(max1)
			continue
		}
		max1 = (left - 1) * x + y
		fmt.Println(max1)
	}
}

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

package main

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

var nTest int

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

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

		res := n/x*x + y
		if res > n {
			res -= x
		}
		fmt.Fprintln(out, res)
	}

	out.Flush()
}

package main

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

func min(a, b int) int {
	return int(math.Min(float64(a), float64(b)))
}

func max(a, b int) int {
	return int(math.Max(float64(a), float64(b)))
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscanf(in, "%v\n", &t)
	for now := 0; now < t; now++ {
		var x, y, n int
		fmt.Fscanf(in, "%v %v %v\n", &x, &y, &n)
		fmt.Fprintln(out, n - ((n - y)% x) )

	}
	return
}

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

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

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

	scanner.Scan()
	t, _ := strconv.Atoi(scanner.Text())

	for k := 0; k < t; k++ {
		scanner.Scan()
		x, _ := strconv.Atoi(scanner.Text())
		scanner.Scan()
		y, _ := strconv.Atoi(scanner.Text())
		scanner.Scan()
		n, _ := strconv.Atoi(scanner.Text())

		fmt.Println(((n-y)/x)*x + y)
	}
}

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

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

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

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

func main() {
	defer writer.Flush()

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

	for k := 0; k < t; k++ {
		var x, y, n int
		scanf("%d %d %d\n", &x, &y, &n)

		fmt.Println(((n-y)/x)*x + y)
	}
}

package main

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

func main() {
	t := NextInt()
	for t > 0 {
		t--
		x, y, n := NextInt(), NextInt(), NextInt()
		c := (n - y) / x
		fmt.Println(c * x + y)
	}
}

var sc = bufio.NewScanner(os.Stdin)

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

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

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

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

package main

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

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 1<<20)

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

	var n, x, y int64
	for ; t > 0; t-- {
		fmt.Fscanf(reader, "%d %d %d\n", &x, &y, &n)
		temp := (n - y) / x
		fmt.Println(temp*x + y)
	}
}


This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exactly $$$n$$$. The order of the vertices in the cycle is arbitrary.You can make queries in the following way: "? a b" where $$$1 \le a, b \le 10^{18}$$$ and $$$a \neq b$$$. In response to the query, the interactor outputs on a separate line the length of random of two paths from vertex $$$a$$$ to vertex $$$b$$$, or -1 if $$$\max(a, b) > n$$$. The interactor chooses one of the two paths with equal probability. The length of the path —is the number of edges in it.You win if you guess the number of vertices in the hidden graph (number $$$n$$$) by making no more than $$$50$$$ queries.Note that the interactor is implemented in such a way that for any ordered pair $$$(a, b)$$$, it always returns the same value for query "? a b", no matter how many such queries. Note that the "? b a" query may be answered differently by the interactor.The vertices in the graph are randomly placed, and their positions are fixed in advance.Hacks are forbidden in this problem. The number of tests the jury has is $$$50$$$.

NoteIn the first example, the graph could look like this  The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$.   The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$.  With the second query, we find out that one of the simple paths from vertex $$$1$$$ to vertex $$$3$$$ has length $$$2$$$.  In the third query, we find out that vertex $$$4$$$ is not in the graph. Consequently, the size of the graph is $$$3$$$.

package main

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

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

func Solve(reader io.Reader, writer io.Writer, Flush func() error) {

	for i := 2; i < 26; i++ {
		var a, b int
		fmt.Fprintf(writer, "? 1 %d\n", i)
		Flush()

		fmt.Fscanln(reader, &a)

		fmt.Fprintf(writer, "? %d 1\n", i)
		Flush()

		fmt.Fscanln(reader, &b)
		if a != b {
			fmt.Fprintf(writer, "! %d\n", a+b)
			Flush()
			break
		}
		if a == -1 || b == -1 {
			fmt.Fprintf(writer, "! %d\n", i-1)
			Flush()
			break
		}
		if a == 0 || b == 0 {
			os.Exit(0)
		}
	}

}

package main

import (
	"fmt"
)

func ask(a, b int) int64 {
	var ans int64
	fmt.Println("?", a, b)
	fmt.Scan(&ans)
	return ans
}
func solve() int64 {
	for i := 2; i <= 26; i++ {
		x := ask(i, 1)
		y := ask(1, i)
		if x == -1 {
			return int64(i - 1)
		}
		if x != y {
			return x + y
		}
	}
	return -1

}
func main() {
	ans := solve()
	fmt.Println("!", ans)

}

package main

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

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

func Solve(reader io.Reader, writer io.Writer, Flush func() error) {

	for i := 2; i < 26; i++ {
		var a, b int
		fmt.Fprintf(writer, "? 1 %d\n", i)
		Flush()

		fmt.Fscanln(reader, &a)

		fmt.Fprintf(writer, "? %d 1\n", i)
		Flush()

		fmt.Fscanln(reader, &b)
		if a != b {
			fmt.Fprintf(writer, "! %d\n", a+b)
			Flush()
			break
		}
		if a == -1 || b == -1 {
			fmt.Fprintf(writer, "! %d\n", i)
			Flush()
			break
		}
		if a == 0 || b == 0 {
			os.Exit(0)
		}
	}

}

package main

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

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

func Solve(reader io.Reader, writer io.Writer, Flush func() error) {

	for i := 2; i < 26; i++ {
		var a, b int
		fmt.Fprintf(writer, "? 1 %d\n", i)
		Flush()

		fmt.Fscanln(reader, &a)

		if a == -1 {
			fmt.Fprintf(writer, "! %d\n", i)
			Flush()
			break
		}

		fmt.Fprintf(writer, "? %d 1\n", i)
		Flush()

		fmt.Fscanln(reader, &b)
		if a != b {
			fmt.Fprintf(writer, "! %d\n", a+b)
			Flush()
			break
		}
		if a == 0 || b == 0 {
			os.Exit(0)
		}
	}

}

package main

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

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

func Solve(reader io.Reader, writer io.Writer, Flush func() error) {

	for i := 2; i < 25; i++ {
		var a, b int
		fmt.Fprintf(writer, "? 1 %d\n", i)
		Flush()

		fmt.Fscanln(reader, &a)

		if a == -1 {
			fmt.Fprintf(writer, "! %d\n", i)
			Flush()
			break
		}

		fmt.Fprintf(writer, "? %d 1\n", i)
		Flush()

		fmt.Fscanln(reader, &b)
		if a != b {
			fmt.Fprintf(writer, "! %d\n", a+b)
			Flush()
			break
		}
	}

}

package main

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

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

func Solve(reader io.Reader, writer io.Writer, Flush func() error) {

	for i := 2; i < 25; i++ {
		var a, b int
		fmt.Fprintf(writer, "? 1 %d\n", i)
		Flush()

		fmt.Fscanln(reader, &a)

		fmt.Fprintf(writer, "? %d 1\n", i)
		Flush()

		fmt.Fscanln(reader, &b)
		if a != b {
			fmt.Fprintf(writer, "! %d\n", a+b)
			Flush()
			break
		}
	}

}

package main

import (
	"fmt"
)

func ask(a, b int) int64 {
	var ans int64
	fmt.Println("?", a, b)
	fmt.Scan(&ans)
	return ans
}
func solve() int64 {
	for i := 2; i <= 26; i++ {
		x := ask(i, 1)
		y := ask(1, i)
		if x == -1 {
			return int64(i)
		}
		if x != y {
			return x + y
		}
	}
	return -1

}
func main() {
	ans := solve()
	fmt.Println("!", ans)

}


3R2 - Standby for ActionOur dear Cafe's owner, JOE Miller, will soon take part in a new game TV-show "1 vs. $$$n$$$"!The game goes in rounds, where in each round the host asks JOE and his opponents a common question. All participants failing to answer are eliminated. The show ends when only JOE remains (we assume that JOE never answers a question wrong!).For each question JOE answers, if there are $$$s$$$ ($$$s > 0$$$) opponents remaining and $$$t$$$ ($$$0 \le t \le s$$$) of them make a mistake on it, JOE receives $$$\displaystyle\frac{t}{s}$$$ dollars, and consequently there will be $$$s - t$$$ opponents left for the next question.JOE wonders what is the maximum possible reward he can receive in the best possible scenario. Yet he has little time before show starts, so can you help him answering it instead?

The first and single line contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$), denoting the number of JOE's opponents in the show.

Print a number denoting the maximum prize (in dollars) JOE could have. Your answer will be considered correct if it's absolute or relative error won't exceed $$$10^{-4}$$$. In other words, if your answer is $$$a$$$ and the jury answer is $$$b$$$, then it must hold that $$$\frac{|a - b|}{max(1, b)} \le 10^{-4}$$$.

NoteIn the second example, the best scenario would be: one contestant fails at the first question, the other fails at the next one. The total reward will be $$$\displaystyle \frac{1}{2} + \frac{1}{1} = 1.5$$$ dollars.

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	s := float32(0);
	for i := 1; i <= n; i++ {
		s = s + 1.0 / float32(i)
	}
	fmt.Printf("%.5f\n",s)
}

package main // 声明 main 包

import (
	"fmt" // 导入 fmt 包，打印字符串是需要用到
)

func main() { // 声明 main 主函数
	var n float64
	fmt.Scan(&n)
	var ans float64
	ans = 1

	for i := 2.0; i <= n; i += 1.0 {
		ans += 1.0 / i
	}

	fmt.Printf("%.5f", ans)
}

package main

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

//=====I/O=====

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

func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

func scanInt64() int64 {
	sc.Scan()
	a,_ := strconv.ParseInt(sc.Text(),10,64)
	return a
}

func scanFloat64() float64 {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return float64(a)
}

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

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

func printInts(a ...int) {
	for i, e := range a {
		fmt.Fprint(wr, e)
		if i != len(a)-1 { fmt.Fprint(wr, " ") }
	}
	fmt.Fprintln(wr)
	wr.Flush()
}

//•*¨*•.¸¸♪func•*¨*•.¸¸♪

//•*¨*•.¸¸♪main•*¨*•.¸¸♪

func main() {
	sc.Split(bufio.ScanWords)
	// sc.Buffer(make([]byte, 10000), 100000000)

	n := scanInt()

	ans := float64(0)

	for i := 0; i < n; i++ {
		ans+=1.0/float64(n-i)
	}

	fmt.Println(ans)
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	var ans float64
	for i := 1; i <= n; i++ {
		ans += 1.0 / float64(i)
	}
	fmt.Println(ans)
}

package main

import "fmt"

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

	rs := 0.0
	for i := 1; i <= n; i++ {
		rs += 1.0 / float64(i)
	}
	z := fmt.Sprintf("%.12f", rs)
	fmt.Println(z)
}

package main

import "fmt"

func main() {
	var n float64
	fmt.Scan(&n)
	var sum float64 = 0
	for i := n; i >= 1; i-- {
		sum += 1 / i
	}
	fmt.Println(sum)
}

package main

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

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

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

	var ans float32
	for i := 0; i < n; i++ {
		ans = ans + (1 / float32(n-i))
	}

	fmt.Fprint(w, fmt.Sprintf("%.12f\n", ans))
}

package main

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

const (
	MAX_INT int64 = math.MaxInt64
	MIN_INT int64 = math.MinInt64
)

func main() {
	n := ScanInt64()
	//𝐻𝑛=𝑙𝑛(𝑛)+0.5772156649
	hn := float64(1.0)
	for i := int64(2); i <= n; i++ {
		hn += float64(1)/float64(i)
	}
	fmt.Println(fmt.Sprintf("%.5f", hn))
}

func contains(a []int64, num int64) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == num {
			return true
		}
	}
	return false
}

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

var in *bufio.Scanner

func init() {
	in = bufio.NewScanner(os.Stdin)
	in.Split(bufio.ScanWords)
}

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

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

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

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

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

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

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

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

package main

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

var reader *bufio.Reader=bufio.NewReader(os.Stdin)
var writer *bufio.Writer=bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}){fmt.Fprintf(writer,f,a...)}
func scanf(f string,a...interface{}){fmt.Fscanf(reader,f,a...)}

func main(){
	defer writer.Flush()
	var n int
	scanf("%d\n",&n)
	var ans float64
	for ;n>0;n--{
		ans+=1.0/float64(n)
	}
	printf("%.10f\n",ans)
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	N := readInts(reader)[0]

	var resp float64 = 0

	for i := N; i >= 1; i-- {
		resp += float64(float64(1) / float64(i))
	}

	fmt.Println(resp)
}

// ###############################################################
// ######################helper methods###########################
// ###############################################################

func minInt(x, y int) int {
	if x < y {
		return x
	}

	return y
}

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

	return x
}

func readInts(reader *bufio.Reader) []int {
	text, err := reader.ReadString('\n')
	if err != nil {
		fmt.Println(err.Error())
	}
	inputs := strings.Split(strings.TrimSuffix(strings.TrimSuffix(text, "\n"), "\r"), " ")

	temp := make([]int, len(inputs))
	for i := 0; i < len(inputs); i++ {
		temp[i], err = strconv.Atoi(inputs[i])
		if err != nil {
			fmt.Println(err.Error())
		}
	}

	return temp
}

package main
import (
	"bufio"
	"fmt"
	"os"
)
func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()
	var n float64
	fmt.Fscan(r, &n)
	var a float64
	for i := 1.0; i <= n; i++ {
		a += 1.0 / i
	}
	fmt.Fprintln(w, a)
}

package main

import "fmt"

func main() {
	var n float64
	fmt.Scanf("%f\n", &n)

	rs := 1.0
	rs += (n - 1) / n
	z := fmt.Sprintf("%.12f", rs)
	fmt.Println(z)
}


You are given three strings $$$a$$$, $$$b$$$ and $$$c$$$ of the same length $$$n$$$. The strings consist of lowercase English letters only. The $$$i$$$-th letter of $$$a$$$ is $$$a_i$$$, the $$$i$$$-th letter of $$$b$$$ is $$$b_i$$$, the $$$i$$$-th letter of $$$c$$$ is $$$c_i$$$.For every $$$i$$$ ($$$1 \leq i \leq n$$$) you must swap (i.e. exchange) $$$c_i$$$ with either $$$a_i$$$ or $$$b_i$$$. So in total you'll perform exactly $$$n$$$ swap operations, each of them either $$$c_i \leftrightarrow a_i$$$ or $$$c_i \leftrightarrow b_i$$$ ($$$i$$$ iterates over all integers between $$$1$$$ and $$$n$$$, inclusive).For example, if $$$a$$$ is "code", $$$b$$$ is "true", and $$$c$$$ is "help", you can make $$$c$$$ equal to "crue" taking the $$$1$$$-st and the $$$4$$$-th letters from $$$a$$$ and the others from $$$b$$$. In this way $$$a$$$ becomes "hodp" and $$$b$$$ becomes "tele".Is it possible that after these swaps the string $$$a$$$ becomes exactly the same as the string $$$b$$$?

The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a string of lowercase English letters $$$a$$$. The second line of each test case contains a string of lowercase English letters $$$b$$$. The third line of each test case contains a string of lowercase English letters $$$c$$$. It is guaranteed that in each test case these three strings are non-empty and have the same length, which is not exceeding $$$100$$$.

Print $$$t$$$ lines with answers for all test cases. For each test case: If it is possible to make string $$$a$$$ equal to string $$$b$$$ print "YES" (without quotes), otherwise print "NO" (without quotes). You can print either lowercase or uppercase letters in the answers.

4
aaa
bbb
ccc
abc
bca
bca
aabb
bbaa
baba
imi
mii
iim

NoteIn the first test case, it is impossible to do the swaps so that string $$$a$$$ becomes exactly the same as string $$$b$$$.In the second test case, you should swap $$$c_i$$$ with $$$a_i$$$ for all possible $$$i$$$. After the swaps $$$a$$$ becomes "bca", $$$b$$$ becomes "bca" and $$$c$$$ becomes "abc". Here the strings $$$a$$$ and $$$b$$$ are equal.In the third test case, you should swap $$$c_1$$$ with $$$a_1$$$, $$$c_2$$$ with $$$b_2$$$, $$$c_3$$$ with $$$b_3$$$ and $$$c_4$$$ with $$$a_4$$$. Then string $$$a$$$ becomes "baba", string $$$b$$$ becomes "baba" and string $$$c$$$ becomes "abab". Here the strings $$$a$$$ and $$$b$$$ are equal.In the fourth test case, it is impossible to do the swaps so that string $$$a$$$ becomes exactly the same as string $$$b$$$.

package main

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

func main() {
	var t int
	var a, b, c string
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &a, &b, &c)
		ans := "YES"
		for j := 0; j < len(a); j++ {
			if !checkAns(a[j], b[j], c[j]) {
				ans = "NO"
				break
			}
		}
		fmt.Println(ans)
	}
}

func checkAns(a, b, c byte) bool {
	if a == c {
		return true
	}
	if b == c {
		return true
	}
	return false
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		var a, b, c string
		fmt.Fscan(in, &a, &b, &c)
		for i := 0; i < len(a); i++ {
			if c[i] != a[i] && c[i] != b[i] {
				fmt.Fprintln(out, "NO")
				goto end
			}
		}
		fmt.Fprintln(out, "YES")
	end:
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := int64(1)
	fmt.Fscanf(in, "%d\n", &t)
	for tt := int64(0); tt < t; tt++ {
		a, b, c := "", "", ""
		fmt.Fscanf(in, "%s\n", &a)
		fmt.Fscanf(in, "%s\n", &b)
		fmt.Fscanf(in, "%s\n", &c)
		n := len(a)
		cannot := false
		for i := 0; i < n; i++ {
			if a[i] == c[i] || b[i] == c[i] {
				continue
			}
			cannot = true
			break
		}
		if cannot {
			fmt.Fprintf(out, "NO\n")
		} else {
			fmt.Fprintf(out, "YES\n")
		}
	}
	return
}

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

func same(s string, ss string) bool {
	a := make([]int, 26)
	for i := 0; i < len(s); i++ {
		b := int(s[i] - 'a')
		a[b]++
	}
	for i := 0; i < len(ss); i++ {
		b := int(ss[i] - 'a')
		a[b]--
		if a[b] == -1 {
			return false
		}
	}
	for i := 0; i < 26; i++ {
		if a[i] != 0 {
			return false
		}
	}
	return true
}

package main

import ("fmt")

// func calculate(h int,m int){
// 	var rem_hrs int =  24 - h
// 	var rem_mins int = m
// 	//fmt.Printf("Hours %v Minutes %v\n",h,m)
// 	//fmt.Printf("Rem_Hours %v Rem_Minutes %v\n",rem_hrs,rem_mins)
// 	var answer int = ((60*rem_hrs) - rem_mins)
// 	fmt.Println(answer)
// }

func main(){
	var t int
	fmt.Scanln(&t)
	for i:=0;i<t;i++{
		var a string
		var b string
		var c string
		fmt.Scanln(&a)
		fmt.Scanln(&b)
		fmt.Scanln(&c)
		var flag bool = true
		no_swaps := 0

		for i:=0;i<len(a);i++{
			if a[i]!=b[i]{
				if b[i]==c[i]{
					continue
				}else{
					if a[i]==c[i]{
						continue
					}else{
						flag = false
						break
					}
				}
			}else{
				if a[i]!=c[i]{
					no_swaps++
				}
				continue
			}
		}

		if flag==true{
			if no_swaps>0{
				fmt.Println("NO")
			}else{
				fmt.Println("YES")
			}
		}else{
			fmt.Println("NO")
		}
		//calculate(hours,minutes)
	}
}

package main

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

var reader io.Reader
var scanner *bufio.Scanner

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

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

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

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

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

func main() {
	f := os.Stdin
	out := os.Stdout
	Init(f, 100010)

	T := NextInt()
	for t := 0; t < T; t++ {
		a := NextBytes()
		b := NextBytes()
		c := NextBytes()
		n := len(a)
		ok := true
		for i := 0; ok && i < n; i++ {
			if a[i] == c[i] || b[i] == c[i] {
				continue
			}
			ok = false
		}
		if ok {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}

}

package main

import (
	"fmt"
)

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		var a, b, c string
		fmt.Scanf("%s\n%s\n%s\n", &a, &b, &c)
		sum := 0
		for j := 0; j < len(a); j++ {
			if a[j] == c[j] || b[j] == c[j] {
				sum++
			}
		}
		if sum != len(a) {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}
}

package main

import (
	"fmt"
)

func solved(cadA string, cadB string, cadC string) string {
	cadAByte := []byte(cadA)
	cadBByte := []byte(cadB)
	cadCByte := []byte(cadC)
	for i:=0; i < len(cadC); i++ {
		if cadC[i] == cadA[i] && cadC[i] != cadB[i] {
			cadCByte[i] = cadB[i]
			cadBByte[i] = cadC[i]

		} else {
			cadCByte[i] = cadA[i]
			cadAByte[i] = cadC[i]
		}

	}
	if string(cadAByte) == string(cadBByte) {
		return "YES"
	}
	return "NO"
}

func main() {
	var n int
	var solutions []string
	fmt.Scanf("%d\n", &n)
	for i := 1; i <= n; i++ {
		var cadA, cadB, cadC string
		fmt.Scanf("%s\n", &cadA)
		fmt.Scanf("%s\n", &cadB)
		fmt.Scanf("%s\n", &cadC)
		solutions = append(solutions, solved(cadA, cadB, cadC))
	}
	for i := 0; i < n; i++ {
		fmt.Println(solutions[i])
	}
}

package main

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

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

func scanString() string { sc.Scan(); return sc.Text() }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

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

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

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1000000)

	tests := scanInt()
	for t := 0; t < tests; t++ {
		a := scanString()
		b := scanString()
		c := scanString()

		n := len(a)
		f := true

		for i := 0; i < n; i++ {
			if !(a[i] == c[i] || b[i] == c[i]) {
				f = false
			}
		}

		if f {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}

	}
}

package main

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

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

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

func main() {
	defer writer.Flush()
	var a, b, c string

	var n int

	scanf("%d\n", &n)

	for i := 0; i < n; i++ {
		scanf("%s\n", &a)
		scanf("%s\n", &b)
		scanf("%s\n", &c)
		flag := true
		for j := 0; j < len(c); j++ {
			if !(c[j] == b[j] || c[j] == a[j]) {
				flag = false
			}
		}
		if flag {
			printf("YES\n")
		} else {
			printf("NO\n")
		}
	}

}

package main

import "fmt"

func cou(a, b, c string) bool  {
	for i := len(a)-1; i >= 0; i-- {
		if b[i] != c[i] && a[i] != c[i] {
			return false
		}
	}
	return true
}

func main() {
	var t int
	fmt.Scan(&t)
	for ; t > 0; t-- {
		var a, b, c string
		fmt.Scan(&a, &b, &c)
		if cou(a, b, c) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

// 1e9~1e18 √n logn 1     二分 二进制
// 1e5~1e6  nlogn nαn n   RMQ 并查集
// 1e3~1e4  n^2 n√n       RMQ DP 分块
// 300~500  n^3           DP 二分图
func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	solve := func() (ans bool) {
		var a,b,c []byte
		Fscan(in, &a,&b,&c)

		for i := range a {
			if a[i] == b[i] {
				if a[i] != c[i] {
					return false
				}
				continue
			}
			if a[i] != c[i] && b[i] != c[i] {
				return false
			}
		}

		return true
	}

	var t int
	Fscan(in, &t)
	for _case := 1; _case <= t; _case++ {
		Fprintln(out, map[bool]string{true: "YES", false: "NO"} [solve()])
	}
}

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

	solve := func() (ans bool) {
		var a, b, c []byte
		Fscan(in, &a, &b, &c)
		for i, ci := range c {
			if a[i] != ci && b[i] != ci {
				return false
			}
		}
		return true
	}

	var t int
	Fscan(in, &t)
	for _case := 1; _case <= t; _case++ {
		Fprintln(out, map[bool]string{true: "YES", false: "NO"} [solve()])
	}
}

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

package main

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

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

func main() {
	for t := ScanInt64(); t > 0; t-- {
		a, b, c := ScanWord(), ScanWord(), ScanWord()

		count := 0
		for i := 0; i < len(a); i++ {
			if a[i] == c[i] || b[i] == c[i] {
				count++
			}
		}
		if count == len(a) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
	close(O)
	oWg.Wait()
}

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

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

func init() {
	P = fmt.Println

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

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

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

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

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

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

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

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

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

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

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

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

func MnMx(args ...int64) (int64, int64) {
	minVal, maxVal := MX_INT, MN_INT

	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}

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

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

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

func SArr(a []int64) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)

	for i := range a {
		numStr := strconv.FormatInt(a[i], 10)
		sb.WriteString(numStr + " ")
	}
	return sb.String()
}

package main

import "fmt"

func main() {
	var t int
	var a, b, c string
	fmt.Scanln(&t)
	for t > 0 {
		fmt.Scanln(&a)
		fmt.Scanln(&b)
		fmt.Scanln(&c)

		n := len(a)
		res := "YES"
		for i := 0; i < n; i++ {
			if a[i] != c[i] && b[i] != c[i] {
				res = "NO"
				break
			}
		}
		fmt.Println(res)
		t--
	}
}

package main

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

func main() {
	for t := ReadInt(); t > 0; t-- {
		a := ReadString()
		b := ReadString()
		c := ReadString()
		var flag int = 1;
		for i := 0; i < len(a); i++ {
			if a[i] == c[i] {
				continue
			} else if b[i] == c[i] {
				continue
			}
			flag = 0
			break
		}
		if flag > 0 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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

var out chan string
var in *bufio.Scanner
var outWg *sync.WaitGroup

func ReadString() string {
	in.Scan()
	return in.Text()
}
func ReadStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ReadString()
	}
	return s
}
func ReadInt() int {
	intStr := ReadString()
	i, _ := strconv.ParseInt(intStr, 10, 32)
	return int(i)
}
func ReadIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ReadInt()
	}
	return arr
}
func init() {
	//set input
	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(2e+5))
	in.Split(bufio.ScanWords)

	//set output
	out = make(chan string, 16)
	outWg = &sync.WaitGroup{}
	outWg.Add(1)

	writer := bufio.NewWriterSize(os.Stdout, int(2e+5))
	go func(write *bufio.Writer) {
		defer outWg.Done()
		defer write.Flush()

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

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"os"
	"strconv"
)
func main() {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	s.Buffer(make([]byte, 1<<12), 1<<20)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()
	s.Scan()
	t, _ := strconv.Atoi(s.Text())
	buf := new(bytes.Buffer)
	for i := 0; i < t; i++ {
		s.Scan()
		a := s.Text()
		s.Scan()
		b := s.Text()
		s.Scan()
		c := s.Text()
		var flag bool = true
		for j := 0; j < len(a); j++ {
			if b[j] != c[j] && c[j] != a[j] {
				flag = false
				break
			}
		}
		if flag {
			buf.WriteString("YES\n")
		} else {
			buf.WriteString("NO\n")
		}
	}
	fmt.Fprint(w, buf.String())
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var n int
	fmt.Scan(&n)
	for n > 0 {
		n--
		var _a, _b, _c string
		fmt.Scan(&_a, &_b, &_c)
		var a, b, c = []byte(_a), []byte(_b), []byte(_c)
		for i := 0; i < len(a); i++ {
			if a[i] == c[i] {
				b[i], c[i] = c[i], b[i]
			} else {
				a[i], c[i] = c[i], a[i]
			}
		}
		_a, _b, _c = string(a), string(b), string(c)
		if strings.Compare(_a, _b) == 0 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import ("fmt")

// func calculate(h int,m int){
// 	var rem_hrs int =  24 - h
// 	var rem_mins int = m
// 	//fmt.Printf("Hours %v Minutes %v\n",h,m)
// 	//fmt.Printf("Rem_Hours %v Rem_Minutes %v\n",rem_hrs,rem_mins)
// 	var answer int = ((60*rem_hrs) - rem_mins)
// 	fmt.Println(answer)
// }

func main(){
	var t int
	fmt.Scanln(&t)
	for i:=0;i<t;i++{
		var a string
		var b string
		var c string
		fmt.Scanln(&a)
		fmt.Scanln(&b)
		fmt.Scanln(&c)
		var flag bool = true
		no_swaps := 0

		for i:=0;i<len(a);i++{
			if a[i]!=b[i]{
				if b[i]==c[i]{
					continue
				}else{
					if a[i]==c[i]{
						continue
					}else{
						flag = false
						break
					}
				}
			}else{
				no_swaps++
				continue
			}
		}

		if flag==true{
			if no_swaps>0{
				fmt.Println("NO")
			}else{
				fmt.Println("YES")
			}
		}else{
			fmt.Println("NO")
		}
		//calculate(hours,minutes)
	}
}

package main

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

var reader io.Reader
var scanner *bufio.Scanner

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

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

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

func NextBytes() []byte {
	if !scanner.Scan() {
		die(scanner.Err())
	}
	return scanner.Bytes()
}

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

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

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

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

	T := NextInt()
	for t := 0; t < T; t++ {
		a := NextBytes()
		b := NextBytes()
		c := NextBytes()
		n := len(a)
		ok := true
		for i := 0; ok && i < n; i++ {
			if a[i] == c[i] || b[i] == c[i] {
				continue
			}
			ok = false
		}
		if ok {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}

}

package main

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

var reader io.Reader
var scanner *bufio.Scanner

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

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

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

func NextBytes() []byte {
	if !scanner.Scan() {
		die(scanner.Err())
	}
	return scanner.Bytes()
}

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

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

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

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

	T := NextInt()
	for t := 0; t < T; t++ {
		a := NextBytes()
		b := NextBytes()
		c := NextBytes()
		n := len(a)
		ok := true
		fmt.Fprintln(os.Stderr, n)
		for i := 0; ok && i < n; i++ {
			if a[i] == c[i] || b[i] == c[i] {
				continue
			}
			ok = false
		}
		if ok {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}

}

package main

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

var reader io.Reader
var scanner *bufio.Scanner

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

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

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

func NextBytes() []byte {
	if !scanner.Scan() {
		die(scanner.Err())
	}
	return scanner.Bytes()
}

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

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

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

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

	T := NextInt()
	for t := 0; t < T; t++ {
		a := NextBytes()
		b := NextBytes()
		c := NextBytes()
		n := len(a)
		ok := true
		fmt.Fprintln(os.Stderr, n)
		for i := 0; ok && i < n; i++ {
			if a[i] == c[i] || b[i] == c[i] {
				continue
			}
			ok = false
		}
		if ok {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}

}

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"os"
	"strconv"
)
type Sc bufio.Scanner
func (s *Sc) Word() string {
	sc := bufio.Scanner(*s)
	sc.Scan()
	return sc.Text()
}
func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1<<12), 1<<20)
	s := Sc(*sc)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	t, _ := strconv.Atoi(s.Word())
	buf := new(bytes.Buffer)
	for i := 0; i < t; i++ {
		a, b, c := s.Word(), s.Word(), s.Word()
		var flag bool = true
		for j := 0; j < len(a); j++ {
			if b[j] != c[j] && c[j] != a[j] {
				flag = false
				break
			}
		}
		if flag {
			buf.WriteString("YES\n")
		} else {
			buf.WriteString("NO\n")
		}
	}
	fmt.Fprint(w, buf.String())
}


Nastya just made a huge mistake and dropped a whole package of rice on the floor. Mom will come soon. If she sees this, then Nastya will be punished.In total, Nastya dropped $$$n$$$ grains. Nastya read that each grain weighs some integer number of grams from $$$a - b$$$ to $$$a + b$$$, inclusive (numbers $$$a$$$ and $$$b$$$ are known), and the whole package of $$$n$$$ grains weighs from $$$c - d$$$ to $$$c + d$$$ grams, inclusive (numbers $$$c$$$ and $$$d$$$ are known). The weight of the package is the sum of the weights of all $$$n$$$ grains in it.Help Nastya understand if this information can be correct. In other words, check whether each grain can have such a mass that the $$$i$$$-th grain weighs some integer number $$$x_i$$$ $$$(a - b \leq x_i \leq a + b)$$$, and in total they weigh from $$$c - d$$$ to $$$c + d$$$, inclusive ($$$c - d \leq \sum\limits_{i=1}^{n}{x_i} \leq c + d$$$).

The input consists of multiple test cases. The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$  — the number of test cases.  The next $$$t$$$ lines contain descriptions of the test cases, each line contains $$$5$$$ integers: $$$n$$$ $$$(1 \leq n \leq 1000)$$$  — the number of grains that Nastya counted and $$$a, b, c, d$$$ $$$(0 \leq b < a \leq 1000, 0 \leq d < c \leq 1000)$$$  — numbers that determine the possible weight of one grain of rice (from $$$a - b$$$ to $$$a + b$$$) and the possible total weight of the package (from $$$c - d$$$ to $$$c + d$$$).

For each test case given in the input print "Yes", if the information about the weights is not inconsistent, and print "No" if $$$n$$$ grains with masses from $$$a - b$$$ to $$$a + b$$$ cannot make a package with a total mass from $$$c - d$$$ to $$$c + d$$$.

NoteIn the first test case of the example, we can assume that each grain weighs $$$17$$$ grams, and a pack $$$119$$$ grams, then really Nastya could collect the whole pack.In the third test case of the example, we can assume that each grain weighs $$$16$$$ grams, and a pack $$$128$$$ grams, then really Nastya could collect the whole pack.In the fifth test case of the example, we can be assumed that $$$3$$$ grains of rice weigh $$$2$$$, $$$2$$$, and $$$3$$$ grams, and a pack is $$$7$$$ grams, then really Nastya could collect the whole pack.In the second and fourth test cases of the example, we can prove that it is impossible to determine the correct weight of all grains of rice and the weight of the pack so that the weight of the pack is equal to the total weight of all collected grains.

package main

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

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

	var t, n, a, b, c, d int
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &n, &a, &b, &c, &d)
		if c-d > n*(a+b) || c+d < n*(a-b) {
			Fprintln(out, "No")
		} else {
			Fprintln(out, "Yes")
		}
	}
}

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

// https://serhatgiydiren.github.io

package main

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

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

func solve(test_id int) {
 var n,a,b,c,d int64
 fmt.Fscanf(reader, "%d %d %d %d %d\n", &n, &a, &b, &c, &d)
 a *= n
 b *= n
 res := "Yes"
 if a - b > c + d || a + b < c - d {
  res = "No"
 }
 fmt.Fprintf(writer, "%s\n", res)
}

func solve_cases() {
 defer writer.Flush()
 t := 1
 fmt.Fscanf(reader, "%d\n", &t)
 for i := 0 ; i < t ; i++ {
  solve(i)
 }
}

func main() {
 solve_cases()
}

package main

import (
	_ "bufio"
	"fmt"
)

type Range struct {
	min, max int64
}

func main() {
	var (
		test, i       int64
		n, a, b, c, d int64
	)
	fmt.Scanf("%d\n", &test)
	for i = 0; i < test; i++ {
		fmt.Scanf("%d %d %d %d %d\n", &n, &a, &b, &c, &d)
		fmt.Println(valid(n, a, b, c, d))
	}
}

func valid(n, a, b, c, d int64) string {
	ranges := []Range{
		{
			min: n * (a - b),
			max: n * (a + b),
		},
		{
			min: c - d,
			max: c + d,
		},
	}
	if inRange(ranges[0], ranges[1]) {
		return "Yes"
	} else {
		return "No"
	}
}

func inRange(r1, r2 Range) bool {
	// fmt.Println("\nranges ", r1, r2)
	// switch {
	// case r1.max < r2.min :
	// 	return false
	// case
	// }
	if r1.max < r2.min || r1.min > r2.max {
		return false
	} else {
		return true
	}
	return true
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scan(&t)
	for ; t > 0; t-- {
		var n, a, b, c, d int
		fmt.Scan(&n, &a, &b, &c, &d)
		if (a-b)*n > c+d || (a+b)*n < c-d {
			fmt.Println("No")
		} else {
			fmt.Println("Yes")
		}
	}
}

package main

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

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt() int
	NextInt64() int64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	// adjust the following size as needed
	// 2 << 17 is good enough to scan strings of len 2*10^5
	// it could go as high as 2 << 26 before cf judge breaks
	size := 2 << 20
	buf := make([]byte, size)
	s.Buffer(buf, size)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt() int {
	impl.Scan()
	bb := impl.Bytes()
	i := 0
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

func main() {
	defer writer.Flush()
	t := reader.NextInt64()
	for ; t > 0; t-- {
		n := reader.NextInt64()
		a := reader.NextInt64()
		b := reader.NextInt64()
		c := reader.NextInt64()
		d := reader.NextInt64()
		writer.Printf("%s\n", sol(n,a,b,c,d))
	}
}

func sol(n,a,b,c,d int64) string {
	maxGrain := a+b
	minGrain := a-b
	maxPack := c+d
	minPack := c-d
	if n * maxGrain >= minPack && n * minGrain <= maxPack {
		return "Yes"
	}
	return "No"
}

package main

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

func main() {
	s := NewScanner()
	t := s.NextInt()

	for i := 0; i < t; i++ {
		n, a, b, c, d := s.NextInt(), s.NextInt(), s.NextInt(), s.NextInt(), s.NextInt()

		min := n * (a - b)
		max := n * (a + b)

		if max >= c-d && min <= c+d {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}

type scanner struct {
	*bufio.Scanner
}

func NewScanner() *scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	return &scanner{s}
}

func (s *scanner) NextInt() int {
	s.Scan()
	i, _ := strconv.Atoi(s.Text())
	return i
}

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

func (s *scanner) NextString() string {
	s.Scan()
	return s.Text()
}

// https://codeforces.com/contest/1341/problem/0
package main

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

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

func main () {
	var (
		T, n, a,b,c,d int
	)

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

	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		fmt.Fscan(input, &n, &a, &b, &c, &d)
		l, r := (a - b) * n, (a + b) * n
		if l > c + d || r < c - d   {
			fmt.Println("No")
		} else {
			fmt.Println("Yes")
		}
	}
}

package main

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

func solve(n int, a int, b int, c int, d int) string {
	minPack := c - d
	maxPack := c + d
	left := (a - b) * n
	right := (a + b) * n
	mid := 0

	for left <= right {
		mid = (left + right) / 2
		if minPack <= mid && mid <= maxPack {
			return "Yes"
		}
		if mid < minPack {
			left = mid + 1
			continue
		}
		if mid > maxPack {
			right = mid - 1
			continue
		}
	}

	return "No"
}
func main() {
	r := bufio.NewReader(os.Stdin)
	var n, t, a, b, c, d int
	fmt.Fscanf(r, "%d\n", &t)

	for tc := 0; tc < t; tc++ {
		fmt.Fscanf(r, "%d %d %d %d %d\n", &n, &a, &b, &c, &d)
		fmt.Fprintf(os.Stdout, "%s\n", solve(n, a, b, c, d))
	}
}

package main

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

func main() {
	rd := bufio.NewReader(os.Stdin)
	wr := bufio.NewWriter(os.Stdout)

	var a, b, c, d, n, t, i int

	fmt.Fscanf(rd, "%d\n", &t)
	for i = 0; i < t; i++ {
		fmt.Fscanf(rd, "%d %d %d %d %d\n", &n, &a, &b, &c, &d)
		if n*(a-b) > (c + d) {
			fmt.Fprintf(wr, "No\n")
		} else if n*(a+b) < (c - d) {
			fmt.Fprintf(wr, "No\n")
		} else {
			fmt.Fprintf(wr, "Yes\n")
		}
	}

	wr.Flush()
}

// https://codeforces.com/contest/1341/problem/0
package main

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

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

func main () {
	var (
		T, n, a,b,c,d int
	)

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

	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		fmt.Fscan(input, &n, &a, &b, &c, &d)
		l, r := (a - b) * n, (a + b) * n
		if l > c + d || r < c - d   {
			println("No")
		} else {
			println("Yes")
		}
	}
}

package main

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

func solve(n int, a int, b int, c int, d int) string {
	minPack := c - d
	maxPack := c + d
	left := a - b
	right := a + b
	mid, mass := 0, 0

	for left <= right {
		mid = (left + right) / 2
		mass = mid * n
		if minPack <= mass && mass <= maxPack {
			return "Yes"
		}
		if mass < minPack {
			left = mid + 1
		}
		if mass > maxPack {
			right = mid - 1
		}
	}

	return "No"
}
func main() {
	r := bufio.NewReader(os.Stdin)
	var n, t, a, b, c, d int
	fmt.Fscanf(r, "%d\n", &t)

	for tc := 0; tc < t; tc++ {
		fmt.Fscanf(r, "%d %d %d %d %d\n", &n, &a, &b, &c, &d)
		fmt.Fprintf(os.Stdout, "%s\n", solve(n, a, b, c, d))
	}
}

package main

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

func solve(n int, a int, b int, c int, d int) string {
	minPack := c - d
	maxPack := c + d
	left := a - b
	right := a + b
	mid, mass := 0, 0

	for left <= right {
		mid = (left + right) / 2
		mass = mid * n
		if minPack <= mass && mass <= maxPack {
			return "Yes"
		}
		if mass < minPack {
			left = mid + 1
			continue
		}
		if mass > maxPack {
			right = mid - 1
			continue
		}
	}

	return "No"
}
func main() {
	r := bufio.NewReader(os.Stdin)
	var n, t, a, b, c, d int
	fmt.Fscanf(r, "%d\n", &t)

	for tc := 0; tc < t; tc++ {
		fmt.Fscanf(r, "%d %d %d %d %d\n", &n, &a, &b, &c, &d)
		fmt.Fprintf(os.Stdout, "%s\n", solve(n, a, b, c, d))
	}
}