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


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

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 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() {
	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 (
	"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 (
	"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"
	"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"
	"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"
	"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)
	}
}

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

}


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 "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"
	"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 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.Scanf("%f\n", &n)

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


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


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

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

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


package main

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

var reader io.Reader
var scanner *bufio.Scanner

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

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

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

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

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

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

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

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

func 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 partialSum []int64

type Tree struct {
	a     []int64
	incr  []int
	fixed []int
	sz    int
}

func (t *Tree) Upd(v int) {
	if v < t.sz {
		t.a[v] = t.a[v<<1] + t.a[(v<<1)|1]
	}
}

func (t *Tree) Propagate(v int, l, r int) {
	prp := t.fixed[v]
	if prp >= 0 {
		if v < t.sz {
			t.fixed[v<<1] = prp
			t.fixed[(v<<1)|1] = prp
			t.incr[v<<1] = 0
			t.incr[(v<<1)|1] = 0
		}
		t.a[v] = 0
		t.fixed[v] = -1
	}

	prp = t.incr[v]
	if prp > 0 {
		if v < t.sz {
			t.incr[v<<1] += prp
			t.incr[(v<<1)|1] += prp
		}
		t.a[v] += int64(prp) * (partialSum[r+1] - partialSum[l])
		t.incr[v] = 0
	}
}

func (t *Tree) GoAdd(v, fixed, incr, l, r, L, R int) {
	t.Propagate(v, L, R)
	if l > r {
		return
	}
	if r < L || l > R {
		return
	}
	if l <= L && R <= r {
		if fixed >= 0 {
			t.fixed[v] = fixed
			t.incr[v] = 0
			t.Propagate(v, L, R)
		}
		t.incr[v] += incr
		t.Propagate(v, L, R)
		return
	}
	t.GoAdd(v<<1, fixed, incr, l, r, L, (L+R)>>1)
	t.GoAdd((v<<1)|1, fixed, incr, l, r, (L+R)/2+1, R)
	t.Upd(v)
}

func (t *Tree) GoSum(v, l, r, L, R int) int64 {
	t.Propagate(v, L, R)
	if l > r {
		return int64(0)
	}
	if r < L || l > R {
		return int64(0)
	}
	if l <= L && R <= r {
		return t.a[v]
	}
	r1 := t.GoSum(v<<1, l, r, L, (L+R)>>1)
	r2 := t.GoSum((v<<1)|1, l, r, (L+R)/2+1, R)
	t.Upd(v)
	return r1 + r2
}

func (t *Tree) Add(l, r int, fixed int, incr int) {
	l = max(l, 0)
	r = min(r, t.sz-1)
	if l > r {
		return
	}
	t.GoAdd(1, fixed, incr, l, r, 0, t.sz-1)
}

func (t *Tree) Sum(l, r int) int64 {
	if l > r {
		return 0
	}
	res := t.GoSum(1, l, r, 0, t.sz-1)
	return res
}

func NewTree(n int) *Tree {
	sz := 1
	for sz < n {
		sz <<= 1
	}
	a := make([]int64, 2*sz+1)
	incr := make([]int, 2*sz+1)
	fixed := make([]int, 2*sz+1)
	return &Tree{a, fixed, incr, sz}
}

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

	n := NextInt()
	m := make([]int, n)
	sorted := make([]int, n)
	for i := 0; i < n; i++ {
		m[i] = NextInt()
		sorted[i] = m[i]
	}
	sort.Ints(sorted)
	// newLen := 0
	// for i := 0; i < n; i++ {
	// 	if newLen == 0 || sorted[newLen-1] != sorted[i] {
	// 		sorted[newLen] = sorted[i]
	// 		newLen++
	// 	}
	// }
	// sorted = sorted[:newLen]
	// partialSum = make([]int64, len(sorted)+1)
	// partialSum[0] = 0
	// for i := 1; i <= len(sorted); i++ {
	// 	partialSum[i] = partialSum[i-1] + int64(sorted[i-1])
	// }

	stack := make([]int, n)
	add := make([]int64, n)
	len := 0
	left := make([]int64, n)
	var sum int64
	for i := 0; i < n; i++ {
		for len > 0 && m[stack[len-1]] > m[i] {
			sum -= add[len-1]
			len--
		}
		if len > 0 {
			add[len] = int64(i-stack[len-1]) * int64(m[i])
		} else {
			add[len] = int64(i+1) * int64(m[i])
		}
		sum += add[len]
		left[i] = sum
		stack[len] = i
		// stderr("left", i, "=", sum)
		len++
	}

	len = 0
	right := make([]int64, n)
	sum = 0
	for i := n - 1; i >= 0; i-- {
		for len > 0 && m[stack[len-1]] > m[i] {
			sum -= add[len-1]
			len--
		}
		if len > 0 {
			add[len] = int64(stack[len-1]-i) * int64(m[i])
		} else {
			add[len] = int64(n-i) * int64(m[i])
		}
		sum += add[len]
		right[i] = sum
		stack[len] = i
		len++
		// stderr("right", i, "=", sum)
	}
	// tree := NewTree(newLen)
	// left := make([]int64, n)
	// right := make([]int64, n)
	// for i := 0; i < n; i++ {
	// 	pos:= sort.SearchInts(sorted, m[i])
	// 	tree.Add(0, pos, -1, 1)
	// 	tree.Add(pos+1, len(sorted)-1, 0, 0)
	// 	left[i] = tree.Sum(0, pos)
	// 	// stderr("left", i, left[i])
	// }
	// tree = NewTree(newLen)
	// for i := n - 1; i >= 0; i-- {
	// 	pos := sort.SearchInts(sorted, m[i])
	// 	tree.Add(0, pos, -1, 1)
	// 	tree.Add(pos+1, len(sorted)-1, 0, 0)
	// 	right[i] = tree.Sum(0, pos)
	// 	// stderr("right", i, right[i])
	// }

	var res int64
	var resI int

	for i := 0; i < n; i++ {
		if i == 0 || left[i]+right[i]-int64(m[i]) > res {
			res = left[i] + right[i] - int64(m[i])
			resI = i
		}
	}

	// stderr("resi", resI, "sum", res)

	resarrr := make([]int, n)
	resarrr[resI] = m[resI]

	for i := resI - 1; i >= 0; i-- {
		resarrr[i] = resarrr[i+1]
		if m[i] < resarrr[i] {
			resarrr[i] = m[i]
		}
	}
	for i := resI + 1; i < n; i++ {
		resarrr[i] = resarrr[i-1]
		if m[i] < resarrr[i] {
			resarrr[i] = m[i]
		}
	}

	for i := 0; i < n; i++ {
		fmt.Fprint(out, resarrr[i], " ")
	}
}

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()
	min := func(a, b int) int {
		if a < b {
			return a
		}
		return b
	}

	var n int
	Fscan(in, &n)
	a := make([]int, n)
	for i := range a {
		Fscan(in, &a[i])
	}

	type pair struct{ v, i int }
	posL := make([]int, n)
	stack := []pair{{0, -1}}
	for i, v := range a {
		for {
			if top := stack[len(stack)-1]; top.v <= v {
				posL[i] = top.i
				break
			}
			stack = stack[:len(stack)-1]
		}
		stack = append(stack, pair{v, i})
	}
	posR := make([]int, n)
	stack = []pair{{0, n}}
	for i := n - 1; i >= 0; i-- {
		v := a[i]
		for {
			if top := stack[len(stack)-1]; top.v <= v {
				posR[i] = top.i
				break
			}
			stack = stack[:len(stack)-1]
		}
		stack = append(stack, pair{v, i})
	}

	dpl := make([]int64, n)
	dpl[0] = int64(a[0])
	for i := 1; i < n; i++ {
		l := posL[i]
		dpl[i] = int64(a[i]) * int64(i-l)
		if l >= 0 {
			dpl[i] += dpl[l]
		}
	}
	dpr := make([]int64, n)
	dpr[n-1] = int64(a[n-1])
	for i := n - 2; i >= 0; i-- {
		r := posR[i]
		dpr[i] = int64(a[i]) * int64(r-i)
		if r < n {
			dpr[i] += dpr[r]
		}
	}

	maxAns, maxPos := int64(0), 0
	for i, v := range a {
		if ans := dpl[i] + dpr[i] - int64(v); ans > maxAns {
			maxAns, maxPos = ans, i
		}
	}

	ans := make([]interface{}, n)
	curMax := a[maxPos]
	for j := maxPos; j >= 0; j-- {
		curMax = min(curMax, a[j])
		ans[j] = curMax
	}
	curMax = a[maxPos]
	for j := maxPos + 1; j < n; j++ {
		curMax = min(curMax, a[j])
		ans[j] = curMax
	}
	Fprint(out, ans...)
}

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

package main

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

type node struct {
	val    int
	length int
}

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++ {
		n := 0
		fmt.Fscanf(in, "%d\n", &n)
		a := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscanf(in, "%d", &a[i])
		}
		fmt.Fscanf(in, "\n")
		f1 := make([]int64, n)
		f2 := make([]int64, n)
		st := make([]node, 0)
		st = append(st, node{a[0], 1})
		curVal := int64(a[0])
		f1[0] = curVal
		for i := 1; i < n; i++ {
			curLength := 1
			for len(st) > 0 && st[len(st)-1].val >= a[i] {
				curLength += st[len(st)-1].length
				curVal -= int64(st[len(st)-1].length) * int64(st[len(st)-1].val)
				st = st[:len(st)-1]
			}
			curVal = curVal + int64(curLength)*int64(a[i])
			st = append(st, node{a[i], curLength})
			f1[i] = curVal
		}
		curVal = int64(a[n-1])
		f2[n-1] = curVal
		st = []node{node{a[n-1], 1}}
		for i := n - 2; i >= 0; i-- {
			curLength := 1
			for len(st) > 0 && st[len(st)-1].val >= a[i] {
				curLength += st[len(st)-1].length
				curVal -= int64(st[len(st)-1].length) * int64(st[len(st)-1].val)
				st = st[:len(st)-1]
			}
			curVal = curVal + int64(curLength)*int64(a[i])
			st = append(st, node{a[i], curLength})
			f2[i] = curVal
		}
		//fmt.Println(f1)
		//fmt.Println(f2)

		bestAns := f1[0] + f2[0] - int64(a[0])
		ans := 0
		for i := 1; i < n; i++ {
			//fmt.Println(bestAns, ans)
			if f1[i]+f2[i]-int64(a[i]) > bestAns {
				bestAns = f1[i] + f2[i] - int64(a[i])
				ans = i
			}
		}
		for i := ans - 1; i >= 0; i-- {
			if a[i] > a[i+1] {
				a[i] = a[i+1]
			}
		}
		for i := ans + 1; i < n; i++ {
			if a[i] > a[i-1] {
				a[i] = a[i-1]
			}
		}
		fmt.Fprintf(out, "%d", a[0])
		for i := 1; i < n; i++ {
			fmt.Fprintf(out, " %d", a[i])
		}
		fmt.Fprintf(out, "\n")
	}
	return
}

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 n int
	Fscan(in, &n)
	a := make([]int, n)
	sum := make([]int64, n+1)
	for i := range a {
		Fscan(in, &a[i])
		sum[i+1] = sum[i] + int64(a[i])
	}

	type pair struct{ v, i int }
	posL := make([]int, n)
	stack := []pair{{0, -1}}
	for i, v := range a {
		for {
			if top := stack[len(stack)-1]; top.v <= v {
				posL[i] = top.i
				break
			}
			stack = stack[:len(stack)-1]
		}
		stack = append(stack, pair{v, i})
	}
	posR := make([]int, n)
	stack = []pair{{0, n}}
	for i := n - 1; i >= 0; i-- {
		v := a[i]
		for {
			if top := stack[len(stack)-1]; top.v <= v {
				posR[i] = top.i
				break
			}
			stack = stack[:len(stack)-1]
		}
		stack = append(stack, pair{v, i})
	}

	dpl := make([]int64, n)
	dpl[0] = int64(a[0])
	for i, v := range a {
		if i == 0 {
			continue
		}
		l := posL[i]
		dpl[i] = int64(v)
		if l == -1 {
			dpl[i] += int64(a[i]) * int64(i)
		} else {
			dpl[i] += int64(a[i])*int64(i-l-1) + dpl[l]
		}
	}

	dpr := make([]int64, n)
	dpr[n-1] = int64(a[n-1])
	for i := n - 1; i >= 0; i-- {
		v := a[i]
		if i == n-1 {
			continue
		}
		r := posR[i]
		dpr[i] = int64(v)
		if r == n {
			dpr[i] += int64(v) * int64(n-1-i)
		} else {
			dpr[i] += int64(v)*int64(r-1-i) + dpr[r]
		}
	}

	maxAns := int64(0)
	maxPos := 0
	for i, di := range dpl {
		ans := di+dpr[i]-int64(a[i])
		if ans > maxAns {
			maxAns = ans
			maxPos = i
		}
	}

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

	ans := make([]int, n)
	ans[maxPos] = a[maxPos]

	top := a[maxPos]
	tmpMax := top
	for j := maxPos; j >= 0; j-- {
		tmpMax = min(tmpMax, a[j])
		ans[j] = tmpMax
	}
	tmpMax = top
	for j := maxPos + 1; j < n; j++ {
		tmpMax = min(tmpMax, a[j])
		ans[j] = tmpMax

	}
	for i, v := range ans {
		if i > 0 {
			Fprint(out, " ")
		}
		Fprint(out, v)
	}
}

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


// 186A-mic_rizal
package main

import (
	"fmt"
)

func main() {
	var a, b string
	var in []int
	var x int
	fmt.Scan(&a, &b)

	if len(a) != len(b) {
		fmt.Println("NO")
		return
	}

	for i := 0; i < len(b); i++ {
		if a[i] != b[i] {
			in = append(in, i)
			x++
		}
	}

	if x != 2 {
		fmt.Println("NO")
	} else {
		if a[in[0]] == b[in[1]] && a[in[1]] == b[in[0]] {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

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

	var a, b string
	fmt.Fscanf(reader, "%s\n", &a)
	fmt.Fscanf(reader, "%s\n", &b)
	aLen := len(a)
	bLen := len(b)
	if aLen != bLen {
		fmt.Fprintf(writer, "NO\n")
		return
	}
	arr1 := []byte(a)
	arr2 := []byte(b)
	diff := make([]int, 0)
	for idx := 0; idx < aLen; idx++ {
		if arr1[idx] != arr2[idx] {
			diff = append(diff, idx)
		}
	}
	diffLen := len(diff)
	if diffLen != 2 {
		fmt.Fprintf(writer, "NO\n")
	} else {
		arr1[diff[0]], arr1[diff[1]] = arr1[diff[1]], arr1[diff[0]]
		if string(arr1) == string(arr2) {
			fmt.Fprintf(writer, "YES\n")
		} else {
			fmt.Fprintf(writer, "NO\n")
		}
	}
}

package main

import (
	"fmt"
)

func main() {

	var (
		i, j, na, nb int32
		a, b, ans    string
	)

	fmt.Scan(&a)
	fmt.Scan(&b)

	na = int32(len(a))
	nb = int32(len(b))

	//	println("na,nb=", na, nb)

	ans = "NO"
	for na == nb {

		for i = 0; i < na && a[i] == b[i]; i++ {
		}
		if i == na {
			break
		}

		j = i
		i++
		for ; i < na && a[i] == b[i]; i++ {
		}

		if i == na {
			break
		}

		if a[j] != b[i] || a[i] != b[j] {
			break
		}

		if a[i+1:] == b[i+1:] {
			ans = "YES"
		}
		break
	} // kulso

	fmt.Println(ans)

}

package main

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

func main() {
    reader := bufio.NewReader(os.Stdin)
    var a,b string
    fmt.Fscan(reader,&a)
    fmt.Fscan(reader,&b)
    ans := "YES"
    if len(a) != len(b) {
        ans = "NO"
    } else {
        j, check := -1, false
        for i := 0; i < len(a); i++ {
            if a[i] != b[i] {
                if j == -1 {
                    ans = "NO"
                    j = i
                } else if (!check) && (a[i] == b[j]) && (a[j] == b[i]) {
                    ans = "YES"
                    check = true
                } else {
                    ans = "NO"
                    break
                }
            }
        }
    }
    fmt.Println(ans)
}

package main

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

func main() {
    reader := bufio.NewReader(os.Stdin)
    var a,b string
    fmt.Fscan(reader,&a)
    fmt.Fscan(reader,&b)
    ans := "YES"
    if len(a) != len(b) {
        ans = "NO"
    } else {
        cnt := 0
        for i := 0; i < len(a); i++ {
            if a[i] != b[i] { cnt++ }
            if cnt > 2 { break }
        }
        if cnt%2 != 0 { ans = "NO" }
    }
    fmt.Println(ans)
}

package main

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

func main() {
    reader := bufio.NewReader(os.Stdin)
    var a,b string
    fmt.Fscan(reader,&a)
    fmt.Fscan(reader,&b)
    ans := "YES"
    if len(a) != len(b) {
        ans = "NO"
    } else {
        j, check := -1, false
        for i := 0; i < len(a); i++ {
            if a[i] != b[i] {
                if j == -1 {
                    j = i
                } else if (!check) && (a[i] == b[j]) && (a[j] == b[i]) {
                    check = true
                } else {
                    ans = "NO"
                    break
                }
            }
        }
    }
    fmt.Println(ans)
}

package main

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

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

	var a, b string
	fmt.Fscanf(reader, "%s\n", &a)
	fmt.Fscanf(reader, "%s\n", &b)
	aLen := len(a)
	bLen := len(b)
	if aLen != bLen {
		fmt.Fprintf(writer, "NO\n")
		return
	}
	arr1 := []byte(a)
	arr2 := []byte(b)
	diff := make([]int, 0)
	for idx := 0; idx < aLen; idx++ {
		if arr1[idx] != arr2[idx] {
			diff = append(diff, idx)
		}
	}
	diffLen := len(diff)
	if diffLen != 2 {
		fmt.Fprintf(writer, "NO\n")
	} else {
		arr1[diff[0]], arr1[diff[1]] = arr1[diff[1]], arr1[diff[0]]
		if string(arr1) == string(arr2) {
			fmt.Fprintf(writer, "YES\n")
		}
	}
}

package main

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

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

	var a, b string
	fmt.Fscanf(reader, "%s\n", &a)
	fmt.Fscanf(reader, "%s\n", &b)
	aLen := len(a)
	bLen := len(b)
	if aLen != bLen {
		fmt.Fprintf(writer, "NO\n")
	}
	arr1 := []byte(a)
	arr2 := []byte(b)
	diff := make([]int, 0)
	for idx := 0; idx < aLen; idx++ {
		if arr1[idx] != arr2[idx] {
			diff = append(diff, idx)
		}
	}
	diffLen := len(diff)
	if diffLen != 2 {
		fmt.Fprintf(writer, "NO\n")
	} else {
		arr1[diff[0]], arr1[diff[1]] = arr1[diff[1]], arr1[diff[0]]
		if string(arr1) == string(arr2) {
			fmt.Fprintf(writer, "YES\n")
		}
	}
}


package main

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

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

  r, _ := reader.ReadString('\n')
  s, _ := reader.ReadString('\n')
  r, s = strings.TrimSpace(r), strings.TrimSpace(s)
  x, y := len(r), len(s)
  result := 0
  for a := 1; a <= x && a <= y; a++ {
    if x%a != 0 || y%a != 0 {
      continue
    }
    okay := true
    for start := a; start < x; start += a {
      for i := 0; i < a; i++ {
        if r[start+i] != r[i] {
          okay = false
          break
        }
      }
    }
    if !okay {
      continue
    }
    for start := 0; start < y; start += a {
      for i := 0; i < a; i++ {
        if s[start+i] != r[i] {
          okay = false
          break
        }
      }
    }
    if okay {
      result++
    }
  }
  writer.WriteString(fmt.Sprintf("%d\n", result))
}

package main

import (
	"fmt"
)

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

func main() {
	var s1, s2 string
	fmt.Scanf("%s\n", &s1)
	fmt.Scanf("%s\n", &s2)

	l := gcd(len(s1), len(s2))

	ans := 0
	for i := 1;i <= l;i ++ {
		if l % i == 0 {
			s := s1[:i]
			var flag bool
			for j := 0;j < len(s1);j ++ {
				if s1[j] != s[j % i] {
					flag = true
				}
			}
			if flag {
				continue
			}
			for j := 0;j < len(s2);j ++ {
				if s2[j] != s[j % i] {
					flag = true
				}
			}
			if !flag {
				ans ++
			}
		}
	}
	fmt.Printf("%d", ans)

}

package main

import "fmt"

func next(p string) []int {
	next := make([]int, len(p)+1)
	next[0] = -1
	for i, j := 0, -1; i < len(p); {
		if j == -1 || p[i] == p[j] {
			i++
			j++
			next[i] = j
		} else {
			j = next[j]
		}
	}
	return next
}

func divisor(s1, s2 string) {
	var count int
	next1 := next(s1)
	next2 := next(s2)
	minFix1 := len(s1) - next1[len(s1)]
	minFix2 := len(s2) - next2[len(s2)]
	switch {
	case len(s1)%minFix1 == 0 && len(s2)%minFix2 == 0:
		if s1[:minFix1] == s2[:minFix2] {
			for i := minFix1; i <= len(s1) && i <= len(s2); i = minFix1 + i {
				if (len(s1)%i + len(s2)%i) == 0 {
					count++
				}
			}
		}
	case len(s1)%minFix1 != 0 && len(s2)%minFix2 == 0:
		if len(s1) < len(s2) && len(s1)%minFix2 == 0 {
			if s1 == s2[:len(s1)] {
				count = 1
			}
		}
	case len(s1)%minFix1 == 0 && len(s2)%minFix2 != 0:
		if len(s2) < len(s1) && len(s2)%minFix1 == 0 {
			if s2 == s1[:len(s2)] {
				count = 1
			}
		}
	case len(s1)%minFix1 != 0 && len(s2)%minFix2 != 0:
		if s1 == s2 {
			count = 1
		}
	}
	fmt.Println(count)
}
func main() {
	var s1, s2 string
	fmt.Scan(&s1, &s2)
	divisor(s1, s2)
}

package main

import "fmt"

func next(p string) []int {
	next := make([]int, len(p)+1)
	next[0] = -1
	for i, j := 0, -1; i < len(p); {
		if j == -1 || p[i] == p[j] {
			i++
			j++
			next[i] = j
		} else {
			j = next[j]
		}
	}
	return next
}

func divisor(s1, s2 string) {
	var count int
	next1 := next(s1)
	next2 := next(s2)
	minFix1 := len(s1) - next1[len(s1)]
	minFix2 := len(s2) - next2[len(s2)]
	switch {
	case len(s1)%minFix1 == 0 && len(s2)%minFix2 == 0:
		if s1[:minFix1] == s2[:minFix2] {
			for i := minFix1; (len(s1)%i + len(s2)%i) == 0; i = i * 2 {
				count++
			}
		}
	case len(s1)%minFix1 != 0 && len(s2)%minFix2 == 0:
		if len(s1) < len(s2) && len(s1)%minFix2 == 0 {
			if s1 == s2[:len(s1)] {
				count = 1
			}
		}
	case len(s1)%minFix1 == 0 && len(s2)%minFix2 != 0:
		if len(s2) < len(s1) && len(s2)%minFix1 == 0 {
			if s2 == s1[:len(s2)] {
				count = 1
			}
		}
	case len(s1)%minFix1 != 0 && len(s2)%minFix2 != 0:
		if s1 == s2 {
			count = 1
		}
	}
	fmt.Println(count)
}
func main() {
	var s1, s2 string
	fmt.Scan(&s1, &s2)
	divisor(s1, s2)
}