package main

import (
	"fmt"
)

func main() {
	var t int64
	fmt.Scanln(&t)

	for ; t > 0; t -= 1 {
		var A, B int64
		fmt.Scanln(&A, &B)

		if B == 1 {
			fmt.Println("NO")
			continue
		}

		fmt.Println("YES")
		fmt.Printf("%v %v %v", A, A*B, A*(B+1))
		fmt.Println()
	}
}

package main

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

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

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

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()
	if len(os.Args[1:]) == 1 {
		file, _ := os.Open(os.Args[1])
		reader = bufio.NewReader(file)
	}

	var n int
	var a, b, j int64
	scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		scanf("%d %d\n", &a, &b)
		if b == 1 {
			printf("NO\n")
			continue
		}
		//c := gcd(a, b)
		if a%b == 0 {
			if b == 2 {
				b = 2 * b
			}
			printf("YES\n")
			printf("%d %d %d\n", a, a*(b-1), a*b)
			continue
		}
		//a = a / c
		//b = b / c
		if b == 2 {
			b = 2 * b
		}
		for j = 1; j < b; j++ {
			if j != b-j && j*a%b != 0 && (b-j)%b != 0 {
				printf("YES\n")
				printf("%d %d %d\n", j*a, (b-j)*a, a*b)
				break
			}
		}
	}

	//fmt.Println(gcd(10, 15))
}

// k1*a + k2*a = k3 *b * a
// k1 + k2 = k3 * b
// if k3 == 1, k1 + k2 == b
// k1 % b != 0, k2 % b != 0

package main

import (
	"fmt"
)

func main() {
	var testCases int
	_, err:=fmt.Scanf("%d\n", &testCases)
	if err!=nil{
		return
	}
	for i:=0; i < testCases; i++{
		var a, b uint64
		_, err = fmt.Scanf("%d %d\n", &a, &b);
		if err != nil{
			fmt.Println(err)
			return
		}
		if b == 1 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
			fmt.Println(a, (b)*a, (b+1)*a)
		}
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscanln(in, &t)

	for k := 0; k < t; k++ {
		var a, b int64
		fmt.Fscanln(in, &a, &b)
		x, y, z := a, a * (b - 1), a * b
		if b == 2 {
			x, y, z = a, a * 3, a * 4
		}
		if x % (a * b) == 0 || y % (a * b) == 0 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
			fmt.Println(x, y, z)
		}
	}
}

package main

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

func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}
func run(or io.Reader, ow io.Writer) {
	in := bufio.NewReader(or)
	out := bufio.NewWriter(ow)
	defer out.Flush()

	solve := func() {
		var A, B int64
		fmt.Fscan(in, &A, &B)
		if B == 1 {
			fmt.Fprintln(out, "NO")

		} else if B == 2 {
			fmt.Fprintln(out, "YES")
			fmt.Fprintln(out, A*1, A*(3), 2*A*B)
		}else {
			fmt.Fprintln(out, "YES")
			fmt.Fprintln(out, A*1, A*(B-1), A*B)
		}

	}

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

}

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

package main

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

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

func main() {
	defer out.Flush()
	var t int
	var a, b int64
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &a, &b)
		if b == 1 {
			Fprintln(out, "NO")
		} else {
			Fprintln(out, "YES")
			Fprintln(out, a, a*b, a*(b+1))
		}
	}
}

package main

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

var (
	reader = bufio.NewReader(os.Stdin)
	t      int
	a, b   int64
)

func solve(a, b int64) string {
	if b == 1 {
		return "NO"
	}
	return fmt.Sprintf("YES\n%d %d %d", a, 2*a*b-a, a*b*2)
}

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

package main

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

var (
	reader = bufio.NewReader(os.Stdin)
	t      int
	a, b   int64
)

func solve(a, b int64) string {
	if b == 1 {
		return "NO"
	}
	x := a
	y := a * (b - 1)
	if b == 2 {
		y = a * (2*b - 1)
	}
	return fmt.Sprintf("YES\n%d %d %d", x, y, x+y)
}

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

package main

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

type BufferIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}

var bufferIO BufferIO = BufferIO{
	bufio.NewReader(os.Stdin),
	bufio.NewWriter(os.Stdout),
}

func scanf(format string, params ...interface{}) {
	fmt.Fscanf(bufferIO.reader, format, params...)
}

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

func flush() {
	bufferIO.writer.Flush()
}

func solve() {
	var a, b int64

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

	if b == 1 {
		printf("NO\n")
	} else if b == 2 {
		printf("YES\n%d %d %d\n", a*3, a*5, a*8)
	} else {
		printf("YES\n%d %d %d\n", a*1, a*(b-1), a*b)
	}
}

func main() {
	t := 1
	scanf("%d\n", &t)
	for t > 0 {
		solve()
		t--
	}
	flush()
}

package main

import "fmt"

func main() {
	var q int
	var a,b int64
	_, err := fmt.Scan(&q)
	if err != nil {
		return
	}
	for i := 0; i<q; i++ {
		_, err := fmt.Scan(&a,&b)
		if err != nil {
			return
		}
		if b==1 {
			fmt.Println("NO")
		} else {
			var x = a
			var y = a * b
			var z = a * (b+1)

			fmt.Println("YES")
			fmt.Println(x, y, z)
		}
	}
}

package main

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

func main() {
    reader := bufio.NewReader(os.Stdin)
    input, _ := reader.ReadString('\n')

	// Get t
	t, _ := GetInt(input)

	for j:=0; j<t; j++ {
		input, _ = reader.ReadString('\n')
		var a,b int64
		a, input = GetInt64(input)
		b, _ = GetInt64(input)
		if b == 1 {
			fmt.Printf("NO")

		} else {
			fmt.Println("YES")
			fmt.Printf("%d %d %d", a, (2*b-1)*a, 2*a*b)
		}
		fmt.Println()
	}
}

// func abs(val float64) float64 {
//     if val >= 0.0 {
//         return val
//     }
//     return -val
// }

func GetInt(s string) (result int, output string) {
	iter, n := 0, len(s)
	for iter < n && s[iter] >= '0' && s[iter] <= '9' {
		iter++
	}
	result, _ = strconv.Atoi(s[:iter])
	// Skip the redundant characters
	for iter < n && (s[iter] < '0' || s[iter] > '9') {
		iter++
	}
	if iter == n {
		output = ""

	} else {
		output = s[iter:]
	}
	return
}

func GetInt64(s string) (result int64, output string) {
	iter, n := 0, len(s)
	for iter < n && s[iter] >= '0' && s[iter] <= '9' {
		iter++
	}
	result, _ = strconv.ParseInt(s[:iter], 10, 64)
	// Skip the redundant characters
	for iter < n && (s[iter] < '0' || s[iter] > '9') {
		iter++
	}
	if iter == n {
		output = ""

	} else {
		output = s[iter:]
	}
	return
}

package main

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

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

	solve := func(Case int) {
		var a, b int64
		Fscan(in, &a, &b)
		if b == 1 {
			Fprintln(out, "NO")
			return
		}
		Fprintln(out, "YES")
		b = a * b
		//Fprintln(out, a, (b-1)*a, a*b)
		Fprintln(out, a , b , a+b )
	}

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

	_leftData, _ := ioutil.ReadAll(in)
	if _s := strings.TrimSpace(string(_leftData)); _s != "" {
		panic("There is unread data：\n" + _s)
	}
}

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

package main

import (
	"bufio"
	"fmt"
	//"math/rand"
	"os"
	//"time"
)

func main() {

	r := bufio.NewReader(os.Stdin)

	//rand.Seed(time.Now().UnixNano())

	var t int

	fmt.Fscan(r, &t)

	for i := 0; i < t; i++ {
		var A, B int64

		fmt.Fscan(r, &A, &B)

		//fmt.Printf("A = %d B = %d", A, B)
		//fmt.Println()

		r, x, y, z := solve(A, B)

		if !r {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
			fmt.Printf("%d %d %d", x, y, z)
			fmt.Println()
		}
	}
}

func solve(A, B int64) (bool, int64, int64, int64) {
	if B == 1 {
		return false, -1, -1, -1
	}
	return true, int64(A), int64(A*B), int64(A+(A*B))
}

package main
import (
    "os"
    "fmt"
    "bufio"
)
var rd = bufio.NewReader(os.Stdin)
func main() {
    q := 0
    fmt.Fscan(rd, &q);
    for t := 0; t < q; t++ {
        var a, b int64
        fmt.Fscan(rd, &a, &b)
        if b == 1 {
            fmt.Println("NO")
        } else {
            fmt.Println("YES")
            fmt.Println(a, a * b, a * (b + 1))
        }
    }
}

package main

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

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

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

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

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

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

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

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

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

		}
		return initial
	}
}

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

	}
	return m

}

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

}

var t int

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

		fmt.Fscan(input, &B)
		if B == 1 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
			fmt.Println(A)
			var qq int64
			qq = int64(A) * int64(B)
			fmt.Println(qq)
			fmt.Println(qq + int64(A))
		}

	}
}

package main

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

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

	solve := func(Case int) {
		var a, b int64
		Fscan(in, &a, &b)
		if b == 1 {
			Fprintln(out, "NO")
			return
		}
		Fprintln(out, "YES")
		b *= 2
		Fprintln(out, a, (b-1)*a, a*b)
	}

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

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

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

package main

import (

	"fmt"
	"time"
	"math/rand"
	"bufio"
	"os"
)

func main() {

	r := bufio.NewReader(os.Stdin)

	rand.Seed(time.Now().UnixNano())

	var t int

	fmt.Fscan(r, &t)

	for i := 0; i < t; i++ {
		var A, B int64

		fmt.Fscan(r, &A, &B)

		//fmt.Printf("A = %d B = %d", A, B)
		//fmt.Println()

		r, x, y, z := solve(A, B)

		if !r{
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
			fmt.Printf("%d %d %d", x, y, z)
			fmt.Println()
		}
	}
}

func solve(A, B int64) (bool, int64, int64, int64)  {
	if B == 1 {
		return false, -1, -1, -1
	}
	return true, int64((5 * B - 1) * A), int64(A), int64(5 * A * B)
}

package main

import (

	"fmt"
	"time"
	"math/rand"
	"bufio"
	"os"
)

func main() {

	r := bufio.NewReader(os.Stdin)

	rand.Seed(time.Now().UnixNano())

	var t int

	fmt.Fscan(r, &t)

	for i := 0; i < t; i++ {
		var A, B int

		fmt.Fscan(r, &A, &B)

		//fmt.Printf("A = %d B = %d", A, B)
		//fmt.Println()

		r, x, y, z := solve(A, B)

		if !r{
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
			fmt.Printf("%d %d %d", x, y, z)
			fmt.Println()
		}
	}
}

func solve(A, B int) (bool, int64, int64, int64)  {
	if B == 1 {
		return false, -1, -1, -1
	}
	return true, int64((5 * B - 1) * A), int64(A), int64(5 * A * B)
}

package main

import (

	"fmt"
	"time"
	"math/rand"
	"bufio"
	"os"
)

func main() {

	r := bufio.NewReader(os.Stdin)

	rand.Seed(time.Now().UnixNano())

	var t int

	fmt.Fscan(r, &t)

	for i := 0; i < t; i++ {
		var A, B int

		fmt.Fscan(r, &A, &B)

		fmt.Printf("A = %d B = %d", A, B)
		fmt.Println()

		r, x, y, z := solve(A, B)

		if !r{
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
			fmt.Printf("%d %d %d", x, y, z)
			fmt.Println()
		}
	}
}

func solve(A, B int) (bool, int64, int64, int64)  {
	if B == 1 {
		return false, -1, -1, -1
	}
	return true, int64((5 * B - 1) * A), int64(A), int64(5 * A * B)
}

package main

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

func main() {

	r := bufio.NewReader(os.Stdin)

	var t int

	fmt.Fscan(r, &t)

	for i := 0; i < t; i++ {
		var A, B int

		fmt.Fscan(r, &A, &B)

		r, x, y, z := solve(A, B)

		if !r{

			fmt.Println("NO")
		} else {
			fmt.Println("YES")
			fmt.Printf("%d %d %d", x, y, z)
			fmt.Println()
		}
	}
}

func solve(A, B int) (bool, int, int, int)  {
	if B == 1 {
		return false, -1, -1, -1
	}
	return true, (5 * B - 1) * A, A, 5 * A * B
}

package main

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

func main() {

	r := bufio.NewReader(os.Stdin)

	var t int

	fmt.Fscan(r, &t)

	for i := 0; i < t; i++ {
		var A, B int

		fmt.Fscan(r, &A, &B)

		r, x, y, z := solve(A, B)

		if !r{
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
			fmt.Printf("%d %d %d", x, y, z)
			fmt.Println()
		}
	}
}

func solve(A, B int) (bool, int, int, int)  {
	return true, (5 * B - 1) * A, A, 5 * A * B
}

package main

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

func main() {

	r := bufio.NewReader(os.Stdin)

	var t int

	fmt.Fscan(r, &t)

	for i := 0; i < t; i++ {
		var A, B int

		fmt.Fscan(r, &A, &B)

		r, x, y, z := solve(A, B)

		if !r{
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
			fmt.Printf("%d %d %d", x, y, z)
			fmt.Println()
		}
	}
}

func solve(A, B int) (bool, int, int, int)  {
	return true, 5 * A * B,  (5 * B - 1) * A, A
}

package main

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

func main() {

	r := bufio.NewReader(os.Stdin)

	var t int

	fmt.Fscan(r, &t)

	for i := 0; i < t; i++ {
		var A, B int

		fmt.Fscan(r, &A, &B)

		r, x, y, z := solve(A, B)

		if !r{
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
			fmt.Printf("%d %d %d", x, y, z)
			fmt.Println()
		}
	}
}

func solve(A, B int) (bool, int, int, int)  {
	return true, 5 * A * B,  (5 * B - 1) * A, B * A
}

package main

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

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

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

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()
	if len(os.Args[1:]) == 1 {
		file, _ := os.Open(os.Args[1])
		reader = bufio.NewReader(file)
	}

	var n int
	var a, b, j int64
	scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		scanf("%d %d\n", &a, &b)
		//c := gcd(a, b)
		if a%b == 0 {
			if b == 2 {
				b = 2 * b
			}
			printf("YES\n")
			printf("%d %d %d\n", a, a*(b-1), a*b)
			continue
		}
		//a = a / c
		//b = b / c
		if b == 2 {
			b = 2 * b
		}
		for j = 1; j < b; j++ {
			if j != b-j && j*a%b != 0 && (b-j)%b != 0 {
				printf("YES\n")
				printf("%d %d %d\n", j*a, (b-j)*a, a*b)
				break
			}
		}
	}

	//fmt.Println(gcd(10, 15))
}

// k1*a + k2*a = k3 *b * a
// k1 + k2 = k3 * b
// if k3 == 1, k1 + k2 == b
// k1 % b != 0, k2 % b != 0

package main

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

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

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

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()
	if len(os.Args[1:]) == 1 {
		file, _ := os.Open(os.Args[1])
		reader = bufio.NewReader(file)
	}

	var n int
	var a, b, j int64
	scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		scanf("%d %d\n", &a, &b)
		//c := gcd(a, b)
		if a%b == 0 {
			printf("YES\n")
			printf("%d %d %d\n", a, a*(b-1), a*b)
			continue
		}
		//a = a / c
		//b = b / c
		if b == 2 {
			b = 2 * b
		}
		for j = 1; j < b; j++ {
			if j != b-j && j*a%b != 0 && (b-j)%b != 0 {
				printf("YES\n")
				printf("%d %d %d\n", j*a, (b-j)*a, a*b)
				break
			}
		}
	}

	//fmt.Println(gcd(10, 15))
}

// k1*a + k2*a = k3 *b * a
// k1 + k2 = k3 * b
// if k3 == 1, k1 + k2 == b
// k1 % b != 0, k2 % b != 0

package main

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

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

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

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()
	if len(os.Args[1:]) == 1 {
		file, _ := os.Open(os.Args[1])
		reader = bufio.NewReader(file)
	}

	var n int
	var a, b, j int64
	scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		scanf("%d %d\n", &a, &b)
		//c := gcd(a, b)
		if a%b == 0 {
			printf("YES\n")
			printf("%d %d %d\n", a, b, a+b)
			continue
		}
		//a = a / c
		//b = b / c
		if b == 2 {
			b = 2 * b
		}
		for j = 1; j < b; j++ {
			if j != b-j && j*a%b != 0 && (b-j)%b != 0 {
				printf("YES\n")
				printf("%d %d %d\n", j*a, (b-j)*a, a*b)
				break
			}
		}
	}

	//fmt.Println(gcd(10, 15))
}

// k1*a + k2*a = k3 *b * a
// k1 + k2 = k3 * b
// if k3 == 1, k1 + k2 == b
// k1 % b != 0, k2 % b != 0

package main

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

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

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

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()
	if len(os.Args[1:]) == 1 {
		file, _ := os.Open(os.Args[1])
		reader = bufio.NewReader(file)
	}

	var n int
	var a, b, j int64
	scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		scanf("%d %d\n", &a, &b)
		//c := gcd(a, b)
		if a%b == 0 {
			c := a / b
			printf("YES\n")
			printf("%d %d %d\n", b, (c-1)*b, a)
			continue
		}
		//a = a / c
		//b = b / c
		if b == 2 {
			b = 2 * b
		}
		for j = 1; j < b; j++ {
			if j != b-j && j*a%b != 0 && (b-j)%b != 0 {
				printf("YES\n")
				printf("%d %d %d\n", j*a, (b-j)*a, a*b)
				break
			}
		}
	}

	//fmt.Println(gcd(10, 15))
}

// k1*a + k2*a = k3 *b * a
// k1 + k2 = k3 * b
// if k3 == 1, k1 + k2 == b
// k1 % b != 0, k2 % b != 0

package main

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

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

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

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()
	if len(os.Args[1:]) == 1 {
		file, _ := os.Open(os.Args[1])
		reader = bufio.NewReader(file)
	}

	var n int
	var a, b, j int64
	scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		scanf("%d %d\n", &a, &b)
		//c := gcd(a, b)
		if a%b == 0 {
			printf("NO\n")
			continue
		}
		//a = a / c
		//b = b / c
		if b == 2 {
			b = 2 * b
		}
		for j = 1; j < b; j++ {
			if j != b-j && j*a%b != 0 && (b-j)%b != 0 {
				printf("YES\n")
				printf("%d %d %d\n", j*a, (b-j)*a, a*b)
				break
			}
		}
	}

	//fmt.Println(gcd(10, 15))
}

// k1*a + k2*a = k3 *b * a
// k1 + k2 = k3 * b
// if k3 == 1, k1 + k2 == b
// k1 % b != 0, k2 % b != 0

package main

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

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

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

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()
	if len(os.Args[1:]) == 1 {
		file, _ := os.Open(os.Args[1])
		reader = bufio.NewReader(file)
	}

	var n int
	var a, b, j int64
	scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		scanf("%d %d\n", &a, &b)
		//c := gcd(a, b)
		if a%b == 0 {
			printf("NO\n")
			continue
		}
		//a = a / c
		//b = b / c
		for j = 1; j < b; j++ {
			if j*a%b != 0 && (b-j)%b != 0 {
				printf("YES\n")
				printf("%d %d %d\n", j*a, (b-j)*a, a*b)
				break
			}
		}
	}

	//fmt.Println(gcd(10, 15))
}

// k1*a + k2*a = k3 *b * a
// k1 + k2 = k3 * b
// if k3 == 1, k1 + k2 == b
// k1 % b != 0, k2 % b != 0

package main

import (
	"fmt"
)

func main() {
	var testCases int
	_, err:=fmt.Scanf("%d\n", &testCases)
	if err!=nil{
		return
	}
	for i:=0; i < testCases; i++{
		var a, b int
		_, err = fmt.Scanf("%d %d\n", &a, &b);
		if err != nil{
			fmt.Println(err)
			return
		}
		if b == 1 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
			fmt.Println(a, (b)*a, (b+1)*a)
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var testCases int
	_, err:=fmt.Scanf("%d\n", &testCases)
	if err!=nil{
		return
	}
	for i:=0; i < testCases; i++{
		var a, b int
		_, err = fmt.Scanf("%d %d\n", &a, &b);
		if err != nil{
			fmt.Println(err)
			return
		}
		// calculate if its a no
		if a%b == 0 || b == 1 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
			fmt.Println(a, (b)*a, (b+1)*a)
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var testCases int
	_, err:=fmt.Scanf("%d\n", &testCases)
	if err!=nil{
		return
	}
	for i:=0; i < testCases; i++{
		var a, b int
		_, err = fmt.Scanf("%d %d\n", &a, &b);
		if err != nil{
			fmt.Println(err)
			return
		}
		// calculate if its a no
		if a%b == 0 || b == 1 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
			fmt.Println(a, (b-1)*a, b*a)
		}
	}
}

package main

import (
	"fmt"
	"math"
)

func main() {
	var testCases int
	_, err:=fmt.Scanf("%d\n", &testCases)
	if err!=nil{
		return
	}
	for i:=0; i < testCases; i++{
		var a, b int
		_, err = fmt.Scanf("%d %d\n", &a, &b);
		if err != nil{
			fmt.Println(err)
			return
		}
		// calculate if its a no
		if a%b == 0 || b == 1 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
			if b >= 3{
				fmt.Println(a, (b-1)*a, b*a)
			} else if b == 2{
				var firstTerm = a
				var secondTerm = (math.Pow(float64(b),2)-1) * float64(a)
				var thirdTerm = math.Pow(float64(b), 2)*float64(a)

				fmt.Println(firstTerm, secondTerm, thirdTerm)
			}
		}

	}
}

package main

import (
	"fmt"
	"math"
)

func main() {
	var testCases int
	_, err:=fmt.Scanf("%d\n", &testCases)
	if err!=nil{
		return
	}
	for i:=0; i < testCases; i++{
		var a, b int
		_, err = fmt.Scanf("%d %d\n", &a, &b);
		if err != nil{
			fmt.Println(err)
			return
		}
		// calculate if its a no
		if a%b == 0 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
			if b >= 3{
				fmt.Println(a, (b-1)*a, b*a)
			} else if b == 2{
				var firstTerm = a
				var secondTerm = (math.Pow(float64(b),2)-1) * float64(a)
				var thirdTerm = math.Pow(float64(b), 2)*float64(a)

				fmt.Println(firstTerm, secondTerm, thirdTerm)
			}
		}

	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscanln(in, &t)

	for k := 0; k < t; k++ {
		var a, b int64
		fmt.Fscanln(in, &a, &b)
		x, y, z := a, a * (b - 1), a * b
		if b == 2 {
			x, y, z = a, a * 3, a * 4
		}
		if x % b == 0 || y % b == 0 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
			fmt.Println(x, y, z)
		}
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscanln(in, &t)

	for k := 0; k < t; k++ {
		var a, b int64
		fmt.Fscanln(in, &a, &b)
		if a % b == 0 {
			fmt.Println("NO")
		} else {
			x, y, z := a * b, a, a * (b + 1)
			fmt.Println("YES")
			fmt.Println(x, y, z)
		}
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscanln(in, &t)

	for k := 0; k < t; k++ {
		var a, b int64
		fmt.Fscanln(in, &a, &b)
		if a % b == 0 {
			fmt.Println("NO")
		} else {
			x, y, z := a, a * (b - 1), a * b
			if b == 2 {
				x, y, z = a, a * 3, a * 4
			}
			if x % b == 0 || y % b == 0 {
				fmt.Println("NO")
			} else {
				fmt.Println("YES")
				fmt.Println(x, y, z)
			}
		}
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscanln(in, &t)

	for k := 0; k < t; k++ {
		var a, b int64
		fmt.Fscanln(in, &a, &b)
		if a % b == 0 {
			fmt.Println("NO")
		} else {
			x, z := a, a * b
			y := z - x
			if x % b == 0 || y % b == 0 {
				fmt.Println("NO")
			} else {
				fmt.Println("YES")
				fmt.Println(x, y, z)
			}
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	fmt.Scanln(&t)

	for ; t > 0; t -= 1 {
		var A, B int
		fmt.Scanln(&A, &B)

		if B == 1 {
			fmt.Println("NO")
			continue
		}

		fmt.Println("YES")
		fmt.Printf("%d %d %d", A, A*B, A*(B+1))
		fmt.Println()
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	fmt.Scanln(&t)

	for ; t > 0; t -= 1 {
		var A, B int
		fmt.Scanln(&A, &B)

		if B == 1 {
			fmt.Println("NO")
			return
		}

        fmt.Println("YES")
		fmt.Printf("%d %d %d", A, A*B, A*(B+1))
		fmt.Println()
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	fmt.Scanln(&t)

	for ; t > 0; t -= 1 {
		var A, B int
		fmt.Scanln(&A, &B)

		if B == 1 {
			fmt.Println("NO")
			return
		}

		fmt.Printf("%d %d %d", A, A*B, A*(B+1))
		fmt.Println()
	}
}

package main

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

func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}
func run(or io.Reader, ow io.Writer) {
	in := bufio.NewReader(or)
	out := bufio.NewWriter(ow)
	defer out.Flush()

	solve := func() {
		var n int
		fmt.Fscan(in, &n)
		a := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &a[i])
		}
		o := 1000000007
		fmt.Fprintln(out, (n)/2)
		for i := 0; i+1 < n; i += 2 {
			fmt.Fprintln(out, i+1, i+2, a[i], o)
		}
		fmt.Fprintln(out)
	}

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

}

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

package main

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

func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}
func run(or io.Reader, ow io.Writer) {
	in := bufio.NewReader(or)
	out := bufio.NewWriter(ow)
	defer out.Flush()

	solve := func() {
		var A, B int64
		fmt.Fscan(in, &A, &B)
		if B <= 2 {
			fmt.Fprintln(out, "NO")

		} else {
			fmt.Fprintln(out, "YES")
			fmt.Fprintln(out, A*1, A*(B-1), A*B)
		}

	}

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

}

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

package main

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

func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}
func run(or io.Reader, ow io.Writer) {
	in := bufio.NewReader(or)
	out := bufio.NewWriter(ow)
	defer out.Flush()

	solve := func() {
		var A, B int64
		fmt.Fscan(in, &A, &B)
		if B == 1 {
			fmt.Fprintln(out, "NO")

		} else {
			fmt.Fprintln(out, "YES")
			fmt.Fprintln(out, A*1, A*(B-1), A*B)
		}

	}

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

}

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

package main

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

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

func main() {
	defer out.Flush()
	var t int
	var a, b int64
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &a, &b)
		if b == 1 {
			Fprintln(out, "NO")
		} else {
			Fprintln(out, a, "", a*b, "", a*(b+1))
		}
	}
}

package main

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

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

func main() {
	defer out.Flush()
	var t int
	var a, b int64
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &a, &b)
		if b == 1 {
			Fprintln(out, "NO")
		} else {
			Fprintln(out, a, " ", a*b, " ", a*(b+1))
		}
	}
}

package main

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

var (
	reader = bufio.NewReader(os.Stdin)
	t      int
	a, b   int64
)

func solve(a, b int64) string {
	if b == 1 {
		return "NO"
	}
	return fmt.Sprintf("YES\n%d %d %d", a, a*(b-1), a*b)
}

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

package main

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

type BufferIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}

var bufferIO BufferIO = BufferIO{
	bufio.NewReader(os.Stdin),
	bufio.NewWriter(os.Stdout),
}

func scanf(format string, params ...interface{}) {
	fmt.Fscanf(bufferIO.reader, format, params...)
}

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

func flush() {
	bufferIO.writer.Flush()
}

func solve() {
	var a, b int64

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

	if b == 1 {
		printf("NO\n")
	} else {
		printf("YES\n%d %d %d\n", a, a*(b-1), a*b)
	}
}

func main() {
	t := 1
	scanf("%d\n", &t)
	for t > 0 {
		solve()
		t--
	}
	flush()
}

package main

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

type BufferIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}

var bufferIO BufferIO = BufferIO{
	bufio.NewReader(os.Stdin),
	bufio.NewWriter(os.Stdout),
}

func scanf(format string, params ...interface{}) {
	fmt.Fscanf(bufferIO.reader, format, params...)
}

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

func flush() {
	bufferIO.writer.Flush()
}

func solve() {
	var a, b int

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

	if b == 1 {
		printf("NO\n")
	} else {
		printf("YES\n%d %d\n", a*(b-1), a)
	}
}

func main() {
	t := 1
	scanf("%d\n", &t)
	for t > 0 {
		solve()
		t--
	}
	flush()
}

package main

import "fmt"

func main() {
	var q int
	var a,b int
	_, err := fmt.Scan(&q)
	if err != nil {
		return
	}
	for i := 0; i<q; i++ {
		_, err := fmt.Scan(&a,&b)
		if err != nil {
			return
		}
		if b==1 {
			fmt.Println("NO")
		} else {
			var x = a
			var y = a * b
			var z = a * (b+1)

			fmt.Println("YES")
			fmt.Println(x, y, z)
		}
	}
}

package main

import "fmt"

func main() {
	var q int
	var a,b int
	_, err := fmt.Scan(&q)
	if err != nil {
		return
	}
	for i := 0; i<q; i++ {
		_, err := fmt.Scan(&a,&b)
		if err != nil {
			return
		}
		if b==1 {
			println("NO")
		} else {
			var x = a
			var y = a * b
			var z = a * (b+1)

			println("YES")
			println(x, y, z)
		}
	}
}

package main

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

func main() {
    reader := bufio.NewReader(os.Stdin)
    input, _ := reader.ReadString('\n')

	// Get t
	t, _ := GetInt(input)

	for j:=0; j<t; j++ {
		input, _ = reader.ReadString('\n')
		var a,b int64
		a, input = GetInt64(input)
		b, _ = GetInt64(input)
		if a % b == 0 {
			fmt.Printf("NO")

		} else {
			fmt.Println("YES")
			fmt.Printf("%d %d %d", a, (2*b-1)*a, 2*a*b)
		}
		fmt.Println()
	}
}

// func abs(val float64) float64 {
//     if val >= 0.0 {
//         return val
//     }
//     return -val
// }

func GetInt(s string) (result int, output string) {
	iter, n := 0, len(s)
	for iter < n && s[iter] >= '0' && s[iter] <= '9' {
		iter++
	}
	result, _ = strconv.Atoi(s[:iter])
	// Skip the redundant characters
	for iter < n && (s[iter] < '0' || s[iter] > '9') {
		iter++
	}
	if iter == n {
		output = ""

	} else {
		output = s[iter:]
	}
	return
}

func GetInt64(s string) (result int64, output string) {
	iter, n := 0, len(s)
	for iter < n && s[iter] >= '0' && s[iter] <= '9' {
		iter++
	}
	result, _ = strconv.ParseInt(s[:iter], 10, 64)
	// Skip the redundant characters
	for iter < n && (s[iter] < '0' || s[iter] > '9') {
		iter++
	}
	if iter == n {
		output = ""

	} else {
		output = s[iter:]
	}
	return
}


package main

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

const (
	T_MIN      = 1
	T_MAX      = int(1e4)
	N_MIN      = 1
	N_MAX      = int(2 * 1e5)
	A_MIN      = int(-1e9)
	A_MAX      = int(1e9)
	DIFF_MAX   = A_MAX - A_MIN + 1
	ANSWER_NO  = "NO"
	ANSWER_YES = "YES"
	COLOR_BLUE = 'B'
	COLOR_RED  = 'R'
)

func diff(a int, b int) (result int) {
	result = a - b
	if result < 0 {
		result = -result
	}
	return
}

func test(n int, array []int, colors string) bool {
	//fmt.Println("test", n, array, colors)

	arrayLength := len(array)
	blues := make([]int, 0, arrayLength)
	reds := make([]int, 0, arrayLength)

	for index, color := range colors {
		switch color {
		case COLOR_BLUE:
			blues = append(blues, array[index])
		case COLOR_RED:
			reds = append(reds, array[index])
		}
	}

	sort.Ints(blues)
	/*
		for _, element := range blues {
			fmt.Println("blues", element)
		}
	*/
	/*
		for i := 0; i < len(blues)/2; i++ {
			blues[i], blues[len(blues)-i-1] = blues[len(blues)-i-1], blues[i]
		}
	*/
	sort.Ints(reds)
	/*
		for _, element := range reds {
			fmt.Println("reds", element)
		}
	*/
	/*
		for i := 0; i < len(reds)/2; i++ {
			reds[i], reds[len(reds)-i-1] = reds[len(reds)-i-1], reds[i]
		}
	*/
	//	used := make([]bool, n)
	for i := 1; i <= n; i++ {
		diffToBlue := DIFF_MAX
		if len(blues) > 0 {
			diffToBlue = blues[0] - i
		}

		diffToRed := DIFF_MAX
		if len(reds) > 0 {
			diffToRed = i - reds[0]
		}

		//fmt.Println("diffs", diffToBlue, diffToRed)
		if diffToBlue >= 0 && diffToBlue != DIFF_MAX {
			blues = blues[1:]
		} else if diffToRed >= 0 && diffToRed != DIFF_MAX {
			reds = reds[1:]
		} else {
			return false
		}
	}

	return true
}

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

	var t int
	fmt.Fscan(reader, &t)
	//fmt.Println(t)
	for i := 0; i < t; i++ {
		var n int
		fmt.Fscan(reader, &n)
		//fmt.Println(n)
		var array = make([]int, n)
		var colors string
		for j := 0; j < n; j++ {
			fmt.Fscan(reader, &array[j])
			//fmt.Print(array[j], " ")
		}
		fmt.Fscan(reader, &colors)
		//fmt.Println()
		//fmt.Println(colors)

		result := test(n, array, colors)
		if result {
			fmt.Println(ANSWER_YES)
		} else {
			fmt.Println(ANSWER_NO)
		}
	}
}

package main

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

const (
	T_MIN      = 1
	T_MAX      = int(1e4)
	N_MIN      = 1
	N_MAX      = int(2 * 1e5)
	A_MIN      = int(-1e9)
	A_MAX      = int(1e9)
	DIFF_MAX   = A_MAX - A_MIN + 1
	ANSWER_NO  = "NO"
	ANSWER_YES = "YES"
	COLOR_BLUE = 'B'
	COLOR_RED  = 'R'
)

func diff(a int, b int) (result int) {
	result = a - b
	if result < 0 {
		result = -result
	}
	return
}

func test(n int, array []int, colors string) bool {
	arrayLength := len(array)
	blues := make([]int, 0, arrayLength)
	reds := make([]int, 0, arrayLength)

	for index, color := range colors {
		switch color {
		case COLOR_BLUE:
			blues = append(blues, array[index])
		case COLOR_RED:
			reds = append(reds, array[index])
		}
	}

	sort.Ints(blues)
	sort.Ints(reds)
	for i := 1; i <= n; i++ {
		diffToBlue := DIFF_MAX
		if len(blues) > 0 {
			diffToBlue = blues[0] - i
		}

		diffToRed := DIFF_MAX
		if len(reds) > 0 {
			diffToRed = i - reds[0]
		}

		if diffToBlue >= 0 && diffToBlue != DIFF_MAX {
			blues = blues[1:]
		} else if diffToRed >= 0 && diffToRed != DIFF_MAX {
			reds = reds[1:]
		} else {
			return false
		}
	}

	return true
}

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

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

		var array = make([]int, n)
		var colors string
		for j := 0; j < n; j++ {
			fmt.Fscan(reader, &array[j])
		}
		fmt.Fscan(reader, &colors)

		result := test(n, array, colors)
		if result {
			fmt.Println(ANSWER_YES)
		} else {
			fmt.Println(ANSWER_NO)
		}
	}
}

package main

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

const maxn = 200007

var a [maxn]int
var r [maxn]int
var b [maxn]int

func solve(in *bufio.Reader) string {
	var n int
	var s string
	fmt.Fscan(in, &n)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &a[i])
	}
	fmt.Fscan(in, &s)
	var rlen, blen int
	for i := 0; i < n; i++ {
		switch s[i] {
		case 'R':
			r[rlen] = a[i]
			rlen++
		case 'B':
			b[blen] = a[i]
			blen++
		}
	}
	if rlen > 0 {
		sort.Ints(r[:rlen])
	}
	if blen > 0 {
		sort.Ints(b[:blen])
	}
	var ri, bi int
	for i := 1; i <= n; i++ {
		if bi < blen {
			if b[bi] < i {
				return "NO"
			}
			bi++
		} else { // ri < rlen
			if r[ri] > i {
				return "NO"
			}
			ri++
		}
	}
	return "YES"
}

func main() {
	var T int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &T)
	for i := 0; i < T; i++ {
		fmt.Println(solve(in))
	}
}

package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
	"runtime"
)

func die(v ...interface{}) {
	_, _, line, _ := runtime.Caller(1)
	fmt.Printf("die line %d: %v\n", line, v)
	os.Exit(-1)
}

func check(b bool) {
	if !b {
		_, _, line, _ := runtime.Caller(1)
		fmt.Printf("check failed line %d\n", line)
		os.Exit(-1)
	}
}

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

type IntHeap []int

func (h IntHeap) Len() int            { return len(h) }
func (h IntHeap) Less(i, j int) bool  { return h[i] < h[j] }
func (h IntHeap) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *IntHeap) Push(x interface{}) { *h = append(*h, x.(int)) }
func (h *IntHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

const (
	INIT = -1
)

var (
	n int
	a []int
	s string
)

func can() bool {
	up := &IntHeap{}
	down := &IntHeap{}
	heap.Init(up)
	heap.Init(down)
	for i := 0; i < n; i++ {
		if s[i] == 'B' {
			heap.Push(down, a[i])
		} else {
			heap.Push(up, a[i])
		}
	}

	for i := 1; i <= n; i++ {
		for down.Len() > 0 && (*down)[0] < i { // golang for Empty(), Top()
			heap.Pop(down)
		}
		if down.Len() > 0 && (*down)[0] >= i {
			heap.Pop(down)
			continue
		}
		if up.Len() > 0 && (*up)[0] <= i {
			heap.Pop(up)
			continue
		}
		return false
	}

	return true
}

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

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

	for ; tc > 0; tc-- {
		fmt.Fscan(r, &n)
		a = make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(r, &a[i])
		}
		fmt.Fscan(r, &s)

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

	}
}


package main
import (
	"fmt"
)
func main(){
	var t, a, b, n int
	fmt.Scanf("%d\n", &t);
	for tc := 0; tc < t; tc++ {
		fmt.Scanf("%d %d %d\n", &a, &b, &n);
		switch (n+1)%3 {
		case 0:
			fmt.Println(a^b)
		case 1:
			fmt.Println(a)
		case 2:
			fmt.Println(b)
		}
	}
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	firstRow, err := reader.ReadString('\n')
	if err != nil {
		log.Fatal(err)
	}

	var firstRowfields = strings.Fields(firstRow)
	n, err := strconv.Atoi(firstRowfields[0])
	if err != nil {
		log.Fatal(err)
	}

	for i := 0; i < n; i++ {
			line, err := reader.ReadString('\n')
			ints, err := parseInts(line)
		if err != nil {
			log.Fatal(err)
		}

		xorResult := xorNumbers(ints[0], ints[1], ints[2])

		fmt.Println(xorResult)
	}
}

func parseInts(s string) ([]int, error) {
	var (
		fields = strings.Fields(s)
		ints   = make([]int, len(fields))
		err    error
	)
	for i, f := range fields {
		ints[i], err = strconv.Atoi(f)
		if err != nil {
			return nil, err
		}
	}
	return ints, nil
}

func xorNumbers(a int, b int, n int) int {
	if n % 3 == 0 {
		return a
	}

	if n % 3 == 1 {
		return b
	}

	return a ^ b
}

package main

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

func main() {
	read := bufio.NewReader(os.Stdin)
	n, a, b, c := 0, 0, 0, 0
	fmt.Fscanf(read, "%d\n", &n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(read, "%d %d %d\n", &a, &b, &c)
		switch c % 3 {
		case 0:
			fmt.Println(a)
		case 1:
			fmt.Println(b)
		default:
			fmt.Println(a ^ b)
		}
	}
}

package main

import "fmt"

func main() {
	var T, n0, n1, n int

	fmt.Scanf("%d\r", &T)
	for i := 0; i < T; i++ {
		fmt.Scanf("%d %d %d\r", &n0, &n1, &n)
		fmt.Println(XORinacci(n0, n1, n))
	}
}

// XORinacci ...
func XORinacci(f0, f1, n int) int {
	if n%3 == 0 {
		return f0
	} else if n%3 == 1 {
		return f1
	} else {
		return f0 ^ f1
	}
}

package main

import (
  "fmt"
)

func main() {
    var t int
    _, _ = fmt.Scan(&t)
    for i := 0; i < t; i++ {
        var (a int; b int; n int)
        _, _ = fmt.Scan(&a, &b, &n)
        fmt.Println([]int{a,b,a^b}[n%3])
    }
}

package main

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

func main() {

	//stdin, err := os.Open("in.txt")
	//if err != nil {
	//	panic(err)
	//}
	//defer stdin.Close()
	stdin := os.Stdin
	reader := bufio.NewReaderSize(stdin, 1024*1024)

	//stdout, err := os.Create("test.txt")
	//if err != nil {
	//	panic(err)
	//}
	//defer stdout.Close()
	stdout := os.Stdout
	writer := bufio.NewWriterSize(stdout, 1024*1024)

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

	for i := 0; i < t; i++ {
		var a, b, n int
		fmt.Fscanf(reader, "%d %d %d\n", &a, &b, &n)
		if n%3 == 0 {
			fmt.Fprintf(writer, "%d", a)
		} else if n%3 == 1 {
			fmt.Fprintf(writer, "%d", b)
		} else {
			fmt.Fprintf(writer, "%d", a^b)
		}
		fmt.Fprintf(writer, "\n")
	}

	writer.Flush()
}

// Author: sighduck
// URL: https://codeforces.com/contest/1208/problem/A

package main

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

func Solve(a, b, n int) int {
	if n%3 == 0 {
		return a
	} else if n%3 == 1 {
		return b
	}
	return a ^ b
}

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

	var T int
	fmt.Fscanf(reader, "%d\n", &T)
	for i := 0; i < T; i++ {
		var a, b, n int
		fmt.Fscanf(reader, "%d %d %d\n", &a, &b, &n)
		fmt.Fprintf(writer, "%d\n", Solve(a, b, n))
	}
}

package main

import (
	"bufio"
	"os"
	"runtime"
	"strconv"
)

/* solution */

func solve() {

	t := readInt()
	for i := 0; i < t; i++ {
		solveOne(readInt64(), readInt64(), readInt64())
	}

}

func solveOne(a, b, n int64) {
	c := a ^ b
	n = n % 3
	switch n {
	case 0:
		printInt64(a)
	case 1:
		printInt64(b)
	case 2:
		printInt64(c)
	}
}

/* stubs */

func main() {

	var f *os.File
	if runtime.GOROOT() == "C:\\Soft\\Go" {
		f, _ = os.Open("input.txt")
		defer f.Close()
	} else {
		f = os.Stdin
	}

	writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	reader = bufio.NewScanner(f)

	const maxCapacity = 1024 * 1024
	buf := make([]byte, maxCapacity)
	reader.Buffer(buf, maxCapacity)

	reader.Split(bufio.ScanWords)

	solve()

}

var reader *bufio.Scanner
var writer *bufio.Writer

func read() string {
	reader.Scan()
	return reader.Text()
}

func readInt() int {
	reader.Scan()
	ret, _ := strconv.Atoi(reader.Text())
	return ret
}

func print(s string) {
	writer.WriteString(s)
	writer.WriteString("\n")
}

func printInt(i int) {
	print(strconv.Itoa(i))
}

func printInt64(i int64) {
	print(strconv.FormatInt(i, 10))
}

func readInt64() int64 {
	reader.Scan()
	ret, _ := strconv.ParseInt(reader.Text(), 10, 64)
	return ret
}

package main

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

func main() {
	inputreader := bufio.NewReader(os.Stdin)
	var str string
	str,_= inputreader.ReadString('\n')
	str=strings.TrimSpace(str)
	temp:=strings.Split(str," ")
	T,_:= strconv.Atoi(temp[0])
	for T>0{
		str,_= inputreader.ReadString('\n')
		str=strings.TrimSpace(str)
		temp:=strings.Split(str," ")
		a,_:= strconv.Atoi(temp[0])
		b,_:= strconv.Atoi(temp[1])
		N,_:= strconv.Atoi(temp[2])
		if (N+1)%3==0{
			fmt.Println(a^b)
		}else if (N+2)%3==0{
			fmt.Println(b)
		}else{
			fmt.Println(a)
		}

		T--
	}

}

package main

import (
	"fmt"
)

type input struct {
	a, b, n int
}

func xorinacci0(a, b, n int) int {
	var x [3]int
	x[0] = a
	x[1] = b
	x[2] = a ^ b
	return x[n%3]

}

func main() {
	var n int
	fmt.Scan(&n)
	inputs := make([]input, n)
	for i := range inputs {
		fmt.Scan(&inputs[i].a)
		fmt.Scan(&inputs[i].b)
		fmt.Scan(&inputs[i].n)
	}
	for i := range inputs {
		fmt.Println(xorinacci0(inputs[i].a, inputs[i].b, inputs[i].n))
	}
}

//HOWDY! IT'S ME! A HARD BLACKISH DICK MOVE!
package main

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

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

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

//str := PrintlnInts(X...)

/*******************************************************************/
//(1,0)(0,1),(1,1),(1,0),(0,1)
func main() {
	aa := []int{1, 0, 1}
	bb := []int{0, 1, 1}
	for t := ReadInt(); t > 0; t-- {
		a, b, n := ReadInt3()
		m := n % 3
		ans := (a * aa[m]) ^ (b * bb[m])
		fmt.Println(ans)
	}

}

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

func min(args ...int) int {
	if len(args) == 0 {
		panic("empty!")
	}
	min := args[0]
	for i := 1; i < len(args); i++ {
		if args[i] < min {
			min = args[i]
		}
	}
	return min
}

func max(args ...int) int {
	if len(args) == 0 {
		panic("empty!")
	}
	max := args[0]
	for i := 1; i < len(args); i++ {
		if args[i] > max {
			max = args[i]
		}
	}
	return max
}

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

func gcd(args ...int) int {
	if len(args) == 0 {
		panic("empty!")
	}
	gcd := args[0]
	for i := 1; i < len(args); i++ {
		gcd = _gcd(gcd, args[i])
	}
	return gcd
}

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

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

func init() {
	ReadString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9))
	// Split sets the split function for the Scanner. The default split function is ScanLines.
	// Split panics if it is called after scanning has started.
	r.Split(bufio.ScanWords)

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

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

func readInt64() int64 {
	return readIntNbits(64)
}

func readInt() int {
	return int(readIntNbits(32))
}

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

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

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

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

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

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

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

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

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

	return string(res)
}

package main

import (
"fmt"
)

func main() {
	var test int
	fmt.Scan(&test)
	for test > 0 {
		var a, b, n int
		fmt.Scan(&a, &b, &n)
		n %= 3;
		if n == 0 {
			fmt.Println(a)
		}else if n == 1 {
			fmt.Println(b)
		}else if n == 2 {
			fmt.Println(a ^ b)
		}
		test--
	}
}

package main

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

// -----------------------------------------------------------------------------

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

func IsNewLine(c byte) bool {
	switch c {
	case '\n', '\r':
		return true
	}
	return false
}

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

// -----------------------------------------------------------------------------

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// -----------------------------------------------------------------------------

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

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

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

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

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

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

func absll(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}

func main() {
	defer Flush()

	t := readi()
	for i := 0; i < t; i++ {
		a := readi()
		b := readi()
		n := readi()
		println(solve(a, b, n))
	}
}

func solve(a, b, n int) int {
	res := []int{a, b, a ^ b}
	return res[n%3]
}

package main

import (
	"fmt"
)

func main() {
	t := 0
	fmt.Scanln(&t)
	for i := 0; i < t; i++ {
		a := 0
		b := 0
		n := 0
		fmt.Scanln(&a, &b, &n)
		switch n % 3 {
		case 0:
			fmt.Println(a)
		case 1:
			fmt.Println(b)
		case 2:
			fmt.Println(a ^ b)
		}
	}
}

package main

import (
	"fmt"
)

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

		// a, b, a^b
		answer := 0
		if n % 3 == 0 {
			answer = a
		} else if n % 3 == 1 {
			answer = b
		} else {
			answer = a ^ b
		}

		fmt.Println(answer)
	}
}

package main

import "fmt"

func main() {
	var T, n0, n1, n int

	fmt.Scanf("%d", &T)
	for i := 0; i < T; i++ {
		fmt.Scanf("%d %d %d", &n0, &n1, &n)
		fmt.Println(XORinacci(n0, n1, n))
	}
}

// XORinacci ...
func XORinacci(f0, f1, n int) int {
	valMap := make(map[string]int)
	if n < 2 {
		return f0
	}
	valMap["first"] = f0
	valMap["second"] = f1

	for i := 2; i < n; i++ {
		newVal := valMap["first"] ^ valMap["second"]
		valMap["first"] = valMap["second"]
		valMap["second"] = newVal
	}

	return valMap["first"] ^ valMap["second"]
}

package main

import "fmt"

func main() {
	var T, n0, n1, n int

	fmt.Scanf("%d", &T)
	for i := 0; i < T; i++ {
		fmt.Scanf("%d %d %d", &n0, &n1, &n)
		fmt.Println(XORinacci(n0, n1, n))
	}
}

// XORinacci ...
func XORinacci(f0, f1, n int) int {
	if n < 2 {
		return f0
	}

	if n%3 == 0 {
		return f1
	} else if n%3 == 1 {
		return f1
	} else {
		return f0 ^ f1
	}
}

package main

import "fmt"

func main() {
	var T, n0, n1, n int

	fmt.Scanf("%d\r", &T)
	for i := 0; i < T; i++ {
		fmt.Scanf("%d %d %d\r", &n0, &n1, &n)
		fmt.Println(XORinacci(n0, n1, n))
	}
}

// XORinacci ...
func XORinacci(f0, f1, n int) int {
	if n < 2 {
		return f0
	}

	if n%3 == 0 {
		return f0
	} else if n%3 == 1 {
		return f1
	} else {
		return f0 ^ f1
	}
}

package main

import "fmt"

func main() {
	var T, n0, n1, n int

	fmt.Scanf("%d\r", &T)
	for i := 0; i < T; i++ {
		fmt.Scanf("%d %d %d\r", &n0, &n1, &n)
		fmt.Println("> ", n0, n1, n)
		fmt.Println(XORinacci(n0, n1, n))
	}
}

// XORinacci ...
func XORinacci(f0, f1, n int) int {
	valMap := make(map[string]int)
	if n < 2 {
		return f0
	}
	valMap["first"] = f0
	valMap["second"] = f1

	for i := 2; i < n; i++ {
		newVal := valMap["first"] ^ valMap["second"]
		valMap["first"] = valMap["second"]
		valMap["second"] = newVal
	}

	return valMap["first"] ^ valMap["second"]
}

package main

import "fmt"

func main() {
	var T, n0, n1, n int

	fmt.Scanf("%d\r", &T)
	for i := 0; i < T; i++ {
		fmt.Scanf("%d %d %d\r", &n0, &n1, &n)
		fmt.Println(XORinacci(n0, n1, n))
	}
}

// XORinacci ...
func XORinacci(f0, f1, n int) int {
	if n < 2 {
		return f0
	}

	if n%3 == 0 {
		return f1
	} else if n%3 == 1 {
		return f1
	} else {
		return f0 ^ f1
	}
}

package main

import (
  "fmt"
)

func main() {
    var (a int; b int; n int)
    _, _ = fmt.Scan(&a, &b, &n)

    fmt.Println([]int{a,b,a^b}[n%3])
}

package main
import (
	"fmt"
)
func main(){
	var t, a, b, n int
	fmt.Scanf("%d", &t);
	for tc := 0; tc < t; tc++ {
		fmt.Scanf("%d %d %d", &a, &b, &n);
		switch (n+1)%3 {
		case 0:
			fmt.Println(a^b)
		case 1:
			fmt.Println(a)
		case 2:
			fmt.Println(b)
		}
	}
}

package main

import (
"fmt"
)

func main() {
	fmt.Println("hey")
	var test int
	fmt.Scan(&test)
	for test > 0 {
		var a, b, n int
		fmt.Scan(&a, &b, &n)
		n %= 3;
		if n == 0 {
			fmt.Println(a)
		}else if n == 1 {
			fmt.Println(b)
		}else if n == 2 {
			fmt.Println(a ^ b)
		}
		test--
	}
}

package main

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

// -----------------------------------------------------------------------------

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

func IsNewLine(c byte) bool {
	switch c {
	case '\n', '\r':
		return true
	}
	return false
}

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

// -----------------------------------------------------------------------------

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// -----------------------------------------------------------------------------

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

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

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

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

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

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

func absll(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}

func main() {
	defer Flush()

	t := readi()
	for i := 0; i < t; i++ {
		a := readi()
		b := readi()
		n := readi()
		println(solve(a, b, n))
	}
}

func solve(a, b, n int) int {
	res := []int{a ^ b, (a ^ b) ^ b}
	if n == 0 {
		return a
	}
	if n == 1 {
		return a
	}
	return res[n%2]
}

package main

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

// -----------------------------------------------------------------------------

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

func IsNewLine(c byte) bool {
	switch c {
	case '\n', '\r':
		return true
	}
	return false
}

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

// -----------------------------------------------------------------------------

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// -----------------------------------------------------------------------------

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

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

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

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

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

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

func absll(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}

func main() {
	defer Flush()

	t := readi()
	for i := 0; i < t; i++ {
		a := readi()
		b := readi()
		n := readi()
		println(solve(a, b, n))
	}
}

func solve(a, b, n int) int {
	res := []int{a ^ b, (a ^ b) ^ b}
	if n == 0 {
		return a
	}
	if n == 1 {
		return b
	}
	return res[n%2]
}

package main

import (
	"fmt"
)

func main() {
	t := 0
	fmt.Scanf("%d", &t)
	for i := 0; i < t; i++ {
		a := 0
		b := 0
		n := 0
		fmt.Scanln(&a, &b, &n)
		switch n % 3 {
		case 0:
			fmt.Println(a)
		case 1:
			fmt.Println(b)
		case 2:
			fmt.Println(a ^ b)
		}
	}
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	firstRow, err := reader.ReadString('\n')
	if err != nil {
		log.Fatal(err)
	}

	var firstRowfields = strings.Fields(firstRow)
	n, err := strconv.Atoi(firstRowfields[0])
	if err != nil {
		log.Fatal(err)
	}

	for i := 0; i < n; i++ {
			line, err := reader.ReadString('\n')
			ints, err := parseInts(line)
		if err != nil {
			log.Fatal(err)
		}

		xorResult := xorNumbers(ints[0], ints[1], ints[2])

		fmt.Println("xorResult:", xorResult)
	}
}

func xorNumbers(a int, b int, n int) int {
	if n == 0 {
		return a
	}

	if n == 1 {
		return b
	}

	if n == 2 {
		return a ^ b
	}

	var xorResult int
	am1 := b
	am2 := a
	for i := 0; i < n-1; i++ {
		xorResult = am1^am2
		am2 = am1
		am1 = xorResult
	}

	return xorResult
}

func parseInts(s string) ([]int, error) {
	var (
		fields = strings.Fields(s)
		ints   = make([]int, len(fields))
		err    error
	)
	for i, f := range fields {
		ints[i], err = strconv.Atoi(f)
		if err != nil {
			return nil, err
		}
	}
	return ints, nil
}


package main

import (
	"bufio"
	"bytes"
	. "fmt"
	"io"
	"io/ioutil"
	"os"
	"sort"
)

type EM struct {
	l int64
	r int64
}

type LS []EM

func (ls LS) Swap(i, j int) {
	ls[i], ls[j] = ls[j], ls[i]
}
func (ls LS) Less(i, j int) bool {
	return ls[i].l < ls[j].l
}

func (ls LS) Len() int {
	return int(n)
}

type RS []EM

func (rs RS) Swap(i, j int) {
	rs[i], rs[j] = rs[j], rs[i]
}
func (rs RS) Less(i, j int) bool {
	return rs[i].r < rs[j].r
}

func (rs RS) Len() int {
	return int(n)
}

var n int64

func GetReaderWriter() (io.Reader, *bufio.Writer) {
	local := os.Getenv("LOCAL")
	if local == "" {
		return bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	}
	bs, _ := ioutil.ReadFile("in.txt")
	treader := bytes.NewBuffer(bs)
	reader := bufio.NewReader(treader)

	return reader, bufio.NewWriter(os.Stdout)
}

func main() {

	reader, writer := GetReaderWriter()
	defer writer.Flush()

	var t, s int64
	ems := make([]EM, 200001)

	_, _ = Fscanf(reader, "%d\n", &t)
	for t > 0 {
		t--
		var l, r, mid, i int64
		_, _ = Fscanf(reader, "%d %d\n", &n, &s)
		for i = 0; i < n; i++ {
			_, _ = Fscanf(reader, "%d %d\n", &ems[i].l, &ems[i].r)
		}
		sort.Sort(sort.Reverse(RS(ems)))
		r = ems[n/2].r
		sort.Sort(sort.Reverse(LS(ems)))
		l = ems[n/2].l

		for l < r {
			mid = (l + r) / 2
			if l == mid {
				mid++
			}
			sum := int64(0)
			cnt := int64(0)

			for i = 0; i < n; i++ {
				if mid < ems[i].l {
					sum += ems[i].l
					cnt++
				} else if ems[i].l <= mid && mid <= ems[i].r {
					if cnt >= (n+1)/2 {
						sum += ems[i].l
					} else {
						sum += mid
						cnt++
					}
				} else {
					sum += ems[i].l
				}
			}
			if cnt >= (n+1)/2 && sum <= s {
				l = mid
			} else {
				r = mid - 1
			}
		}

		_, _ = Fprintf(writer, "%d\n", l)
	}
}

package main

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

// github.com/EndlessCheng/codeforces-go
func Sol1251D(reader io.Reader, writer io.Writer) {
	search := func(n int64, f func(int64) bool) int64 {
		i, j := int64(0), n
		for i < j {
			h := (i + j) >> 1
			if f(h) {
				j = h
			} else {
				i = h + 1
			}
		}
		return i
	}
	type pair struct{ l, r int64 }
	in := bufio.NewScanner(reader)
	in.Split(bufio.ScanWords)
	out := bufio.NewWriter(writer)
	defer out.Flush()
	readInt := func() (x int64) {
		in.Scan()
		for _, b := range in.Bytes() {
			x = x*10 + int64(b-'0')
		}
		return
	}

	for q := int(readInt()); q > 0; q-- {
		n := int(readInt())
		money := readInt()
		baseCost := int64(0)
		ps := make([]pair, n)
		for i := range ps {
			ps[i].l, ps[i].r = readInt(), readInt()
			baseCost += ps[i].l
		}
		sort.Slice(ps, func(i, j int) bool { return ps[i].l > ps[j].l })
		ans := search(money+1e9+1, func(x int64) bool {
			cnt := 0
			cost := baseCost
			for _, p := range ps {
				if p.r >= x {
					cnt++
					if p.l < x {
						cost += x - p.l
					}
					if 2*cnt-1 == n {
						if p.l > x {
							return !true
						}
						return !(cost <= money)
					}
				}
			}
			return !false
		})
		Fprintln(out, ans-1)
	}
}

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

package main

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

// github.com/EndlessCheng/codeforces-go
func Sol1251D(reader io.Reader, writer io.Writer) {
	search := func(n int64, f func(int64) bool) int64 {
		i, j := int64(0), n
		for i < j {
			h := (i + j) >> 1
			if f(h) {
				j = h
			} else {
				i = h + 1
			}
		}
		return i
	}
	type pair struct{ l, r int64 }
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var q, n int
	for Fscan(in, &q); q > 0; q-- {
		var money, baseCost int64
		Fscan(in, &n, &money)
		ps := make([]pair, n)
		for i := range ps {
			Fscan(in, &ps[i].l, &ps[i].r)
			baseCost += ps[i].l
		}
		sort.Slice(ps, func(i, j int) bool { return ps[i].l > ps[j].l })
		ans := search(money+1e9+1, func(x int64) bool {
			cnt := 0
			cost := baseCost
			for _, p := range ps {
				if p.r >= x {
					cnt++
					if p.l < x {
						cost += x - p.l
					}
					if 2*cnt-1 == n {
						if p.l > x {
							return !true
						}
						return !(cost <= money)
					}
				}
			}
			return !false
		})
		Fprintln(out, ans-1)
	}
}

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

package main

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

// github.com/EndlessCheng/codeforces-go
func Sol1251D(reader io.Reader, writer io.Writer) {
	search := func(n int64, f func(int64) bool) int64 {
		i, j := int64(0), n
		for i < j {
			h := (i + j) >> 1
			if f(h) {
				j = h
			} else {
				i = h + 1
			}
		}
		return i
	}
	type pair struct{ l, r int64 }
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var q, n int
	for Fscan(in, &q); q > 0; q-- {
		var money, baseCost int64
		Fscan(in, &n, &money)
		ps := make([]pair, n)
		for i := range ps {
			Fscan(in, &ps[i].l, &ps[i].r)
			baseCost += ps[i].l
		}
		sort.Slice(ps, func(i, j int) bool { return ps[i].l > ps[j].l })
		ans := search(money+1e9+1, func(x int64) bool {
			cnt := 0
			cost := baseCost
			for _, p := range ps {
				if p.r >= x {
					cnt++
					if p.l < x {
						cost += x - p.l
					}
					if 2*cnt-1 == n {
						return !(cost <= money)
					}
				}
			}
			return !false
		})
		Fprintln(out, ans-1)
	}
}

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

package main

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

type point struct {
	x, y int
}

var ans int64

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

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
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	tt := 1
	fmt.Fscanf(in, "%d\n", &tt)
	for ii := 0; ii < tt; ii++ {
		n, s := 0, int64(0)
		fmt.Fscanf(in, "%d %d\n", &n, &s)
		a := make([][]int, n)
		for i := 0; i < n; i++ {
			a[i] = make([]int, 2)
			fmt.Fscanf(in, "%d %d\n", &a[i][0], &a[i][1])
		}
		l := 0
		r := 1000000000
		//fmt.Println("debug1", a)
		for l < r {
			mid := (l + r + 1) / 2
			//fmt.Println("debug2", l, r, mid)
			if !ok(mid, a, s) {
				r = mid - 1
			} else {
				l = mid
			}
		}
		fmt.Fprintf(out, "%d\n", l)
	}
	return
}

// if median can be larger or equal to mid
func ok(mid int, a [][]int, s int64) bool {
	n := len(a)
	b := make([]int, n) // salary
	cost := int64(0)
	c := make([]int, 0) // which can be larger then mid
	for i := 0; i < n; i++ {
		if a[i][1] >= mid {
			if a[i][0] <= mid {
				b[i] = mid
			} else {
				b[i] = a[i][0]
			}
			c = append(c, i)
		} else {
			b[i] = a[i][0]
		}
		cost += int64(b[i])
	}
	//fmt.Println("debug3", c)
	if len(c) < (n+1)/2 {
		return false
	}
	save := make([]int, 0)
	for i := 0; i < len(c); i++ {
		id := c[i]
		if a[id][0] <= mid {
			save = append(save, b[id]-a[id][0])
		}
	}

	sort.Ints(save)
	needSave := n/2 - (n - len(c))
	if needSave > len(save) {
		needSave = len(save)
	}
	for i := 0; i < needSave; i++ {
		cost -= int64(save[len(save)-1-i])
	}
	if cost <= s {
		return true
	}
	return false
}

package main

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

type point struct {
	x, y int
}

var ans int64

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

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
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	tt := 1
	fmt.Fscanf(in, "%d\n", &tt)
	for ii := 0; ii < tt; ii++ {
		n, s := 0, int64(0)
		fmt.Fscanf(in, "%d %d\n", &n, &s)
		a := make([][]int, n)
		for i := 0; i < n; i++ {
			a[i] = make([]int, 2)
			fmt.Fscanf(in, "%d %d\n", &a[i][0], &a[i][1])
		}
		l := 0
		r := 1000000000
		//fmt.Println("debug1", a)
		for l < r {
			mid := (l + r + 1) / 2
			//fmt.Println("debug2", l, r, mid)
			if !ok(mid, a, s) {
				r = mid - 1
			} else {
				l = mid
			}
		}
		fmt.Fprintf(out, "%d\n", l)
	}
	return
}

// if median can be larger or equal to mid
func ok(mid int, a [][]int, s int64) bool {
	n := len(a)
	b := make([]int, n) // salary
	cost := int64(0)
	c := make([]int, 0) // which can be larger then mid
	for i := 0; i < n; i++ {
		if a[i][1] >= mid {
			if a[i][0] <= mid {
				b[i] = mid
			} else {
				b[i] = a[i][0]
			}
			c = append(c, i)
		} else {
			b[i] = a[i][0]
		}
		cost += int64(b[i])
	}
	//fmt.Println("debug3", c)
	if len(c) < (n+1)/2 {
		return false
	}
	save := make([]int, 0)
	for i := 0; i < len(c); i++ {
		id := c[i]
		if a[id][0] <= mid {
			save = append(save, b[id]-a[id][0])
		}
	}

	sort.Ints(save)
	needSave := n/2 - (n - len(c))
	if needSave > len(save) {
		return false
	}
	for i := 0; i < needSave; i++ {
		cost -= int64(save[len(save)-1-i])
	}
	if cost <= s {
		return true
	}
	return false
}

package main

import (
	"bufio"
	"bytes"
	. "fmt"
	"io"
	"io/ioutil"
	"os"
	"sort"
)

type EM struct {
	l int64
	r int64
}

type LS []EM

func (ls LS) Swap(i, j int) {
	ls[i], ls[j] = ls[j], ls[i]
}
func (ls LS) Less(i, j int) bool {
	return ls[i].l < ls[j].l
}

func (ls LS) Len() int {
	return int(n)
}

type RS []EM

func (rs RS) Swap(i, j int) {
	rs[i], rs[j] = rs[j], rs[i]
}
func (rs RS) Less(i, j int) bool {
	return rs[i].r < rs[j].r
}

func (rs RS) Len() int {
	return int(n)
}

var n int64

func GetReaderWriter() (io.Reader, *bufio.Writer) {
	local := os.Getenv("LOCAL")
	if local == "" {
		return bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	}
	bs, _ := ioutil.ReadFile("in.txt")
	treader := bytes.NewBuffer(bs)
	reader := bufio.NewReader(treader)

	return reader, bufio.NewWriter(os.Stdout)
}

func main() {

	reader, writer := GetReaderWriter()
	defer writer.Flush()

	var t, s int64
	ems := make([]EM, 200001)

	_, _ = Fscanf(reader, "%d\n", &t)
	for t > 0 {
		t--
		var l, r, mid, i int64
		_, _ = Fscanf(reader, "%d %d\n", &n, &s)
		for i = 0; i < n; i++ {
			_, _ = Fscanf(reader, "%d %d\n", &ems[i].l, &ems[i].r)
		}
		sort.Sort(sort.Reverse(RS(ems)))
		r = ems[n/2].r
		sort.Sort(sort.Reverse(LS(ems)))
		l = ems[n/2].l

		for l < r {
			mid = (l + r) / 2
			sum := int64(0)
			cnt := int64(0)

			for i = 0; i < n; i++ {
				if mid < ems[i].l {
					sum += ems[i].l
					cnt++
				} else if ems[i].l <= mid && mid < ems[i].r {
					if cnt >= (n+1)/2 {
						sum += ems[i].l
					} else {
						sum += mid
						cnt++
					}
				} else {
					sum += ems[i].l
				}
			}
			if cnt >= (n+1)/2 && sum <= s {
				l = mid
				if r == l+1 {
					l = r
				}
			} else {
				r = mid - 1
			}
		}

		_, _ = Fprintf(writer, "%d\n", l)
	}
}


package main

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

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

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

	n := nextInt()
	a := 1

	for ; a <= n; a += 2 {
		printf("%d ", a)
	}

	if n%2 == 1 {
		a -= 2
	}

	for a -= 2; a > 0; a -= 2 {
		printf("%d ", a)
	}

	for a = 2; a <= n; a += 2 {
		printf("%d ", a)
	}

	if n%2 == 0 {
		a -= 2
	}

	for a -= 2; a > 0; a -= 2 {
		printf("%d ", a)
	}

	println(n)
}

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

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

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

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

func println(a ...interface{})               { fmt.Fprintln(writer, a...) }
func print(a ...interface{})                 { fmt.Fprint(writer, a...) }
func printf(format string, a ...interface{}) { fmt.Fprintf(writer, format, a...) }

package main

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

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

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

	n := nextInt()
	a := 1

	for ; a <= n; a += 2 {
		print(a, " ")
	}

	if n%2 == 1 {
		a -= 2
	}

	for a -= 2; a > 0; a -= 2 {
		print(a, " ")
	}

	for a = 2; a <= n; a += 2 {
		print(a, " ")
	}

	if n%2 == 0 {
		a -= 2
	}

	for a -= 2; a > 0; a -= 2 {
		print(a, " ")
	}

	println(n)
}

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

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

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

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

func println(a ...interface{})               { fmt.Fprintln(writer, a...) }
func print(a ...interface{})                 { fmt.Fprint(writer, a...) }
func printf(format string, a ...interface{}) { fmt.Fprintf(writer, format, a...) }

package main

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

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

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

	n := nextInt()

	// for i, a, end := 0, 1, n+n%2; i < end; i++ {
	// 	if i < end/2 {
	// 		printf("%d ", a)
	// 		a += 2
	// 	} else {
	// 		a -= 2
	// 		printf("%d ", a)
	// 	}
	// }

	a := 1

	for ; a <= n; a += 2 {
		printf("%d ", a)
	}

	if n%2 == 1 {
		a -= 2
	}

	for a -= 2; a > 0; a -= 2 {
		printf("%d ", a)
	}

	if n%2 == 1 {
		printf("%d ", n)
	}

	for i, a, end := 0, 2, n-n%2; i < end; i++ {
		if i < end/2 {
			printf("%d ", a)
			a += 2
		} else {
			a -= 2
			printf("%d ", a)
		}
	}

	println()
}

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

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

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

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

func println(a ...interface{})               { fmt.Fprintln(writer, a...) }
func print(a ...interface{})                 { fmt.Fprint(writer, a...) }
func printf(format string, a ...interface{}) { fmt.Fprintf(writer, format, a...) }

package main

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

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

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

	n := nextInt()

	for i, a, end := 0, 1, n+n%2; i < end; i++ {

		if i < end/2 {
			printf("%d ", a)
			a += 2
		} else {
			a -= 2
			printf("%d ", a)
		}

	}

	for i, a, end := 0, 2, n-n%2; i < end; i++ {

		if i < end/2 {
			printf("%d ", a)
			a += 2
		} else {
			a -= 2
			printf("%d ", a)
		}

	}

	println()
}

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

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

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

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

func println(a ...interface{})               { fmt.Fprintln(writer, a...) }
func print(a ...interface{})                 { fmt.Fprint(writer, a...) }
func printf(format string, a ...interface{}) { fmt.Fprintf(writer, format, a...) }


package main

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

func Readln(r *bufio.Reader) (string, error) {
	var (
		isPrefix bool  = true
		err      error = nil
		line, ln []byte
	)
	for isPrefix && err == nil {
		line, isPrefix, err = r.ReadLine()
		ln = append(ln, line...)
	}
	return string(ln), err
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	pk, _ := Readln(reader)
	k, _ := strconv.Atoi(string(pk))

	mainloop: for outi := 0 ; outi<k; outi++ {
		Readln(reader)
		ln,_ := Readln(reader)
		lnx := strings.Split(ln," ")
		l := make([] int, len(lnx))
		for i := range lnx {
			l[i], _ = strconv.Atoi(lnx[i])
		}
		mn := math.MaxInt32

		m := make(map [int] int)
		for _, val := range l {
			if val < mn {
				mn = val
			}
			m[val] ++
		}

		if m[mn] < 2 {

			fmt.Println("0")
			continue
		}

		for _, val := range l {
			if val&mn != mn {
			    fmt.Println("0")
			    continue mainloop
			}
		}
		p:= int64(1000000007)
		var res int64
		res = int64(1)

		num0 := m[mn]
		//num1 := m[1]
		others := len(l) - 2
		res = (res* int64(num0)) % p
		res = (res* int64(num0-1)) % p

		for i:=2; i<=others; i++ {
			res = (res* int64(i)) % p
		}
		ans := res % p
		if ans <0 {
			fmt.Println(-ans)
		} else {
			fmt.Println(ans)
		}

	}

}

package main

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

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

	const mx int = 3e5
	f := [mx]int64{1}
	for i := 1; i < mx; i++ {
		f[i] = f[i-1] * int64(i) % mod
	}

	solve := func(Case int) {
		var n,  c int
		Fscan(in, &n)
		a := make([]int, n)
		for i := range a {
			Fscan(in, &a[i])
		}
		s := a[0]
		for _, v := range a {
			s &= v
		}
		for _, v := range a {
			if v == s {
				c++
			}
		}
		if c < 2 {
			Fprintln(out, 0)
			return
		}

		ans := int64(c) * int64(c-1) % mod
		ans = ans * f[n-2] % mod

		Fprintln(out, ans)
	}

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

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

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

package main

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

func Readln(r *bufio.Reader) (string, error) {
	var (
		isPrefix bool  = true
		err      error = nil
		line, ln []byte
	)
	for isPrefix && err == nil {
		line, isPrefix, err = r.ReadLine()
		ln = append(ln, line...)
	}
	return string(ln), err
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	pk, _ := Readln(reader)
	k, _ := strconv.Atoi(string(pk))

	for outi := 0 ; outi<k; outi++ {
		Readln(reader)
		ln,_ := Readln(reader)
		lnx := strings.Split(ln," ")
		l := make([] int, len(lnx))
		for i := range lnx {
			l[i], _ = strconv.Atoi(lnx[i])
		}
		mn := math.MaxInt32
		tryagain:
		m := make(map [int] int)
		for _, val := range l {
			if val < mn && val >= 1 {
				mn = val
			}
			m[val] ++
		}

		if m[0] < 2 {
			if m[0] ==0 {
				for i := range l{
					l[i] -= mn
				}

				//fmt.Println(l)
				goto tryagain

			}

			fmt.Println("0")
			continue
		}
		p:= int64(1000000007)
		var res int64
		res = int64(1)

		num0 := m[0]
		//num1 := m[1]
		others := len(l) - 2
		for i:=num0-1; i<=num0; i++ {
			if i==0 {
				i=1
			}
			res = (res* int64(i)) % p
		}
		//for i:=num1-1; i<=num1; i++ {
		//	if i==0 {
		//		i=1
		//	}
		//	res = (res* int64(i)) % p
		//}
		for i:=2; i<=others; i++ {
			res = (res* int64(i)) % p
		}
		ans := res % p
		if ans <0 {
			fmt.Println(-ans)
		} else {
			fmt.Println(ans)
		}

	}

}

package main

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

func Readln(r *bufio.Reader) (string, error) {
	var (
		isPrefix bool  = true
		err      error = nil
		line, ln []byte
	)
	for isPrefix && err == nil {
		line, isPrefix, err = r.ReadLine()
		ln = append(ln, line...)
	}
	return string(ln), err
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	pk, _ := Readln(reader)
	k, _ := strconv.Atoi(string(pk))

	for outi := 0 ; outi<k; outi++ {
		Readln(reader)
		ln,_ := Readln(reader)
		lnx := strings.Split(ln," ")
		l := make([] int, len(lnx))
		for i := range lnx {
			l[i], _ = strconv.Atoi(lnx[i])
		}
		mn := math.MaxInt32
		tryagain:
		m := make(map [int] int)
		for _, val := range l {
			if val < mn && val >1 {
				mn = val
			}
			m[val] ++
		}

		if m[0] < 2 && m[1] < 2 {
			if m[0] ==0 && m[1] == 0 {
				for i := range l{
					l[i] -= mn-1
				}

				//fmt.Println(l)
				goto tryagain
			}

			fmt.Println("0")
			continue
		}
		p:= int64(1000000007)
		var res int64
		res = int64(1)

		num0 := m[0]
		num1 := m[1]
		others := len(l) - 2
		for i:=num0-1; i<=num0; i++ {
			if i==0 {
				i=1
			}
			res = (res* int64(i)) % p
		}
		for i:=num1-1; i<=num1; i++ {
			if i==0 {
				i=1
			}
			res = (res* int64(i)) % p
		}
		for i:=2; i<=others; i++ {
			res = (res* int64(i)) % p
		}
		ans := res % p
		if ans <0 {
			fmt.Println(-ans)
		} else {
			fmt.Println(ans)
		}

	}

}

package main

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

func Readln(r *bufio.Reader) (string, error) {
	var (
		isPrefix bool  = true
		err      error = nil
		line, ln []byte
	)
	for isPrefix && err == nil {
		line, isPrefix, err = r.ReadLine()
		ln = append(ln, line...)
	}
	return string(ln), err
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	pk, _ := Readln(reader)
	k, _ := strconv.Atoi(string(pk))

	for outi := 0 ; outi<k; outi++ {
		Readln(reader)
		ln,_ := Readln(reader)
		lnx := strings.Split(ln," ")
		l := make([] int, len(lnx))
		for i := range lnx {
			l[i], _ = strconv.Atoi(lnx[i])
		}
		mn := math.MaxInt32
		tryagain:
		m := make(map [int] int)
		for _, val := range l {
			if val < mn && val >1 {
				mn = val
			}
			m[val] ++
		}

		if m[0] < 2 && m[1] < 2 {
			if m[0] ==0 && m[1] == 0 {
				for i := range l{
					l[i] -= mn-1
				}

				//fmt.Println(l)
				goto tryagain
			}

			fmt.Println("0")
			continue
		}
		p:= 1000000007
		res:= 1

		num0 := m[0]
		num1 := m[1]
		others := len(l) - 2
		for i:=num0-1; i<=num0; i++ {
			if i==0 {
				i=1
			}
			res = (res*i) % p
		}
		for i:=num1-1; i<=num1; i++ {
			if i==0 {
				i=1
			}
			res = (res*i) % p
		}
		for i:=2; i<=others; i++ {
			res = (res*i) % p
		}
		ans := res % p
		if ans <0 {
			fmt.Println(-ans)
		} else {
			fmt.Println(ans)
		}

	}

}

package main

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

func Readln(r *bufio.Reader) (string, error) {
	var (
		isPrefix bool  = true
		err      error = nil
		line, ln []byte
	)
	for isPrefix && err == nil {
		line, isPrefix, err = r.ReadLine()
		ln = append(ln, line...)
	}
	return string(ln), err
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	pk, _ := Readln(reader)
	k, _ := strconv.Atoi(string(pk))

	for outi := 0 ; outi<k; outi++ {
		Readln(reader)
		ln,_ := Readln(reader)
		lnx := strings.Split(ln," ")
		l := make([] int, len(lnx))
		for i := range lnx {
			l[i], _ = strconv.Atoi(lnx[i])
		}

		m := make(map [int] int)
		for _, val := range l {
			m[val] ++
		}

		if m[0] < 2 && m[1] < 2 {
			fmt.Println("0")
			continue
		}
		p:= 1000000007
		res:= 1
		//fmt.Println(len(l), m)
		num0 := m[0]
		num1 := m[1]
		others := len(l) - 2
		for i:=2; i<=num0; i++ {
			res = (res*i) % p
		}
		for i:=2; i<=num1; i++ {
			res = (res*i) % p
		}
		for i:=2; i<=others; i++ {
			res = (res*i) % p
		}
		fmt.Println(res)

	}

}