You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$. You need to construct an array $$$a_1,a_2,\dots,a_n$$$ ($$$l\le a_i\le r$$$) such that $$$\gcd(i,a_i)$$$ are all distinct or report there's no solution.Here $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$.

The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows. The first line contains three integers $$$n$$$, $$$l$$$, $$$r$$$ ($$$1 \le n \le 10^5$$$, $$$1\le l\le r\le 10^9$$$). It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^5$$$.

For each test case, if there is no solution, print "NO" (without quotes). You can print letters in any case (upper or lower). Otherwise, print "YES" (without quotes). In the next line, print $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ — the array you construct. If there are multiple solutions, you may output any.

package main

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

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

func ans() {
	var n int
	var l int
	var r int
	Fscan(in, &n, &l, &r)
	var flag bool = true
	var a []int = make([]int, n)
	for i := 1; i <= n; i++ {
		var pos int = i - 1
		var mod int = l % i
		if mod == 0 {
			a[pos] = l
		} else {
			var result int = l + i - mod
			if result >= l && result <= r {
				a[pos] = l + i - mod
			} else {
				flag = false
				break
			}
		}
	}
	if flag {
		Fprintln(out, "YES")
		for i := 0; i < n; i++ {
			Fprint(out, a[i], " ")
		}
		Fprintln(out)
	} else {
		Fprintln(out, "NO")
	}
}

func main() {
	defer out.Flush()
	var t int
	Fscan(in, &t)
	for i := 0; i < t; i++ {
		ans()
	}
}

package main

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

func ans(in *bufio.Reader, out *bufio.Writer) {
	var n int
	var l int
	var r int
	Fscan(in, &n, &l, &r)
	var flag bool = true
	var a []int = make([]int, n)
	for i := 1; i <= n; i++ {
		var pos int = i - 1
		var mod int = l % i
		if mod == 0 {
			a[pos] = l
		} else {
			var result int = l + i - mod
			if result >= l && result <= r {
				a[pos] = l + i - mod
			} else {
				flag = false
				break
			}
		}
	}
	if flag {
		Fprintln(out, "YES")
		for i := 0; i < n; i++ {
			Fprint(out, a[i], " ")
		}
		Fprintln(out)
	} else {
		Fprintln(out, "NO")
	}
}

func main() {
	var in *bufio.Reader = bufio.NewReader(os.Stdin)
	var out *bufio.Writer = bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	Fscan(in, &t)
	for i := 0; i < t; i++ {
		ans(in, out)
	}
}

package main

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

var bufferedStdin = bufio.NewReader(os.Stdin)
var bufferedStdout = bufio.NewWriter(os.Stdout)

func solve() {
	var n, l, r int32
	_, _ = fmt.Fscan(bufferedStdin, &n, &l, &r)
	for i := int32(0); i < n; i++ {
		possibleValue := r / (i + 1) * (i + 1)
		if possibleValue < l || possibleValue > r {
			_, _ = fmt.Fprint(bufferedStdout, "NO\n")
			return
		}
	}
	_, _ = fmt.Fprint(bufferedStdout, "YES\n")
	for i := int32(0); i < n; i++ {
		possibleValue := r / (i + 1) * (i + 1)
		_, _ = fmt.Fprintf(bufferedStdout, "%d ", possibleValue)
	}
	_, _ = fmt.Fprint(bufferedStdout, "\n")
}

func main() {
	var t int32
	_, _ = fmt.Fscan(bufferedStdin, &t)
	for ; t > 0; t-- {
		solve()
	}
	_ = bufferedStdout.Flush()
}

package main

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

var bufferedStdin = bufio.NewReader(os.Stdin)

func solve() {
	var n, l, r int32
	_, _ = fmt.Fscan(bufferedStdin, &n, &l, &r)
	for i := int32(0); i < n; i++ {
		possibleValue := r / (i + 1) * (i + 1)
		if possibleValue < l || possibleValue > r {
			fmt.Print("NO\n")
			return
		}
	}
	fmt.Print("YES\n")
	for i := int32(0); i < n; i++ {
		possibleValue := r / (i + 1) * (i + 1)
		fmt.Printf("%d ", possibleValue)
	}
	fmt.Print("\n")
}

func main() {
	var t int32
	_, _ = fmt.Fscan(bufferedStdin, &t)
	for ; t > 0; t-- {
		solve()
	}
}

package main

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

var bufferedStdin = bufio.NewReader(os.Stdin)

func solve() {
	var n, l, r int32
	_, _ = fmt.Fscan(bufferedStdin, &n, &l, &r)
	a := make([]int32, n)
	for i := int32(0); i < n; i++ {
		possibleValue := r / (i + 1) * (i + 1)
		if possibleValue < l || possibleValue > r {
			fmt.Print("NO\n")
			return
		}
		a[i] = possibleValue
	}
	fmt.Print("YES\n")
	for _, value := range a {
		fmt.Printf("%d ", value)
	}
	fmt.Print("\n")
}

func main() {
	var t int32
	_, _ = fmt.Fscan(bufferedStdin, &t)
	for ; t > 0; t-- {
		solve()
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)
var a = [2000010]int64{}
var n, m, k, l, r int64
var scanner = bufio.NewScanner(os.Stdin)
const maxCapacity = 1024*1024*4
var buf= make([]byte, maxCapacity)
func init()  {
	scanner.Buffer(buf, maxCapacity)
}
func min(a ...int) int{
	ans := a[0]
	for _, val := range a {
		if ans > val {
			ans = val
		}
	}
	return ans
}
func scan(arr []int64) {
	scanner.Scan()
	str := strings.Split(scanner.Text(), " ")
	for i:= 0; i < min(len(str), len(arr)); i++ {
		arr[i], _ = strconv.ParseInt(str[i], 10, 64)
	}
}
func scanf(arr ...*int64) {
	scanner.Scan()
	str := strings.Split(scanner.Text(), " ")
	for i:= 0; i < min(len(str), len(arr)); i++ {
		*arr[i], _ = strconv.ParseInt(str[i], 10, 64)
	}
}

func solve() {
	scanf(&n, &l, &r)
	var get = func(i int64) bool {
		a[i] = l / i * i
		if a[i] < l {a[i]+=i}
		if a[i] > r {return true}
		return false
	}
	for i := n-n+1; i <= n; i++ {
		if get(i) {
			fmt.Println("NO")
			return
		}
	}
	fmt.Println("YES")
	for _, v := range a[1:n+1] {
		fmt.Printf("%v ", v)
	}
	fmt.Println()
}

func main() {
	scanf(&k)
	for i:=k; i > 0; i-- {
		solve()
	}
}

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

func main() {

    in := bufio.NewReader(os.Stdin)
    testCase := readInt(in)

    for testCase > 0 {
        f := readArrInt64(in)
        n := f[0]
        l := f[1]
        r := f[2]

        mp := make(map[int64]bool)

        hasRes := true
        var res []int64
        var i int64
        i = 1
        for i=1; i<=n; i++ {
            val := ((l-1)/i) + 1

            curVal := val * i
            if curVal > r {
                hasRes = false
                break
            }
            gcd := findGCD(i, curVal)
            if _, v := mp[gcd]; !v {

                mp[gcd] = true
                res = append(res,  curVal)
            } else {
                for true {
                    if curVal + i > r {
                        hasRes = false
                        break
                    }
                    igcd := findGCD(i, curVal + i)
                    if _, iv := mp[igcd]; !iv {
                        mp[igcd] = true
                        res = append(res,  curVal + i)
                        break
                    } else {
                        curVal = curVal + i
                    }

                }
            }
        }
        if hasRes {
            fmt.Println("YES")
            fmt.Printf("%d", res[0])
            for i=1; i<n; i++ {
                fmt.Printf(" %d", res[i])
            }
            fmt.Printf("\n")
        } else  {
            fmt.Println("NO")
        }

        testCase--
    }
}

func findGCD(first, second int64) int64 {
	if first == 0 {
		return second
	}
	// recursively call findGCD
	return findGCD(second % first, first)
}

func readInt(in *bufio.Reader) int {
	nStr, _ := in.ReadString('\n')
	nStr = strings.ReplaceAll(nStr, "\r", "")
	nStr = strings.ReplaceAll(nStr, "\n", "")
	n, _ := strconv.Atoi(nStr)
	return n
}

func readInt64(in *bufio.Reader) int64 {
	nStr, _ := in.ReadString('\n')
	nStr = strings.ReplaceAll(nStr, "\r", "")
	nStr = strings.ReplaceAll(nStr, "\n", "")
	n, _ := strconv.ParseInt(nStr, 10, 64)
	return n
}

func readLineNumbs(in *bufio.Reader) []string {
	line, _ := in.ReadString('\n')
	line = strings.ReplaceAll(line, "\r", "")
	line = strings.ReplaceAll(line, "\n", "")
	numbs := strings.Split(line, " ")
	return numbs
}

func readArrInt(in *bufio.Reader) []int {
	numbs := readLineNumbs(in)
	arr := make([]int, len(numbs))
	for i, n := range numbs {
		val, _ := strconv.Atoi(n)
		arr[i] = val
	}
	return arr
}

func readArrInt64(in *bufio.Reader) []int64 {
	numbs := readLineNumbs(in)
	arr := make([]int64, len(numbs))
	for i, n := range numbs {
		val, _ := strconv.ParseInt(n, 10, 64)
		arr[i] = val
	}
	return arr
}

package main

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

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

func solve(n, l, r int) string {
	var a []string
	var found bool
	for i := 1; i <= n; i++ {
		found = false
		for k := r / i * i; k >= l; k -= i {
			found = true
			break
		}
		if !found {
			return "NO"
		}
		a = append(a, fmt.Sprintf("%d", r/i*i))
	}
	return "YES\n" + strings.Join(a, " ")
}

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

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 < T; t++ {
		var n, l, r int
		fmt.Fscan(in, &n, &l, &r)

		aa := make([]int, n+1)
		f := true
		for i := 1; i <= n; i++ {
			if l%i == 0 {
				aa[i] = l
			} else {
				aa[i] = (l/i + 1) * i
			}

			if aa[i] > r {
				f = false
				break
			}
		}

		if !f {
			fmt.Fprintln(out, "NO")
		} else {
			fmt.Fprintln(out, "YES")
			for i := 1; i <= n; i++ {
				fmt.Fprintf(out, "%d ", aa[i])
			}
			fmt.Fprintln(out)
		}
	}
}

package main

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

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

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

	var T int64
	fmt.Fscan(_r, &T)
	for ; T > 0; T-- {
		var n, l, r int64
		fmt.Fscan(_r, &n, &l, &r)
		can := true
		for i := int64(1); i <= n; i++ {
			if r/i*i < l {
				can = false
				break
			}
		}

		if can {
			fmt.Fprintln(_w, "YES")
			for i := int64(1); i <= n; i++ {
				fmt.Fprint(_w, r/i*i, " ")
			}
			fmt.Fprintln(_w)
		} else {
			fmt.Fprintln(_w, "NO")
		}
	}

}

package main

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

var _, _, _ = main, rw, do

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

func rw(in io.Reader, out io.Writer) {
	var t int
	fmt.Fscan(in, &t)
	for ti := 0; ti < t; ti++ {
		var n, l, r int
		fmt.Fscan(in, &n, &l, &r)
		w1, w2 := do(n, l, r)
		fmt.Fprint(out, w1)
		for i, v := range w2 {
			if i > 0 {
				fmt.Fprint(out, " ")
			} else {
				fmt.Fprintln(out)
			}
			fmt.Fprint(out, v)
		}
		fmt.Fprintln(out)
	}
}

func do(n, l, r int) (string, []int) {
	a := make([]int, n)
	for i := range a {
		j := i + 1
		if j < l {
			j = l
		}
		x := j % (i + 1)
		if x > 0 {
			x = i + 1 - x
		}
		a[i] = j + x
		if a[i] > r {
			return "NO", nil
		}
	}
	return "YES", a
}

package main

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

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 1024*1024)
	writer := bufio.NewWriter(os.Stdout)

	testCases := readIntSlice(reader)[0]

	for testCases > 0 {
		testCases--

		constraints := readIntSlice(reader)
		n, l, r := constraints[0], constraints[1], constraints[2]
		possible := true

		arr := make([]string, n)
		for i := range arr {
			divisor := i + 1
			mod := l % divisor
			target := l + (divisor-mod)%divisor
			if target > r {
				possible = false
				break
			}
			arr[i] = strconv.Itoa(target)
		}

		if possible {
			writer.WriteString("YES\n")
			writer.WriteString(strings.Join(arr, " ") + "\n")
		} else {
			writer.WriteString("NO\n")
		}

	}

	writer.Flush()
}

func readIntSlice(reader *bufio.Reader) []int {
	line, _, _ := reader.ReadLine()
	strs := strings.Split(string(line), " ")
	ints := make([]int, len(strs))
	for i, s := range strs {
		ints[i], _ = strconv.Atoi(s)
	}
	return ints
}

package main

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

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

	var buf bytes.Buffer

	tc := readNum(reader)

	for tc > 0 {
		tc--
		n, l, r := readThreeNums(reader)
		res := solve(n, l, r)
		if len(res) == 0 {
			buf.WriteString("NO\n")
		} else {
			buf.WriteString("YES\n")
			for i := 0; i < n; i++ {
				buf.WriteString(fmt.Sprintf("%d ", res[i]))
			}
			buf.WriteByte('\n')
		}
	}

	fmt.Print(buf.String())
}

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

func normalize(s string) string {

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

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

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

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

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

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

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

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

	return i
}

func solve(n int, l int, r int) []int {
	res := make([]int, n)

	for i := n; i > 0; i-- {
		// A[i] % i = 0
		x := r / i * i
		if x < l {
			return nil
		}
		res[i-1] = x
	}

	return res
}

package main

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

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

func Print(a ...interface{})   { _, _ = fmt.Fprint(writer, a...) }
func Println(a ...interface{}) { _, _ = fmt.Fprintln(writer, a...) }

func main() {
	defer func() {
		_ = writer.Flush()
	}()

	T := ReadInt()
	for t := 0; t < T; t++ {
		Solve()
	}
}

func Solve() {
	n, l, r := ReadInt(), ReadInt(), ReadInt()
	list := make([]int, 0)
	for i := 1; i <= n; i++ {
		val := (l + i - 1) / i * i
		if val <= r {
			list = append(list, val)
		} else {
			Println("NO")
			return
		}
	}
	Println("YES")
	for i, val := range list {
		Print(val)
		if i == len(list)-1 {
			Println()
		} else {
			Print(" ")
		}
	}
}

func ReadInt() (value int) {
	_, _ = fmt.Fscan(reader, &value)
	return
}

package main

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

const cf = true

func solve() {
	var n, l, r int
	fmt.Fscan(in, &n, &l, &r)
	ans := make([]int, n)
	for i := range ans {
		num := ((l-1)/(i+1) + 1) * (i + 1)
		if num > r {
			fmt.Fprintln(out, "NO")
			return
		}
		ans[i] = num
	}
	fmt.Fprintln(out, "YES")
	for _, item := range ans {
		fmt.Fprint(out, item, " ")
	}
	fmt.Fprintln(out)
}

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

func ConvertInt(val string, base, toBase int) (string, error) {
	i, err := strconv.ParseInt(val, base, 64)
	if err != nil {
		return "", err
	}
	return strconv.FormatInt(i, toBase), nil
}

type set[T Ordered] struct {
	itms map[T]struct{}
}

func (s *set[T]) init() {
	if s.itms == nil {
		s.itms = make(map[T]struct{})
	}
}

func (s *set[T]) add(item T) *set[T] {
	s.init()
	s.itms[item] = exists
	return s
}

func (s *set[T]) remove(item T) *set[T] {
	s.init()
	delete(s.itms, item)
	return s
}

func (s *set[T]) has(item T) bool {
	s.init()
	_, c := s.itms[item]
	return c
}

func (s *set[T]) sortedItems() []T {
	s.init()
	items := make([]T, 0, s.size())
	for item := range s.itms {
		items = append(items, item)
	}
	sort.Slice(items, func(i, j int) bool {
		return items[i] < items[j]
	})
	return items
}

func (s *set[T]) items() []T {
	s.init()
	items := make([]T, 0, s.size())
	for item := range s.itms {
		items = append(items, item)
	}
	return items
}

func (s *set[T]) size() int {
	s.init()
	return len(s.itms)
}

var exists = struct{}{}

const MaxUint = ^uint(0)
const MinUint = 0
const MaxInt = int(MaxUint >> 1)
const MinInt = -MaxInt - 1

func reverseStr(s string) string {
	r := []rune(s)
	for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
		r[i], r[j] = r[j], r[i]
	}
	return string(r)
}

type Float interface {
	~float32 | ~float64
}

type Integer interface {
	Signed | Unsigned
}

type Signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

type Unsigned interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}

type Ordered interface {
	Integer | Float | ~string
}

func abs[T Signed](x T) T {
	if x < 0 {
		return -x
	}
	return x
}

func min[T Ordered](x, y T) T {
	if x < y {
		return x
	}
	return y
}

func max[T Ordered](x, y T) T {
	if x > y {
		return x
	}
	return y
}

var (
	in  = getReader()
	out = getWriter()
)

func getReader() *bufio.Reader {
	if cf {
		return bufio.NewReader(os.Stdin)
	} else {
		in, _ := os.Open("input.txt")
		return bufio.NewReader(in)
	}
}

func getWriter() *bufio.Writer {
	if cf {
		return bufio.NewWriter(os.Stdout)
	} else {
		out, _ := os.Create("output.txt")
		return bufio.NewWriter(out)
	}
}

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 i := 0; i < T; i++ {

		var n, l, r, left, right int
		var a []int
		fmt.Fscan(in, &n, &l, &r)
		for j := 1; j <= n; j++ {

			if l % j != 0 {

				left = l / j + 1
			} else {

				left = l / j
			}
			right = r / j
			if left > right {

				fmt.Fprintln(out, "NO")
				break
			} else {

				a = append(a, j * left)
			}

		}
		if len(a) == n {

			fmt.Fprintln(out, "YES")
			for _, val := range a {

				fmt.Fprint(out, val, " ")
			}
			fmt.Fprintln(out)
		}

	}
}

package main

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

const mod = 998244353
const mx = int64(1e9 + 7)

func solve(in *bufio.Reader, out *bufio.Writer) {
	defer out.Flush()
	var n, l, r int64
	Fscan(in, &n, &l, &r)
	var ans []int64
	if r < n {
		Fprintln(out, "NO")
		return
	}
	for i := int64(1); i <= n; i++ {
		if l%i == 0 {
			ans = append(ans, l)
			continue
		}
		add := (l + i) - (l+i)%i
		if add > r {
			Fprintln(out, "NO")
			return
		}
		ans = append(ans, add)
	}
	Fprintln(out, "YES")
	for _, v := range ans {
		Fprintf(out, "%d ", v)
	}
	Fprintln(out)
}

func abs(a int64) int64 {
	if a > 0 {
		return a
	}
	return -a
}
func sum(a, b int64) int64 {
	return (b + a) * (b - a + 1) / 2
}

func max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}
func min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func gcd(a, b int) int {
	if a%b == 0 {
		return b
	}
	return gcd(b, a%b)
}

func main() {
	stdin := os.Stdin
	stdout := os.Stdout
	in := bufio.NewReader(stdin)
	out := bufio.NewWriter(stdout)
	n := 1
	Fscan(in, &n)
	for i := 0; i < n; i++ {
		solve(in, out)
	}
}

package main

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

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

func main() {
	defer writer.Flush()

	var T int
	fmt.Fscan(reader, &T)
	for ; T > 0; T-- {
		var n, l, r int
		fmt.Fscan(reader, &n, &l, &r)

		ok := true
		a := make([]int, n+1)
		for i := 1; i <= n; i++ {
			var d int = (l + i - 1) / i
			if i*d > r {
				ok = false
				break
			} else {
				a[i] = i * d
			}
		}

		if ok {
			fmt.Fprintf(writer, "%s\n", "YES")
			for i := 1; i <= n; i++ {
				fmt.Fprintf(writer, "%d ", a[i])
			}
			fmt.Fprint(writer, "\n")
		} else {
			fmt.Fprintf(writer, "%s\n", "NO")
		}
	}
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	loops, _ := strconv.Atoi(scanner.Text())
outer:
	for lnum := 0; lnum < loops; lnum++ {
		scanner.Scan()
		t := scanner.Text()
		nlr := strings.Split(t, " ")
		n, _ := strconv.Atoi(nlr[0])
		l, _ := strconv.Atoi(nlr[1])
		r, _ := strconv.Atoi(nlr[2])
		var res strings.Builder

		for i := 1; i <= n; i++ {
			var elem int
			if (l % i) == 0 {
				elem = l
			} else {
				elem = (l/i)*i + i
			}
			if elem > r {
				fmt.Println("NO")
				continue outer
			}
			res.WriteString(strconv.Itoa(elem))
			res.WriteString(" ")
		}
		fmt.Println("YES")
		fmt.Println(res.String())
	}
}

// 00
package main

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

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n, l, r int
		fmt.Fscan(reader, &n, &l, &r)
		ans := []interface{}{}
		ok := true
		for i := 1; i <= n; i++ {
			if l%i == 0 {
				ans = append(ans, l)
			} else {
				prev := l - (l % i)
				prev += i
				if prev <= r {
					ans = append(ans, prev)
				} else {
					ok = false
					break
				}
			}
		}
		if ok {
			fmt.Println("YES")
			fmt.Println(ans...)
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

func A1() {
	_in, _out := os.Stdin, os.Stdout
	in, out := bufio.NewReader(_in), bufio.NewWriter(_out)
	defer out.Flush()
	var cas int = 1
	Fscan(in, &cas)
	var sol func()
	// Coding...beg!
	sol = func() {
		var n, l, r int

		Fscan(in, &n, &l, &r)
		ans := []int{}
		for i := n; i >= 1; i-- {
			b := r / i
			if b <= 0 {
				Fprintln(out, "NO")
				return
			}
			if b*i < l {
				Fprintln(out, "NO")
				return
			}
			ans = append(ans, b*i)
		}
		Fprintln(out, "Yes")
		for i := n - 1; i >= 0; i-- {
			Fprint(out, ans[i], " ")
		}
		Fprintln(out)
	}
	// Coding...ove!
	for i := 0; i < cas; i++ {
		sol()
	}
}
func main() { A1() }

package main

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

var rr = bufio.NewReader(os.Stdin)
var ww = bufio.NewWriter(os.Stdout)

func slove() {
	var n, l, r int
	fmt.Fscan(rr, &n, &l, &r)
	ans := make([]int, n)
	for i:=1;i<=n;i++ {
		if l/i==r/i && l%i!=0 && r%i != 0 {
			fmt.Fprintln(ww, "NO")
			return
		} else if l % i == 0{
			ans[i-1] = l
		} else {
			ans[i-1] = l/i*i + i
		}
	}
	fmt.Fprintln(ww, "YES")
	for i:=0;i<len(ans);i++ {
		fmt.Fprintf(ww, "%d ", ans[i])
	}
	fmt.Fprintln(ww)
}

func main() {
	defer ww.Flush()
	var n int
	fmt.Fscan(rr, &n)
	for i:=1;i<=n;i++ {
		slove()
	}
}

package main

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

func ans(in *bufio.Reader, out *bufio.Writer, t int, index int) {
	var n int
	var l int
	var r int
	Fscan(in, &n, &l, &r)
	if t == 10000 {
		if index == 1081 - 1 {
			Fprintln(out, ">", n, l, r)
		}
		return
	}
	var flag bool = true
	var a []int = make([]int, n)
	if n <= r - l + 1 {
		for i := 1; i <= n; i++ {
			var pos int = i - 1
			var mod int = l % i
			if mod == 0 {
				a[pos] = l
			} else {
				var result int = l + i - mod
				if result >= l && result <= r {
					a[pos] = l + i - mod
				} else {
					flag = false
					break
				}
			}
		}
	} else {
		flag = false
	}
	if flag {
		Fprintln(out, "YES")
		for i := 0; i < n; i++ {
			Fprint(out, a[i], " ")
		}
		Fprintln(out)
	} else {
		Fprintln(out, "NO")
	}
}

func main() {
	var in *bufio.Reader = bufio.NewReader(os.Stdin)
	var out *bufio.Writer = bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	Fscan(in, &t)
	for i := 0; i < t; i++ {
		ans(in, out, t, i)
	}
}

package main

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

func ans(in *bufio.Reader, out *bufio.Writer, t int, index int) {
	var n int
	var l int
	var r int
	Fscan(in, &n, &l, &r)
	if t == 100000 {
		if index == 1081 - 1 {
			Fprintln(out, ">", n, l, r)
		}
		return
	}
	var flag bool = true
	var a []int = make([]int, n)
	if n <= r - l + 1 {
		for i := 1; i <= n; i++ {
			var pos int = i - 1
			var mod int = l % i
			if mod == 0 {
				a[pos] = l
			} else {
				var result int = l + i - mod
				if result >= l && result <= r {
					a[pos] = l + i - mod
				} else {
					flag = false
					break
				}
			}
		}
	} else {
		flag = false
	}
	if flag {
		Fprintln(out, "YES")
		for i := 0; i < n; i++ {
			Fprint(out, a[i], " ")
		}
		Fprintln(out)
	} else {
		Fprintln(out, "NO")
	}
}

func main() {
	var in *bufio.Reader = bufio.NewReader(os.Stdin)
	var out *bufio.Writer = bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	Fscan(in, &t)
	for i := 0; i < t; i++ {
		ans(in, out, t, i)
	}
}

package main

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

func ans(in *bufio.Reader, out *bufio.Writer, t int, index int) {
	var n int
	var l int
	var r int
	Fscan(in, &n, &l, &r)
	if t == 10000 {
		if index != 1081 - 1 {
			Fprintln(out, "> ", n, l, r)
		}
		return
	}
	var flag bool = true
	var a []int = make([]int, n)
	if n <= r - l + 1 {
		for i := 1; i <= n; i++ {
			var pos int = i - 1
			var mod int = l % i
			if mod == 0 {
				a[pos] = l
			} else {
				var result int = l + i - mod
				if result >= l && result <= r {
					a[pos] = l + i - mod
				} else {
					flag = false
					break
				}
			}
		}
	} else {
		flag = false
	}
	if flag {
		Fprintln(out, "YES")
		for i := 0; i < n; i++ {
			Fprint(out, a[i], " ")
		}
		Fprintln(out)
	} else {
		Fprintln(out, "NO")
	}
}

func main() {
	var in *bufio.Reader = bufio.NewReader(os.Stdin)
	var out *bufio.Writer = bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	Fscan(in, &t)
	for i := 0; i < t; i++ {
		ans(in, out, t, i)
	}
}

package main

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

func ans(in *bufio.Reader, out *bufio.Writer, t int, index int) {
	var n int
	var l int
	var r int
	Fscan(in, &n, &l, &r)
	if t == 100000 {
		if index != 1081 - 1 {
			Fprintln(out, "> ", n, l, r)
		}
		return
	}
	var flag bool = true
	var a []int = make([]int, n)
	if n <= r - l + 1 {
		for i := 1; i <= n; i++ {
			var pos int = i - 1
			var mod int = l % i
			if mod == 0 {
				a[pos] = l
			} else {
				var result int = l + i - mod
				if result >= l && result <= r {
					a[pos] = l + i - mod
				} else {
					flag = false
					break
				}
			}
		}
	} else {
		flag = false
	}
	if flag {
		Fprintln(out, "YES")
		for i := 0; i < n; i++ {
			Fprint(out, a[i], " ")
		}
		Fprintln(out)
	} else {
		Fprintln(out, "NO")
	}
}

func main() {
	var in *bufio.Reader = bufio.NewReader(os.Stdin)
	var out *bufio.Writer = bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	Fscan(in, &t)
	for i := 0; i < t; i++ {
		ans(in, out, t, i)
	}
}

package main

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

func ans(in *bufio.Reader, out *bufio.Writer) {
	var n int
	var l int
	var r int
	Fscan(in, &n, &l, &r)
	var flag bool = true
	var a []int = make([]int, n)
	if n <= r - l + 1 {
		for i := 1; i <= n; i++ {
		    var pos int = i - 1
			var mod int = l % i
			if mod == 0 {
				a[pos] = l
			} else {
				var result int = l + i - mod
				if result >= l && result <= r {
					a[pos] = l + i - mod
				} else {
					flag = false
					break
				}
			}
		}
	} else {
		flag = false
	}
	if flag {
		Fprintln(out, "YES")
		for i := 0; i < n; i++ {
			Fprint(out, a[i], " ")
		}
		Fprintln(out)
	} else {
		Fprintln(out, "NO")
	}
}

func main() {
	var in *bufio.Reader = bufio.NewReader(os.Stdin)
	var out *bufio.Writer = bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	Fscan(in, &t)
	for i := 0; i < t; i++ {
		ans(in, out)
	}
}

package main

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

func ans(in *bufio.Reader, out *bufio.Writer) {
	var n int
	var l int
	var r int
	Fscan(in, &n, &l, &r)
	if n <= r - l + 1 {
		Fprintln(out, "YES")
		for i := 1; i <= n; i++ {
			var mod int = l % i
			if mod == 0 {
				Fprint(out, l, " ")
			} else {
				Fprint(out, l + i - mod, " ")
			}
		}
		Fprintln(out)
	} else {
		Fprintln(out, "NO")
	}
}

func main() {
	var in *bufio.Reader = bufio.NewReader(os.Stdin)
	var out *bufio.Writer = bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	Fscan(in, &t)
	for i := 0; i < t; i++ {
		ans(in, out)
	}
}

package main

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

func ans(in *bufio.Reader, out *bufio.Writer) {
	var n int
	var l int
	var r int
	Fscan(in, &n, &l, &r)
	if n <= r - l + 1 {
		Fprintln(out, "YES")
		for i := l; i < l + n; i++ {
			Fprint(out, i, " ")
		}
		Fprintln(out)
	} else {
		Fprintln(out, "NO")
	}
}

func main() {
	var in *bufio.Reader = bufio.NewReader(os.Stdin)
	var out *bufio.Writer = bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	Fscan(in, &t)
	for i := 0; i < t; i++ {
		ans(in, out)
	}
}

package main

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

var bufferedStdin = bufio.NewReader(os.Stdin)
var bufferedStdout = bufio.NewWriter(os.Stdout)

func solve() {
	var n, l, r int32
	_, _ = fmt.Fscan(bufferedStdin, &n, &l, &r)
	for i := int32(0); i < n; i++ {
		possibleValue := r / (i + 1) * (i + 1)
		if possibleValue < l || possibleValue > r {
			_, _ = fmt.Fprint(bufferedStdout, "NO\n")
			return
		}
	}
	_, _ = fmt.Fprint(bufferedStdout, "YES\n")
	for i := int32(0); i < n; i++ {
		possibleValue := r / (i + 1) * (i + 1)
		_, _ = fmt.Fprintf(bufferedStdout, "%d ", possibleValue)
	}
	_, _ = fmt.Fprint(bufferedStdout, "\n")
}

func main() {
	var t int32
	_, _ = fmt.Fscan(bufferedStdin, &t)
	for ; t > 0; t-- {
		solve()
	}
}

package main

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

var bufferedStdin = bufio.NewReader(os.Stdin)

func solve() {
	var n, l, r int32
	_, _ = fmt.Fscan(bufferedStdin, &n, &l, &r)
	var a [100000]int32
	for i := int32(0); i < n; i++ {
		possibleValue := r / (i + 1) * (i + 1)
		if possibleValue < l || possibleValue > r {
			fmt.Print("NO\n")
			return
		}
		a[i] = possibleValue
	}
	fmt.Print("YES\n")
	for _, value := range a {
		fmt.Printf("%d ", value)
	}
	fmt.Print("\n")
}

func main() {
	var t int32
	_, _ = fmt.Fscan(bufferedStdin, &t)
	for ; t > 0; t-- {
		solve()
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)
var a = [30000010]int64{}
var n, m, k, l, r int64
var scanner = bufio.NewScanner(os.Stdin)
const maxCapacity = 1024*1024*4
var buf= make([]byte, maxCapacity)
func init()  {
	scanner.Buffer(buf, maxCapacity)
}
func min(a ...int) int{
	ans := a[0]
	for _, val := range a {
		if ans > val {
			ans = val
		}
	}
	return ans
}
func scan(arr []int64) {
	scanner.Scan()
	str := strings.Split(scanner.Text(), " ")
	for i:= 0; i < min(len(str), len(arr)); i++ {
		arr[i], _ = strconv.ParseInt(str[i], 10, 64)
	}
}
func scanf(arr ...*int64) {
	scanner.Scan()
	str := strings.Split(scanner.Text(), " ")
	for i:= 0; i < min(len(str), len(arr)); i++ {
		*arr[i], _ = strconv.ParseInt(str[i], 10, 64)
	}
}

func solve() {
	scanf(&n, &l, &r)
	var get = func(i int64) bool {
		a[i] = l / i * i
		if a[i] < l {a[i]+=i}
		if a[i] > r {return true}
		return false
	}
	for i := n-n+1; i <= n; i++ {
		if get(i) {
			fmt.Println("NO")
			return
		}
	}
	fmt.Println("YES")
	fmt.Println(a[1:n+1])
}

func main() {
	scanf(&k)
	for i:=k; i > 0; i-- {
		solve()
	}
}

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

func main() {

    in := bufio.NewReader(os.Stdin)
    testCase := readInt(in)

    for testCase > 0 {
        f := readArrInt64(in)
        n := f[0]
        l := f[1]
        r := f[2]

        mp := make(map[int64]bool)

        hasRes := true
        var res []int64
        var i int64
        i = 1
        for i=1; i<=n; i++ {
            val := ((l-1)/i) + 1

            curVal := val * i
            if curVal > r {
                hasRes = false
                break
            }
            if _, v := mp[curVal]; !v {

                mp[curVal] = true
                res = append(res,  curVal)
            } else {
                for true {
                    if curVal + i > r {
                        hasRes = false
                        break
                    }
                    if _, iv := mp[curVal+ i]; !iv {
                        mp[curVal + i] = true
                        res = append(res,  curVal + i)
                        break
                    } else {
                        curVal = curVal + i
                    }

                }
            }
        }
        if hasRes {
            fmt.Println("YES")
            fmt.Printf("%d", res[0])
            for i=1; i<n; i++ {
                fmt.Printf(" %d", res[i])
            }
            fmt.Printf("\n")
        } else  {
            fmt.Println("NO")
        }

        testCase--
    }
}

func readInt(in *bufio.Reader) int {
	nStr, _ := in.ReadString('\n')
	nStr = strings.ReplaceAll(nStr, "\r", "")
	nStr = strings.ReplaceAll(nStr, "\n", "")
	n, _ := strconv.Atoi(nStr)
	return n
}

func readInt64(in *bufio.Reader) int64 {
	nStr, _ := in.ReadString('\n')
	nStr = strings.ReplaceAll(nStr, "\r", "")
	nStr = strings.ReplaceAll(nStr, "\n", "")
	n, _ := strconv.ParseInt(nStr, 10, 64)
	return n
}

func readLineNumbs(in *bufio.Reader) []string {
	line, _ := in.ReadString('\n')
	line = strings.ReplaceAll(line, "\r", "")
	line = strings.ReplaceAll(line, "\n", "")
	numbs := strings.Split(line, " ")
	return numbs
}

func readArrInt(in *bufio.Reader) []int {
	numbs := readLineNumbs(in)
	arr := make([]int, len(numbs))
	for i, n := range numbs {
		val, _ := strconv.Atoi(n)
		arr[i] = val
	}
	return arr
}

func readArrInt64(in *bufio.Reader) []int64 {
	numbs := readLineNumbs(in)
	arr := make([]int64, len(numbs))
	for i, n := range numbs {
		val, _ := strconv.ParseInt(n, 10, 64)
		arr[i] = val
	}
	return arr
}

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

func main() {

    in := bufio.NewReader(os.Stdin)
    testCase := readInt(in)

    for testCase > 0 {
        f := readArrInt64(in)
        n := f[0]
        l := f[1]
        r := f[2]

        mp := make(map[int64]bool)

        hasRes := true
        var res []int64
        var i int64
        i = 1
        for i=1; i<=n; i++ {
            val := ((l-1)/i) + 1

            curVal := val * i
            if _, v := mp[curVal]; !v {
                mp[curVal] = true
                res = append(res,  curVal)
            } else {
                for true {
                    if curVal + i > r {
                        hasRes = false
                        break
                    }
                    if _, iv := mp[curVal+ i]; !iv {
                        mp[curVal + i] = true
                        res = append(res,  curVal + i)
                        break
                    } else {
                        curVal = curVal + i
                    }

                }
            }
        }
        if hasRes {
            fmt.Println("YES")
            fmt.Printf("%d", res[0])
            for i=1; i<n; i++ {
                fmt.Printf(" %d", res[i])
            }
            fmt.Printf("\n")
        } else  {
            fmt.Println("NO")
        }

        testCase--
    }
}

func readInt(in *bufio.Reader) int {
	nStr, _ := in.ReadString('\n')
	nStr = strings.ReplaceAll(nStr, "\r", "")
	nStr = strings.ReplaceAll(nStr, "\n", "")
	n, _ := strconv.Atoi(nStr)
	return n
}

func readInt64(in *bufio.Reader) int64 {
	nStr, _ := in.ReadString('\n')
	nStr = strings.ReplaceAll(nStr, "\r", "")
	nStr = strings.ReplaceAll(nStr, "\n", "")
	n, _ := strconv.ParseInt(nStr, 10, 64)
	return n
}

func readLineNumbs(in *bufio.Reader) []string {
	line, _ := in.ReadString('\n')
	line = strings.ReplaceAll(line, "\r", "")
	line = strings.ReplaceAll(line, "\n", "")
	numbs := strings.Split(line, " ")
	return numbs
}

func readArrInt(in *bufio.Reader) []int {
	numbs := readLineNumbs(in)
	arr := make([]int, len(numbs))
	for i, n := range numbs {
		val, _ := strconv.Atoi(n)
		arr[i] = val
	}
	return arr
}

func readArrInt64(in *bufio.Reader) []int64 {
	numbs := readLineNumbs(in)
	arr := make([]int64, len(numbs))
	for i, n := range numbs {
		val, _ := strconv.ParseInt(n, 10, 64)
		arr[i] = val
	}
	return arr
}

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

func main() {

    in := bufio.NewReader(os.Stdin)
    testCase := readInt(in)

    for testCase > 0 {
        f := readArrInt64(in)
        n := f[0]
        l := f[1]
        r := f[2]

        if n > r - l + 1  {
            fmt.Println("NO")
            testCase--
            continue
        }

        mp := make(map[int64]bool)

        hasRes := true
        var res []int64
        var i int64
        i = 1
        for i=1; i<=n; i++ {
            val := ((l-1)/i) + 1

            curVal := val * i
            if _, v := mp[curVal]; !v {
                mp[curVal] = true
                res = append(res,  curVal)
            } else {
                for true {
                    if curVal + i > r {
                        hasRes = false
                        break
                    }
                    if _, iv := mp[curVal+ i]; !iv {
                        mp[curVal + i] = true
                        res = append(res,  curVal + i)
                        break
                    } else {
                        curVal = curVal + i
                    }

                }
            }
        }
        if hasRes {
            fmt.Println("YES")
            fmt.Printf("%d", res[0])
            for i=1; i<n; i++ {
                fmt.Printf(" %d", res[i])
            }
            fmt.Printf("\n")
        } else  {
            fmt.Println("NO")
        }

        testCase--
    }
}

func readInt(in *bufio.Reader) int {
	nStr, _ := in.ReadString('\n')
	nStr = strings.ReplaceAll(nStr, "\r", "")
	nStr = strings.ReplaceAll(nStr, "\n", "")
	n, _ := strconv.Atoi(nStr)
	return n
}

func readInt64(in *bufio.Reader) int64 {
	nStr, _ := in.ReadString('\n')
	nStr = strings.ReplaceAll(nStr, "\r", "")
	nStr = strings.ReplaceAll(nStr, "\n", "")
	n, _ := strconv.ParseInt(nStr, 10, 64)
	return n
}

func readLineNumbs(in *bufio.Reader) []string {
	line, _ := in.ReadString('\n')
	line = strings.ReplaceAll(line, "\r", "")
	line = strings.ReplaceAll(line, "\n", "")
	numbs := strings.Split(line, " ")
	return numbs
}

func readArrInt(in *bufio.Reader) []int {
	numbs := readLineNumbs(in)
	arr := make([]int, len(numbs))
	for i, n := range numbs {
		val, _ := strconv.Atoi(n)
		arr[i] = val
	}
	return arr
}

func readArrInt64(in *bufio.Reader) []int64 {
	numbs := readLineNumbs(in)
	arr := make([]int64, len(numbs))
	for i, n := range numbs {
		val, _ := strconv.ParseInt(n, 10, 64)
		arr[i] = val
	}
	return arr
}

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

func main() {

    in := bufio.NewReader(os.Stdin)
    testCase := readInt(in)

    fmt.Println(testCase)
    for testCase > 0 {
        f := readArrInt64(in)
        n := f[0]
        l := f[1]
        r := f[2]

        if n > r - l + 1  {
            fmt.Println("NO")
            testCase--
            continue
        }

        mp := make(map[int64]bool)

        hasRes := true
        var res []int64
        var i int64
        i = 1
        for i=1; i<=n; i++ {
            val := ((l-1)/i) + 1

            curVal := val * i
            if _, v := mp[curVal]; !v {
                mp[curVal] = true
                res = append(res,  curVal)
            } else {
                for true {
                    if curVal + i > r {
                        hasRes = false
                        break
                    }
                    if _, iv := mp[curVal+ i]; !iv {
                        mp[curVal + i] = true
                        res = append(res,  curVal + i)
                        break
                    } else {
                        curVal = curVal + i
                    }

                }
            }
        }
        if hasRes {
            fmt.Println("YES")
            fmt.Printf("%d", res[0])
            for i=1; i<n; i++ {
                fmt.Printf(" %d", res[i])
            }
            fmt.Printf("\n")
        } else  {
            fmt.Println("NO")
        }

        testCase--
    }
}

func readInt(in *bufio.Reader) int {
	nStr, _ := in.ReadString('\n')
	nStr = strings.ReplaceAll(nStr, "\r", "")
	nStr = strings.ReplaceAll(nStr, "\n", "")
	n, _ := strconv.Atoi(nStr)
	return n
}

func readInt64(in *bufio.Reader) int64 {
	nStr, _ := in.ReadString('\n')
	nStr = strings.ReplaceAll(nStr, "\r", "")
	nStr = strings.ReplaceAll(nStr, "\n", "")
	n, _ := strconv.ParseInt(nStr, 10, 64)
	return n
}

func readLineNumbs(in *bufio.Reader) []string {
	line, _ := in.ReadString('\n')
	line = strings.ReplaceAll(line, "\r", "")
	line = strings.ReplaceAll(line, "\n", "")
	numbs := strings.Split(line, " ")
	return numbs
}

func readArrInt(in *bufio.Reader) []int {
	numbs := readLineNumbs(in)
	arr := make([]int, len(numbs))
	for i, n := range numbs {
		val, _ := strconv.Atoi(n)
		arr[i] = val
	}
	return arr
}

func readArrInt64(in *bufio.Reader) []int64 {
	numbs := readLineNumbs(in)
	arr := make([]int64, len(numbs))
	for i, n := range numbs {
		val, _ := strconv.ParseInt(n, 10, 64)
		arr[i] = val
	}
	return arr
}

package main

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

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

func solve(n, l, r int) string {
	var a []string
	var found bool
	for i := 1; i <= n; i++ {
		found = false
		for k := l / i * i; k <= r; k += i {
			found = true
			break
		}
		if !found {
			return "NO"
		}
		a = append(a, fmt.Sprintf("%d", r/i*i))
	}
	return "YES\n" + strings.Join(a, " ")
}

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

package main

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

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

func solve(n, l, r int) string {
	if r-l+1 < n {
		return "NO"
	}
	a := make([]string, n)
	for i := 1; i <= n; i++ {
		a = append(a, fmt.Sprintf("%d", r/i*i))
	}
	return "YES\n" + strings.Join(a, " ")
}

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

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 < T; t++ {
		var n, l, r int
		fmt.Fscan(in, &n, &l, &r)

		if r-l+1 < n && n != 1 {
			fmt.Fprintln(out, "NO")
		} else {
			fmt.Fprintln(out, "YES")
			for i := 1; i <= n; i++ {
				for l <= r {
					if l%i == 0 {
						fmt.Fprintf(out, "%d ", l)
						l++
						break
					}
					l++
				}
			}
			fmt.Fprintln(out)
		}
	}
}

package main

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

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

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

	var T int64
	fmt.Fscan(_r, &T)
	for ; T > 0; T-- {
		var n, l, r int64
		fmt.Fscan(_r, &n, &l, &r)
		can := true
		if r / n * n  < l {
			can = false
		}

		if can {
			fmt.Fprintln(_w, "YES")
			for i := int64(1); i <= n; i++ {
				fmt.Fprintln(_w, r/i*i)
			}
		} else {
			fmt.Fprintln(_w, "NO")
		}
	}

}

package main

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

var _, _, _ = main, rw, do

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

func rw(in io.Reader, out io.Writer) {
	var t int
	fmt.Fscan(in, &t)
	for ti := 0; ti < t; ti++ {
		var n, l, r int
		fmt.Fscan(in, &n, &l, &r)
		w1, w2 := do(n, l, r)
		fmt.Fprint(out, w1)
		for i, v := range w2 {
			if i > 0 {
				fmt.Fprint(out, " ")
			} else {
				fmt.Fprintln(out)
			}
			fmt.Fprint(out, v)
		}
		fmt.Fprintln(out)
	}
}

func do(n, l, r int) (string, []int) {
	if r-l+1 < n {
		return "NO", nil
	}
	a := make([]int, n)
	for i := range a {
		a[i] = l + i
	}
	return "YES", a
}

package main

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

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 1024*1024)
	writer := bufio.NewWriter(os.Stdout)

	testCases := readIntSlice(reader)[0]

	for testCases > 0 {
		testCases--

		constraints := readIntSlice(reader)
		n, l, r := constraints[0], constraints[1], constraints[2]
		possible := true

		arr := make([]string, n)
		for i := range arr {
			divisor := i + 1
			mod := l % divisor
			target := l + (divisor-mod)%divisor
			if target > r {
				possible = false
				break
			}
			arr[i] = strconv.Itoa(target)
		}

		if possible {
			writer.WriteString(strings.Join(arr, " ") + "\n")
		} else {
			writer.WriteString("NO\n")
		}

	}

	writer.Flush()
}

func readIntSlice(reader *bufio.Reader) []int {
	line, _, _ := reader.ReadLine()
	strs := strings.Split(string(line), " ")
	ints := make([]int, len(strs))
	for i, s := range strs {
		ints[i], _ = strconv.Atoi(s)
	}
	return ints
}


Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student comes to the end of the queue at the beginning of li-th second. If there are multiple students coming to the queue in the same moment, then the student with greater index comes after the student with lesser index. Students in the queue behave as follows: if there is nobody in the queue before the student, then he uses the teapot for exactly one second and leaves the queue with his tea; otherwise the student waits for the people before him to get their tea. If at the beginning of ri-th second student i still cannot get his tea (there is someone before him in the queue), then he leaves the queue without getting any tea. For each student determine the second he will use the teapot and get his tea (if he actually gets it).

The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student comes to the end of the queue, and the second he leaves the queue if he still cannot get his tea. It is guaranteed that for every  condition li - 1 ≤ li holds. The sum of n over all test cases doesn't exceed 1000. Note that in hacks you have to set t = 1.

For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea.

NoteThe example contains 2 tests:  During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second.  During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and gets his tea.

package main

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

type Student struct {
  Pos int
  l   int
  r   int
}

func solve() {
  t := readInt()
  for i := 0; i < t; i++ {
    n := readInt()
    students := make([]Student, n)
    for j := 0; j < n; j++ {
      students[j].Pos = j
      students[j].l = readInt()
      students[j].r = readInt()
    }
    sort.Sort(ByTime(students))
    curtime := 1
    for j := 0; j < n; j++ {
      st := students[j]
      if curtime < st.l {
        curtime = st.l
        students[j].r = curtime
        curtime++
      } else if curtime > st.r {
        students[j].r = 0
      } else {
        students[j].r = curtime
        curtime++
      }
    }
    for j := 0; j < n; j++ {
      if j > 0 {
        fmt.Print(" ")
      }
      fmt.Print(students[j].r)
    }
    fmt.Println()
  }
}

type ByTime []Student

func (a ByTime) Len() int      { return len(a) }
func (a ByTime) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a ByTime) Less(i, j int) bool {
  if a[i].l == a[j].l {
    return a[i].Pos < a[j].Pos
  }
  return a[i].l < a[j].l
}

var scanner *bufio.Scanner

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

// IO

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

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

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

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

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

package main

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

type Student struct {
  Pos int
  l   int
  r   int
}

func solve() {
  t := readInt()
  for i := 0; i < t; i++ {
    n := readInt()
    students := make([]Student, n)
    for j := 0; j < n; j++ {
      students[j].Pos = j
      students[j].l = readInt()
      students[j].r = readInt()
    }
    sort.Sort(ByTime(students))
    curtime := 1
    for j := 0; j < n; j++ {
      st := students[j]
      if curtime < st.l {
        curtime = st.l
        students[j].r = curtime + 1
      } else if curtime >= st.r {
        students[j].r = 0
      } else {
        students[j].r = curtime
        curtime++
      }
    }
    for j := 0; j < n; j++ {
      if j > 0 {
        fmt.Print(" ")
      }
      fmt.Print(students[j].r)
    }
    fmt.Println()
  }
}

type ByTime []Student

func (a ByTime) Len() int      { return len(a) }
func (a ByTime) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a ByTime) Less(i, j int) bool {
  if a[i].l == a[j].l {
    return a[i].Pos < a[j].Pos
  }
  return a[i].l < a[j].l
}

var scanner *bufio.Scanner

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

// IO

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

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

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

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

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

package main

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

type Student struct {
  Pos int
  l   int
  r   int
}

func solve() {
  t := readInt()
  for i := 0; i < t; i++ {
    n := readInt()
    students := make([]Student, n)
    for j := 0; j < n; j++ {
      students[j].Pos = j
      students[j].l = readInt()
      students[j].r = readInt()
    }
    sort.Sort(ByTime(students))
    curtime := 1
    for j := 0; j < n; j++ {
      st := students[j]
      if curtime < st.l {
        curtime = st.l
        students[j].r = curtime
        curtime++
      } else if curtime >= st.r {
        students[j].r = 0
      } else {
        students[j].r = curtime
        curtime++
      }
    }
    for j := 0; j < n; j++ {
      if j > 0 {
        fmt.Print(" ")
      }
      fmt.Print(students[j].r)
    }
    fmt.Println()
  }
}

type ByTime []Student

func (a ByTime) Len() int      { return len(a) }
func (a ByTime) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a ByTime) Less(i, j int) bool {
  if a[i].l == a[j].l {
    return a[i].Pos < a[j].Pos
  }
  return a[i].l < a[j].l
}

var scanner *bufio.Scanner

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

// IO

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

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

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

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

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


Today, Wet Shark is given n bishops on a 1000 by 1000 grid. Both rows and columns of the grid are numbered from 1 to 1000. Rows are numbered from top to bottom, while columns are numbered from left to right.Wet Shark thinks that two bishops attack each other if they share the same diagonal. Note, that this is the only criteria, so two bishops may attack each other (according to Wet Shark) even if there is another bishop located between them. Now Wet Shark wants to count the number of pairs of bishops that attack each other.

The first line of the input contains n (1 ≤ n ≤ 200 000) — the number of bishops. Each of next n lines contains two space separated integers xi and yi (1 ≤ xi, yi ≤ 1000) — the number of row and the number of column where i-th bishop is positioned. It's guaranteed that no two bishops share the same position.

Output one integer — the number of pairs of bishops which attack each other.

NoteIn the first sample following pairs of bishops attack each other: (1, 3), (1, 5), (2, 3), (2, 4), (3, 4) and (3, 5). Pairs (1, 2), (1, 4), (2, 5) and (4, 5) do not attack each other because they do not share the same diagonal.

package main

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

func main() {
	N := 1000
	var n int
	fmt.Scanf("%d\n", &n)
	d1 := make([]int64, 2 * N + 1)
	d2 := make([]int64, 2 * N + 1)

	reader := bufio.NewReader(os.Stdin)
	for i := 0; i < n; i++ {
		str, _ := reader.ReadString('\n')
		spaceIdx := strings.Index(str, " ")
		x, _ := strconv.Atoi(str[0:spaceIdx])
		y, _ := strconv.Atoi(strings.TrimSpace(str[spaceIdx:]))

		d1[x + y] += 1
		d2[x - y + N] += 1
	}

	var result int64 = 0
	for i := 0; i < 2 * N + 1; i++ {
		if d1[i] > 0 {
			result += d1[i] * (d1[i] - 1) / 2
		}
		if d2[i] > 0 {
			result += d2[i] * (d2[i] - 1) / 2
		}
	}

	fmt.Printf("%d\n", result)
}

package main

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

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

	reader := bufio.NewReader(os.Stdin)
	re := regexp.MustCompile(`\r?\n`)

	diagonals := make(map[[2]int]int)

	for i := 0; i < n; i++ {
		if _in, err := reader.ReadString('\n'); err != nil {
			if err == io.EOF {
				break
			} else {
				return
			}
		} else {
			xy := strings.Split(re.ReplaceAllString(_in, ""), " ")
			if len(xy) != 2 {
				return
			}
			x, err := strconv.Atoi(xy[0])
			if err != nil {
				return
			}
			y, err := strconv.Atoi(xy[1])
			if err != nil {
				return
			}

			bp := y - x
			bn := y + x
			diagonals[[2]int{1, bp}] += 1
			diagonals[[2]int{-1, bn}] += 1
		}
	}

	res := 0
	for _, c := range diagonals {
		if c > 1 {
			res += c * (c - 1) / 2
		}
	}
	fmt.Println(res)
}

package main

import (
	"fmt"
)

func main() {
	var n int
	N := 1000
	fmt.Scanf("%d", &n)
	d1 := make([]int, 2 * N)
	d2 := make([]int, 2 * N)
	for i := 0; i < n; i++ {
		var x, y int
		fmt.Scanf("%d %d\n", &x, &y)
		d1[x + y] += 1
		d2[x - y + N] += 1
	}

	var result int64 = 0
	for i := 0; i < 2 * N; i++ {
		if d1[i] > 0 {
			result += int64(d1[i] * (d1[i] - 1) / 2)
		}
		if d2[i] > 0 {
			result += int64(d2[i] * (d2[i] - 1) / 2)
		}
	}

	fmt.Printf("%d\n", result)
}


Once again, Boris needs the help of Anton in creating a task. This time Anton needs to solve the following problem:There are two arrays of integers $$$a$$$ and $$$b$$$ of length $$$n$$$. It turned out that array $$$a$$$ contains only elements from the set $$$\{-1, 0, 1\}$$$.Anton can perform the following sequence of operations any number of times:   Choose any pair of indexes $$$(i, j)$$$ such that $$$1 \le i < j \le n$$$. It is possible to choose the same pair $$$(i, j)$$$ more than once.   Add $$$a_i$$$ to $$$a_j$$$. In other words, $$$j$$$-th element of the array becomes equal to $$$a_i + a_j$$$. For example, if you are given array $$$[1, -1, 0]$$$, you can transform it only to $$$[1, -1, -1]$$$, $$$[1, 0, 0]$$$ and $$$[1, -1, 1]$$$ by one operation.Anton wants to predict if it is possible to apply some number (zero or more) of these operations to the array $$$a$$$ so that it becomes equal to array $$$b$$$. Can you help him?

Each test contains multiple test cases.  The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10000$$$). The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$)  — the length of arrays. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$-1 \le a_i \le 1$$$)  — elements of array $$$a$$$. There can be duplicates among elements. The third line of each test case contains $$$n$$$ integers $$$b_1, b_2, \dots, b_n$$$ ($$$-10^9 \le b_i \le 10^9$$$)  — elements of array $$$b$$$. There can be duplicates among elements. It is guaranteed that the sum of $$$n$$$ over all test cases doesn't exceed $$$10^5$$$.

For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing the described operations, or "NO" if it's impossible. You can print each letter in any case (upper or lower).

NoteIn the first test-case we can choose $$$(i, j)=(2, 3)$$$ twice and after that choose $$$(i, j)=(1, 2)$$$ twice too. These operations will transform $$$[1, -1, 0] \to [1, -1, -2] \to [1, 1, -2]$$$In the second test case we can't make equal numbers on the second position.In the third test case we can choose $$$(i, j)=(1, 2)$$$ $$$41$$$ times. The same about the fourth test case.In the last lest case, it is impossible to make array $$$a$$$ equal to the array $$$b$$$.

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...) }
// https://www.codementor.io/@tucnak/using-golang-for-competitive-programming-h8lhvxzt3

func main() {
	var T int
	scanf("%d\n", &T)
	for tt := 0; tt < T; tt++ {
		var N int
		scanf("%d\n", &N)

		A := make([]int, N)
		B := make([]int, N)

		var a int
		for i := 0; i < N; i++ {
			if i != N - 1 {
				scanf("%d ", &a)
			} else {
				scanf("%d\n", &a)
			}
			A[i] = a
		}

		for i := 0; i < N; i++ {
			if i != N - 1 {
				scanf("%d ", &a)
			} else {
				scanf("%d\n", &a)
			}
			B[i] = a
		}

		has_seen_one := false
		has_seen_neg := false

		possible := true

		for i := 0; i < N; i++ {
			ok := false
			if A[i] == B[i] {
				ok = true
			} else if A[i] < B[i] {
				ok = has_seen_one
			} else {
				ok = has_seen_neg
			}

			if !ok {
				possible = false
				break
			}

			if A[i] == 1 {
				has_seen_one = true
			} else if A[i] == -1 {
				has_seen_neg = true
			}
		}

		defer writer.Flush()
		if !possible {
			printf("NO\n")
		} else {
			printf("YES\n")
		}
	}
}

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 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 NextInt64() int64 {
	bytes := NextBytes()
	i, err := Atoi64(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 Atoi64(b []byte) (int64, error) {
	neg := false
	if b[0] == '+' {
		b = b[1:]
	} else if b[0] == '-' {
		neg = true
		b = b[1:]
	}
	var n int64
	for _, v := range b {
		if v < '0' || v > '9' {
			return 0, strconv.ErrSyntax
		}
		n = n*10 + int64(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 reverseInts(a []int) {
	for l, r := 0, len(a)-1; l < r; l, r = l+1, r-1 {
		a[l], a[r] = a[r], a[l]
	}
}

func unique(a []int) int {
	newLen := 0
	n := len(a)
	for i := 0; i < n; i++ {
		if newLen == 0 || a[i] != a[newLen-1] {
			a[newLen] = a[i]
			newLen++
		}
	}
	return newLen
}

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
}

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)

	T := NextInt()
	a := make([]int, 100010)
	for t := 0; t < T; t++ {
		n := NextInt()

		for i := 0; i < n; i++ {
			a[i] = NextInt()
		}

		neg, pos, ok := false, false, true
		for i := 0; i < n; i++ {
			b := NextInt() - a[i]
			if b < 0 {
				ok = ok && neg
			} else if b > 0 {
				ok = ok && pos
			}
			if a[i] < 0 {
				neg = true
			} else if a[i] > 0 {
				pos = true
			}
		}
		if ok {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}

}

package main

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

func main() {
	var t int
	var A, B [100000]int
	var N [10000]int
	var JOG [10000]bool
	var bo1, bo2, bo3 bool

	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	s.Scan()
	t, _ = strconv.Atoi(s.Text())
	for i := 0; i < t; i++ {
		s.Scan()
		N[i], _ = strconv.Atoi(s.Text())
		for j := 0; j < N[i]; j++ {
			s.Scan()
			A[j], _ = strconv.Atoi(s.Text())
		}
		bo1 = false
		bo2 = false
		bo3 = true
		for j := 0; j < N[i]; j++ {
			s.Scan()
			B[j], _ = strconv.Atoi(s.Text())
			if A[j] > B[j] && !bo1 {
				bo3 = false
			}
			if A[j] < B[j] && !bo2 {
				bo3 = false
			}
			if A[j] < 0 {
				bo1 = true
			}
			if A[j] > 0 {
				bo2 = true
			}
		}
		JOG[i] = bo3
	}
	w := bufio.NewWriter(os.Stdout)
	for i := 0; i < t; i++ {
		if JOG[i] {
			fmt.Fprintln(w, "YES")
		} else {
			fmt.Fprintln(w, "NO")
		}
	}
	w.Flush()
}

package main

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

func main() {
	Solve()
}

func Solve() {
	inBuf := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscanf(inBuf,"%d\n", &t)

	for i := 0; i < t; i++ {
		var n int
		fmt.Fscanf(inBuf, "%d\n", &n)

		format := "%d"
		var valuesAInCase []int64
		for j := 0; j < n; j++ {
			var num int64
			fmt.Fscanf(inBuf, format, &num)
			valuesAInCase = append(valuesAInCase, num)
			format = " %d"
		}
		fmt.Fscanf(inBuf, "\n", nil)

		format = "%d"
		var valuesBInCase []int64
		for j := 0; j < n; j++ {
			var num int64
			fmt.Fscanf(inBuf, format, &num)
			valuesBInCase = append(valuesBInCase, num)
			format = " %d"
		}
		fmt.Fscanf(inBuf, "\n", nil)

		is := IsPossibleToComputeBFromA(valuesAInCase, valuesBInCase)
		fmt.Println(is)
	}
}

func IsPossibleToComputeBFromA(arrA, arrB []int64) string {
	firstOne := getFirstItem(1, arrA)
	firstMinusOne := getFirstItem(-1, arrA)

	for i := len(arrA)-1; i >= 0; i-- {
		if arrA[i] < arrB[i] {
			if firstOne >= i {
				return "NO"
			}
		} else if arrA[i] > arrB[i] {
			if firstMinusOne >= i {
				return "NO"
			}
		}
	}
	return "YES"
}

func getFirstItem(a int64, list []int64) int {
	for i, b := range list {
		if b == a {
			return i
		}
	}
	return len(list)+1
}

package main

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

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

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

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

func scanString() string {
	if sc.Scan() {
		return sc.Text()
	}
	panic(sc.Err())
}

var sc = newScanner()

func main() {
	for t := scanInt(); t > 0; t-- {
		n := scanInt()
		a := scanInts(n)
		b := scanInts(n)
		minus, plus := false, false
		for i := n - 1; i >= 0; i-- {
			if a[i] < 0 {
				minus = false
			} else if a[i] > 0 {
				plus = false
			}
			if a[i] > b[i] {
				minus = true
			} else if a[i] < b[i] {
				plus = true
			}
		}
		if minus || plus {
			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()
        aa := []int64{}
        bb := []int64{}
        for i := int64(0); i < n; i++ {
            aa = append(aa, reader.NextInt64())
        }
        for i := int64(0); i < n; i++ {
            bb = append(bb, reader.NextInt64())
        }
        writer.Printf("%s\n", sol(aa, bb))
    }
}

func sol(aa, bb []int64) string {
    seenPlus := false
    seenMinus := false
    for p := 0; p < len(aa); p++ {
        if seenPlus && bb[p] > aa[p] {
            // do nothing
        } else if seenMinus && bb[p] < aa[p] {
            // do nothing
        } else if aa[p] == bb[p] {
            // do nothing
        } else {
            return "NO"
        }
        seenPlus = seenPlus || aa[p] == 1
        seenMinus = seenMinus || aa[p] == -1
    }
    return "YES"
}

package main

import (
	"fmt"
)

func main() {
	var t int
	var A [100000]int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		var n, m int
		fmt.Scanf("%d\n", &n)
		for j := 0; j < n; j++ {
			if j < n-1 {
				fmt.Scanf("%d", &A[j])
			} else {
				fmt.Scanf("%d", &A[j])
			}
		}
		fmt.Println()
		bo1, bo2, bo3 := false, false, true
		for j := 0; j < n; j++ {
			if j < n-1 {
				fmt.Scanf("%d", &m)
			} else {
				fmt.Scanf("%d", &m)
			}
			if A[j] > m && !bo1 {
				bo3 = false
			}
			if A[j] < m && !bo2 {
				bo3 = false
			}
			if A[j] < 0 {
				bo1 = true
			}
			if A[j] > 0 {
				bo2 = true
			}
		}
		if bo3 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	var A [100000]int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		var n, m int
		fmt.Scanf("%d\n", &n)
		for j := 0; j < n; j++ {
			if j < n-1 {
				fmt.Scanf("%d ", &A[j])
			} else {
				fmt.Scanf("%d\n", &A[j])
			}
		}
		fmt.Println()
		bo1, bo2, bo3 := false, false, true
		for j := 0; j < n; j++ {
			if j < n-1 {
				fmt.Scanf("%d ", &m)
			} else {
				fmt.Scanf("%d\n", &m)
			}
			if A[j] > m && !bo1 {
				bo3 = false
			}
			if A[j] < m && !bo2 {
				bo3 = false
			}
			if A[j] < 0 {
				bo1 = true
			}
			if A[j] > 0 {
				bo2 = true
			}
		}
		if bo3 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	var A [100000]int
	var rn rune
	fmt.Scanf("%d%c", &t, &rn)
	for i := 0; i < t; i++ {
		var n, m int
		fmt.Scanf("%d%c", &n, &rn)
		for j := 0; j < n; j++ {
			fmt.Scanf("%d%c", &A[j], &rn)
		}
		bo1, bo2, bo3 := false, false, true
		for j := 0; j < n; j++ {
			fmt.Scanf("%d%c", &m, &rn)
			if A[j] > m && !bo1 {
				bo3 = false
			}
			if A[j] < m && !bo2 {
				bo3 = false
			}
			if A[j] < 0 {
				bo1 = true
			}
			if A[j] > 0 {
				bo2 = true
			}
		}
		if bo3 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	var A [100000]int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		var n, m int
		fmt.Scanf("%d\n", &n)
		for j := 0; j < n; j++ {
			if j < n-1 {
				fmt.Scanf("%d", &A[j])
			} else {
				fmt.Scanf("%d", &A[j])
			}
		}
		fmt.Println()
		bo1, bo2, bo3 := false, false, true
		for j := 0; j < n; j++ {
			if j < n-1 {
				fmt.Scanf("%d", &m)
			} else {
				fmt.Scanf("%d", &m)
			}
			if A[j] > m && !bo1 {
				bo3 = false
			}
			if A[j] < m && !bo2 {
				bo3 = false
			}
			if A[j] < 0 {
				bo1 = true
			}
			if A[j] > 0 {
				bo2 = true
			}
		}
		if bo3 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	var A, B [100][100]int
	var N [100000]int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		fmt.Scanf("%d\n", &N[i])
		for j := 0; j < N[i]; j++ {
			fmt.Scanf("%d", &A[i][j])
		}
		for j := 0; j < N[i]; j++ {
			fmt.Scanf("%d", &B[i][j])
		}
		// bo1, bo2, bo3 := false, false, true
		// for j := 0; j < n; j++ {
		// 	m = B[j]
		// 	if A[j] > m && !bo1 {
		// 		bo3 = false
		// 	}
		// 	if A[j] < m && !bo2 {
		// 		bo3 = false
		// 	}
		// 	if A[j] < 0 {
		// 		bo1 = true
		// 	}
		// 	if A[j] > 0 {
		// 		bo2 = true
		// 	}
		// }
		// if bo3 {
		// 	fmt.Println("YES")
		// } else {
		// 	fmt.Println("NO")
		// }
	}

	fmt.Printf("t=%d\n", t)
	for i := 0; i < t; i++ {
		fmt.Printf("n=%d\n", N[i])
		for j := 0; j < N[i]; j++ {
			fmt.Printf("%d ", A[i][j])
		}
		fmt.Println()
		for j := 0; j < N[i]; j++ {
			fmt.Printf("%d ", B[i][j])
		}
		fmt.Println()
		fmt.Println()
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	var A, B [100][100]int
	var N [100000]int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		fmt.Scanf("%d\n", &N[i])
		for j := 0; j < N[i]; j++ {
			if j == N[i]-1 {
				fmt.Scanf("%d\n", &A[i][j])
			} else {
				fmt.Scanf("%d", &A[i][j])
			}
		}
		for j := 0; j < N[i]; j++ {
			if j == N[i]-1 {
				fmt.Scanf("%d\n", &B[i][j])
			} else {
				fmt.Scanf("%d", &B[i][j])
			}
		}
		// bo1, bo2, bo3 := false, false, true
		// for j := 0; j < n; j++ {
		// 	m = B[j]
		// 	if A[j] > m && !bo1 {
		// 		bo3 = false
		// 	}
		// 	if A[j] < m && !bo2 {
		// 		bo3 = false
		// 	}
		// 	if A[j] < 0 {
		// 		bo1 = true
		// 	}
		// 	if A[j] > 0 {
		// 		bo2 = true
		// 	}
		// }
		// if bo3 {
		// 	fmt.Println("YES")
		// } else {
		// 	fmt.Println("NO")
		// }
	}

	fmt.Printf("t=%d\n", t)
	for i := 0; i < t; i++ {
		fmt.Printf("n=%d\n", N[i])
		for j := 0; j < N[i]; j++ {
			fmt.Printf("%d ", A[i][j])
		}
		fmt.Println()
		for j := 0; j < N[i]; j++ {
			fmt.Printf("%d ", B[i][j])
		}
		fmt.Println()
		fmt.Println()
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	var A, B [100000]int
	var rn rune
	fmt.Scanf("%d%c", &t, &rn)
	for i := 0; i < t; i++ {
		var n, m int
		fmt.Scanf("%d%c", &n, &rn)
		for j := 0; j < n; j++ {
			fmt.Scanf("%d%c", &A[j], &rn)
			fmt.Printf("%d ", A[j])
		}
		fmt.Println()
		for j := 0; j < n; j++ {
			fmt.Scanf("%d%c", &B[j], &rn)
			fmt.Printf("%d ", B[j])
		}
		bo1, bo2, bo3 := false, false, true
		for j := 0; j < n; j++ {
			m = B[j]
			// fmt.Scanf("%d%c", &m, &rn)
			if A[j] > m && !bo1 {
				bo3 = false
			}
			if A[j] < m && !bo2 {
				bo3 = false
			}
			if A[j] < 0 {
				bo1 = true
			}
			if A[j] > 0 {
				bo2 = true
			}
		}
		if bo3 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	var A, B [100000]int
	var rn rune
	fmt.Scanf("%d%c", &t, &rn)
	fmt.Printf("t=%d\n", t)
	for i := 0; i < t; i++ {
		var n, m int
		fmt.Scanf("%d%c", &n, &rn)
		fmt.Printf("n=%d\n", n)
		for j := 0; j < n; j++ {
			fmt.Scanf("%d%c", &A[j], &rn)
			fmt.Printf("%d ", A[j])
		}
		fmt.Println()
		for j := 0; j < n; j++ {
			fmt.Scanf("%d%c", &B[j], &rn)
			fmt.Printf("%d ", B[j])
		}
		fmt.Println()
		bo1, bo2, bo3 := false, false, true
		for j := 0; j < n; j++ {
			m = B[j]
			// fmt.Scanf("%d%c", &m, &rn)
			if A[j] > m && !bo1 {
				bo3 = false
			}
			if A[j] < m && !bo2 {
				bo3 = false
			}
			if A[j] < 0 {
				bo1 = true
			}
			if A[j] > 0 {
				bo2 = true
			}
		}
		if bo3 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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()
        aa := []int64{}
        bb := []int64{}
        for i := int64(0); i < n; i++ {
            aa = append(aa, reader.NextInt64())
        }
        for i := int64(0); i < n; i++ {
            bb = append(bb, reader.NextInt64())
        }
        writer.Printf("%s\n", sol(aa, bb))
    }
}

func sol(aa, bb []int64) string {
    seenPlus := false
    seenMinus := false
    for p := 0; p < len(aa); p++ {
        if seenPlus && bb[p] > aa[p] {
            // do nothing
        } else if seenMinus && bb[p] < aa[p] {
            // do nothing
        } else if aa[p] == bb[p] {
            // do nothing
        } else {
            return "NO"
        }
        seenPlus = aa[p] == 1
        seenMinus = aa[p] == -1
    }
    return "YES"
}


The score of an array $$$v_1,v_2,\ldots,v_n$$$ is defined as the number of indices $$$i$$$ ($$$1 \le i \le n$$$) such that $$$v_1+v_2+\ldots+v_i = 0$$$.You are given an array $$$a_1,a_2,\ldots,a_n$$$ of length $$$n$$$. You can perform the following operation multiple times:  select an index $$$i$$$ ($$$1 \le i \le n$$$) such that $$$a_i=0$$$;  then replace $$$a_i$$$ by an arbitrary integer.  What is the maximum possible score of $$$a$$$ that can be obtained by performing a sequence of such operations?

Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ ($$$-10^9 \le a_i \le 10^9$$$) — array $$$a$$$. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.

For each test case, print the maximum possible score of the array $$$a$$$ after performing a sequence of operations.

NoteIn the first test case, it is optimal to change the value of $$$a_2$$$ to $$$-2$$$ in one operation.The resulting array $$$a$$$ will be $$$[2,-2,1,-1,0]$$$, with a score of $$$3$$$:  $$$a_1+a_2=2-2=0$$$;  $$$a_1+a_2+a_3+a_4=2-2+1-1=0$$$;  $$$a_1+a_2+a_3+a_4+a_5=2-2+1-1+0=0$$$. In the second test case, it is optimal to change the value of $$$a_3$$$ to $$$-2\,000\,000\,000$$$, giving us an array with a score of $$$1$$$.In the third test case, it is not necessary to perform any operations.

package main

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

func get_max(freq map[int64]int) int {
	max := 0
	for _, f := range freq {
		if max < f {
			max = f
		}
	}
	return max
}

func main() {
	r := bufio.NewReader(os.Stdin)
	var T int
	fmt.Fscan(r, &T)
	for t := 0; t < T; t += 1 {
		var N int
		fmt.Fscan(r, &N)
		a := make([]int64, N)
		for i := 0; i < N; i += 1 {
			fmt.Fscan(r, &a[i])
		}
		var sum int64
		ans := 0
		i := 0
		for ; i < N && a[i] != 0; i += 1 {
			sum += a[i]
			if sum == 0 {
				ans += 1
			}
		}
		freq := make(map[int64]int)
		for ; i < N; i += 1 {
			if a[i] == 0 {
				ans += get_max(freq)
				freq = make(map[int64]int)
			}
			sum += a[i]
			freq[sum] += 1
		}
		ans += get_max(freq)
		fmt.Println(ans)
	}
}

package main

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

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

func ans() {
	var n int
	Fscan(in, &n)
	var a []int64 = make([]int64, n)
	sum := int64(0)
	ans := int64(0)
	for i := 0; i < n; i++ {
		Fscan(in, &a[i])
	}
	for i := 0; i < n; i++ {
		if a[i] != 0 {
			sum += a[i]
			continue
		}
		if i+1 == n || a[i+1] == 0 {
			a[i] = -sum
			sum = 0
			continue
		}
		r := i + 1
		var cnt map[int64]int = make(map[int64]int)
		mx := 0
		who := int64(-1)
		old_sum := sum
		cnt[sum] = 1
		for ; r < n; r++ {
			sum += a[r]
			cnt[sum]++
			if cnt[sum] > mx {
				mx = cnt[sum]
				who = sum
			}
			if a[r] == 0 {
				break
			}
		}
		sum = old_sum
		a[i] = -who
		sum += a[i]
	}
	sum = int64(0)
	for i := 0; i < n; i++ {
		sum += a[i]
		if sum == 0 {
			ans++
		}
	}
	Fprintln(out, ans)
}

func main() {
	defer out.Flush()
	var t int
	Fscan(in, &t)
	for i := 0; i < t; i++ {
		ans()
	}
}

package main

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

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

func ans() {
	var n int
	Fscan(in, &n)
	var a []int64 = make([]int64, n)
	sum := int64(0)
	ans := int64(0)
	for i := 0; i < n; i++ {
		Fscan(in, &a[i])
	}
	for i := 0; i < n; i++ {
		if a[i] != 0 {
			sum += a[i]
			continue
		}
		if i+1 == n || a[i+1] == 0 {
			a[i] = -sum
			sum = 0
			continue
		}
		r := i + 1
		var cnt map[int64]int = make(map[int64]int)
		mx := 0
		who := int64(-1)
		old_sum := sum
		for ; r < n; r++ {
			sum += a[r]
			cnt[sum]++
			if cnt[sum] > mx {
				mx = cnt[sum]
				who = sum
			}
			if a[r] == 0 {
				break
			}
		}
		sum = old_sum
		a[i] = -who
		sum += a[i]
	}
	sum = int64(0)
	for i := 0; i < n; i++ {
		sum += a[i]
		if sum == 0 {
			ans++
		}
	}
	Fprintln(out, ans)
}

func main() {
	defer out.Flush()
	var t int
	Fscan(in, &t)
	for i := 0; i < t; i++ {
		ans()
	}
}


You are given an array $$$a_1, a_2, \ldots, a_n$$$ of positive integers. A good pair is a pair of indices $$$(i, j)$$$ with $$$1 \leq i, j \leq n$$$ such that, for all $$$1 \leq k \leq n$$$, the following equality holds:$$$$$$ |a_i - a_k| + |a_k - a_j| = |a_i - a_j|, $$$$$$ where $$$|x|$$$ denotes the absolute value of $$$x$$$.Find a good pair. Note that $$$i$$$ can be equal to $$$j$$$.

The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the length of the array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 10^9$$$) where $$$a_i$$$ is the $$$i$$$-th element of the array. The sum of $$$n$$$ for all test cases is at most $$$2 \cdot 10^5$$$.

For each test case, print a single line with two space-separated indices $$$i$$$ and $$$j$$$ which form a good pair of the array. The case $$$i=j$$$ is allowed. It can be shown that such a pair always exists. If there are multiple good pairs, print any of them.

package main
import "fmt"
import "os"
import "bufio"
var (
	input = bufio.NewReader(os.Stdin)
	ouput = bufio.NewWriter(os.Stdout)
)

func main() {
	count := 0
	fmt.Fscan(input,&count)
	ans := make([][2]int,0,count)
	for count>0 {
		count --
		arrCnt := 0
		fmt.Fscan(input,&arrCnt)
		idx := 0
		minI := -1
		maxI := -1
		maxV := 0
		minV := 0
		for arrCnt>0 {
			arrCnt--
			v := 0
			fmt.Fscan(input,&v)
			if minI==-1 || minV > v {
				minI = idx
				minV = v
			}
			if maxI==-1 ||maxV<v {
				maxV = v
				maxI = idx
			}
			idx ++
		}
		ans = append(ans,[2]int{minI+1,maxI+1})
	}
	for _,a := range ans {
		fmt.Printf("%d  %d\n",a[0],a[1])
	}
}

package main
// github.com/jamesgrimard/codeforces
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		var b,s,ib,is int
		for j:=0;j<n;j++{
			var x int
			fmt.Fscan(in,&x)
			if x > b || j == 0 {
				b = x
				ib = j+1
			}
			if x < s || j == 0 {
				s = x
				is = j+1
			}
		}
		if is < ib {
			fmt.Fprintln(out,is,ib)
		} else {
			fmt.Fprintln(out,ib,is)
		}
	}
}

package main

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

func main() {

	reader := bufio.NewReader(os.Stdin)
	writter := bufio.NewWriter(os.Stdout)
	defer writter.Flush()

	t := 0
	fmt.Fscan(reader, &t)

	for t > 0 {
		n := 0
		fmt.Fscan(reader, &n)

		a := make([]int, n)
		for i := range a {
			fmt.Fscan(reader, &a[i])
		}

		result := solve(n, a)

		for i := range result {
			fmt.Fprintf(writter, "%d ", result[i])
		}

		fmt.Fprintln(writter)

		t--
	}

	// n := 3
	// a := []int{5, 2, 7}

	// fmt.Println(solve(n, a))

}

func solve(n int, a []int) []int {

	result := make([]int, 2)
	min, minP, max, maxP := 1000000001, -1, 0, -1

	for i := range a {
		if a[i] < min {
			min = a[i]
			minP = i
		}

		if a[i] > max {
			max = a[i]
			maxP = i
		}
	}

	result[0] = minP + 1
	result[1] = maxP + 1

	// for i := 0; i < n; i++ {
	// 	for j := i; j < n; j++ {
	// 		for k := range a {
	// 			if math.Abs(float64(a[i]-a[k]))+math.Abs(float64(a[k]-a[j])) != math.Abs(float64(a[i]-a[j])) {
	// 				break
	// 			}

	// 			if k == len(a)-1 {
	// 				result[0] = i + 1
	// 				result[1] = j + 1
	// 				return result
	// 			}
	// 		}
	// 	}
	// }

	return result
}

package main

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

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

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

	for i := 0; i < tc; i++ {
		var n int
		_, _ = fmt.Fscan(r, &n)

		numbers := make([]int, n)
		for i := range numbers {
			_, _ = fmt.Fscan(r, &numbers[i])
		}

		answer1, answer2 := goodPairs(numbers)

		fmt.Println(answer1, answer2)
	}
}

func goodPairs(numbers []int) (int, int) {
	numIdxMap := make(map[int]int)
	for i, number := range numbers {
		numIdxMap[number] = i
	}

	sort.Ints(numbers)

	return numIdxMap[numbers[0]] + 1, numIdxMap[numbers[len(numbers)-1]] + 1
}

package main

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

var (
	input = bufio.NewReader(os.Stdin)
	ouput = bufio.NewWriter(os.Stdout)
)

func main() {
	var t, n, x int
	fmt.Fscan(input, &t)
	for i := 0; i < t; i++ {
		var max, min, lmin, lmax int = -1000000001, 1000000001, -1, -1
		fmt.Fscan(input, &n)
		for j := 1; j <= n; j++ {
			fmt.Fscan(input, &x)
			if x > max {
				max = x
				lmax = j
			}
			if x < min {
				min = x
				lmin = j
			}
		}
		if lmin < lmax {
			fmt.Printf("%d %d\n", lmin, lmax)
		} else {
			fmt.Printf("%d %d\n", lmax, lmin)
		}

	}
}

package main

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

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

func (in *CF1656A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1656A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

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

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

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

/**
Run solve the problem CF1656A
Date: 11/04/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1656/A
Problem: CF1656A
**/
func (in *CF1656A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		min , max := 0, 0
		indexmin , indexmax := 0, 0
		for i:=0;i<n;i++{
			val := in.NextInt()
			if i == 0{
				min = val
				max = val
				indexmax = i+1
				indexmin = i+1
			}

			if val < min {
				min = val
				indexmin = i+1
			}

			if val > max {
				max = val
				indexmax = i+1
			}
		}
		fmt.Println(indexmin,indexmax)
	}
}

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

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

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

func main(){
	read := bufio.NewReader(os.Stdin)
	write := bufio.NewWriter(os.Stdout)

	defer write.Flush()

	var tc int

	for Fscan (read, &tc); tc > 0; tc -- {
		var n int
		Fscan (read, &n)
		min, max, min_ind, max_ind := 1 << 30, 0, -1, -1

		for i := 1; i <= n; i++ {
			var val int
			Fscan (read, &val)
			if val < min {
				min, min_ind = val, i
			}
			if val > max {
				max, max_ind = val, i
			}
		}
		Fprintln(write, min_ind, max_ind)
	}
}

package main

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

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

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

	var t int
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		var n int
		fmt.Fscan(in, &n)
		maxinum := -0x3f3f3f3f
		maxidx := 0
		mininum := 0x3f3f3f3f
		minidx := 0
		for j := 0; j < n; j++ {
			var num int
			fmt.Fscan(in, &num)
			if maxinum < num {
				maxinum = num
				maxidx = j
			}
			if mininum > num {
				mininum = num
				minidx = j
			}
		}
		// solve
		fmt.Fprintln(out, minidx+1, maxidx+1)
	}
}

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 abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

package main

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

func main() {
	in, out := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ii := 0; ii < t; ii++ {
		var n int
		fmt.Fscan(in, &n)
		nums := make([]int, n)
		min, max := 0, 0
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &nums[i])
			if nums[i] < nums[min] {
				min = i
			}
			if nums[i] > nums[max] {
				max = i
			}
		}
		fmt.Fprintln(out, min+1, max+1)
	}
}

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 < T; t++ {
		var n int
		fmt.Fscan(in, &n)

		arr := make([]int64, n)
		low, high := 0, 0
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &arr[i])
			if arr[i] < arr[low] {
				low = i
			}

			if arr[i] > arr[high] {
				high = i
			}
		}

		fmt.Fprintln(out, low+1, high+1)
	}
}

package main

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

/*
1
5
1 2 2 1 4
---
1 1
*/

//goland:noinspection GoUnhandledErrorResult
func solve() {
	var n int
	scanf("%d\n", &n)

	a := make([]int, n)

	for i := 0; i < n; i++ {
		scanf("%d", &a[i])
	}
	scanf("\n")

	fmt.Fprintln(writer, minIdx(a...)+1, maxIdx(a...)+1)
}

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	t := 1
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		solve()
	}
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

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

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func reversed(s string) string {
	input := []rune(s)
	li := len(input)
	ret := make([]rune, li)
	for i, r := range input {
		ret[li-i-1] = r
	}
	return string(ret)
}

//goland:noinspection GoUnusedFunction
func divCeil(num, div int64) int64 {
	quot := num / div
	if num%div > 0 {
		quot++
	} else if num%div < 0 {
		quot--
	}
	return quot
}

//goland:noinspection GoUnusedFunction
func minIdx(nums ...int) int {
	minNumIdx := 0
	for i, num := range nums {
		if num < nums[minNumIdx] {
			minNumIdx = i
		}
	}

	return minNumIdx
}

//goland:noinspection GoUnusedFunction
func maxIdx(nums ...int) int {
	maxNumIdx := 0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = i
		}
	}

	return maxNumIdx
}

//goland:noinspection GoUnusedFunction
func abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

//goland:noinspection GoUnusedFunction
func isPrime(num int) bool {
	if num == 2 || num == 3 {
		return true
	}

	if num <= 1 || num%2 == 0 || num%3 == 0 {
		return false
	}

	for i := 5; i*i <= num; i += 6 {
		if num%i == 0 || num%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	if num == 0 {
		return 0
	}

	num = abs(num)

	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}

package main

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

func main() {
	var (
		t int
	)

	reader := bufio.NewReader(os.Stdin)
	fmt.Scanf("%d\n", &t)

	for t > 0 {
		t--

		text, _ := reader.ReadString('\n')
		ninps := strings.Fields(text)
		//n, _ := strconv.Atoi(ninps[0])

		text, _ = reader.ReadString('\n')
		ninps = strings.Fields(text)
		largest := -1
		smallest := math.MaxInt32
		i := 0
		j := 0
		for k, val := range ninps {
			a, _ := strconv.Atoi(val)
			if a < smallest {
				smallest = a
				i = k+1
			}
			if a > largest {
				largest = a
				j = k+1
			}
		}
		fmt.Println(i,j)
	}
}

package main
import "fmt"
func main() {
	count := 0
	fmt.Scanf("%d",&count)
	ans := make([][2]int,0,count)
	for count>0 {
		count --
		arrCnt := 0
		fmt.Scanf("%d",&arrCnt)
		arr := make([]int,0,arrCnt)
		for arrCnt>0 {
			arrCnt--
			v := 0
			fmt.Scanf("%d",&v)
			arr = append(arr, v)
		}
		minI := 0
		maxI := 0
		for idx := range arr {
			if arr[idx]<arr[minI] {
				minI = idx
			}
			if arr[idx] > arr[maxI] {
				maxI = idx
			}
		}
		ans = append(ans,[2]int{minI+1,maxI+1})
	}
	for _,a := range ans {
		fmt.Printf("%d  %d\n",a[0],a[1])
	}
}

package main
import "fmt"
func main() {
	count := 0
	fmt.Scanf("%d",&count)
	for count>0 {
		count --
		arrCnt := 0
		fmt.Scanf("%d",&arrCnt)
		arr := make([]int,0,arrCnt)
		for arrCnt>0 {
			arrCnt--
			v := 0
			fmt.Scanf("%d",&v)
			arr = append(arr, v)
		}
		minI := 0
		maxI := 0
		for idx := range arr {
			if arr[idx]<arr[minI] {
				minI = idx
			}
			if arr[idx] > arr[maxI] {
				maxI = idx
			}
		}
		fmt.Printf("%d %d\n", minI+1, maxI+1)
	}
}

package main
import "fmt"
func main() {
	count := 0
	fmt.Scanf("%d",&count)
	for count>0 {
		count --
		arrCnt := 0
		fmt.Scanf("%d",&arrCnt)
		arr := make([]int,0,arrCnt)
		for arrCnt>0 {
			arrCnt--
			v := 0
			fmt.Scanf("%d",&v)
			arr = append(arr, v)
		}
		minI := 0
		maxI := 0
		for idx := range arr {
			if arr[idx]<arr[minI] {
				minI = idx
			}
			if arr[idx] > arr[maxI] {
				maxI = idx
			}
		}
		fmt.Println(fmt.Sprintf("%d  %d",minI+1,maxI+1))
	}
}

package main
import "fmt"
func main() {
	count := 0
	fmt.Scanf("%d",&count)
	ans := make([][2]int,0,count)
	for count>0 {
		count --
		arrCnt := 0
		fmt.Scanf("%d",&arrCnt)
		arr := make([]int,0,arrCnt)
		for arrCnt>0 {
			arrCnt--
			v := 0
			fmt.Scanf("%d",&v)
			arr = append(arr, v)
		}
		minI := 0
		maxI := 0
		for idx := range arr {
			if arr[idx]<arr[minI] {
				minI = idx
			}
			if arr[idx] > arr[maxI] {
				maxI = idx
			}
		}
		ans = append(ans,[2]int{minI+1,maxI+1})
	}
	for _,a := range ans {
		fmt.Println(fmt.Sprintf("%d  %d",a[0],a[1]))
	}
}

package main
// github.com/jamesgrimard/codeforces
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		a:= make([]int,n)
		for j:=0;j<n;j++{
			fmt.Fscan(in,&a[j])
		}
		if n == 1 {
			fmt.Fprintln(out,1,1)
			continue
		} else if n == 2 {
			fmt.Fprintln(out,1,2)
			continue
		}
		var count int
		for l:=0;l<n-1;l++{
			for j:=l+1;j<n;j++{
				for k:=0;k<n;k++ {
					if abs(a[j]-a[k]) + abs(a[l]-a[k]) == abs(a[j]-a[l]) {
						fmt.Fprintln(out,l+1,j+1)
						goto out
					}
				}
				if count == 0 {
					fmt.Fprintln(out,l+1,j+1)
					goto out
				}
			}
		}
		out:
	}
}

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

package main
// github.com/jamesgrimard/codeforces
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		a:= make([]int,n)
		for j:=0;j<n;j++{
			fmt.Fscan(in,&a[j])
		}
		if n == 1 {
			fmt.Fprintln(out,1,1)
			continue
		} else if n == 2 {
			fmt.Fprintln(out,1,2)
			continue
		}
		var count int
		for j:=1;j<n;j++{
			count = 0
			for k:=0;k<n;k++ {
				if abs(a[j]-a[k]) + abs(a[j-1]-a[k]) != abs(a[j]-a[j-1]) {
					count++
					continue
				}
			}
			if count == 0 {
				fmt.Fprintln(out,j,j+1)
				break
			}
		}
	}
}

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

package main
// github.com/jamesgrimard/codeforces
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		a:= make([]int,n)
		for j:=0;j<n;j++{
			fmt.Fscan(in,&a[j])
		}
		if n == 1 {
			fmt.Fprintln(out,1,1)
			continue
		} else if n == 2 {
			fmt.Fprintln(out,1,2)
			continue
		}
		for j:=1;j<n;j++{
			for k:=0;k<n;k++ {
				if k != j || k != j-1 {
					if abs(a[j]-a[k]) + abs(a[j-1]-a[k]) == abs(a[j]-a[j-1]) {
						fmt.Fprintln(out,j,j+1)
						goto out
					}
				}
			}
		}
		out:
	}
}

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

package main
// github.com/jamesgrimard/codeforces
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		for j:=0;j<n;j++{
			var x int
			fmt.Fscan(in,&x)
		}
		fmt.Fprintln(out,1,1)
	}
}

package main

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

func main() {

	reader := bufio.NewReader(os.Stdin)
	writter := bufio.NewWriter(os.Stdout)
	defer writter.Flush()

	t := 0
	fmt.Fscan(reader, &t)

	for t > 0 {
		n := 0
		fmt.Fscan(reader, &n)

		a := make([]int, n)
		for i := range a {
			fmt.Fscan(reader, &a[i])
		}

		fmt.Fprintln(writter, solve(n, a))

		t--
	}

	// n := 3
	// a := []int{5, 2, 7}

	// fmt.Println(solve(n, a))

}

func solve(n int, a []int) []int {

	result := make([]int, 2)

	for i := 0; i < n; i++ {
		for j := i; j < n; j++ {
			for k := range a {
				if math.Abs(float64(a[i]-a[k]))+math.Abs(float64(a[k]-a[j])) != math.Abs(float64(a[i]-a[j])) {
					break
				}

				if k == len(a)-1 {
					result[0] = i + 1
					result[1] = j + 1
					return result
				}
			}
		}
	}

	return result
}

package main

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

var (
	input = bufio.NewReader(os.Stdin)
	ouput = bufio.NewWriter(os.Stdout)
)

func main() {
	var t, n, x int
	fmt.Fscan(input, &t)
	for i := 0; i < t; i++ {
		var max, min, lmin, lmax int = -1000000001, 1000000001, -1, -1
		fmt.Fscan(input, &n)
		for j := 0; j < n; j++ {
			fmt.Fscan(input, &x)
			if x > max {
				max = x
				lmax = j
			}
			if x < min {
				min = x
				lmin = j
			}
		}
		if lmin < lmax {
			fmt.Fprintf(ouput, "%d %d", lmin, lmax)
		} else {
			fmt.Fprintf(ouput, "%d %d", lmax, lmin)
		}

	}
}