package main

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

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

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

	l, r := 0, n-1
	for ; l < n-1 && arr[l] < arr[l+1]; l++ {
	}
	for ; r > 0 && arr[r-1] > arr[r]; r-- {
	}
	incSum := int64(0)
	for l < r {
		if l+1 == r {
			if arr[l] == arr[r] {
				incSum++
			}
			break
		}
		if arr[l] <= arr[r] {
			// 先追平右侧
			if delta := arr[l] + 1 - arr[l+1]; delta >= 0 {
				incSum += delta
				arr[l+1] += delta
			}
			l++
		} else {
			// 先追平左侧
			if delta := arr[r] + 1 - arr[r-1]; delta >= 0 {
				incSum += delta
				arr[r-1] += delta
			}
			r--
		}
	}
	Fprintln(out, incSum)
}

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

package main

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

// github.com/EndlessCheng/codeforces-go
func main() {
	in := bufio.NewReader(os.Stdin)
	var n int
	Fscan(in, &n)
	arr := make([]int64, n)
	for i := range arr {
		Fscan(in, &arr[i])
	}

	l, r := 0, n-1
	for ; l < n-1 && arr[l] < arr[l+1]; l++ {}
	for ; r > 0 && arr[r-1] > arr[r]; r-- {}
	sum := int64(0)
	for l < r {
		if l+1 == r {
			if arr[l] == arr[r] {
				sum++
			}
			break
		}
		if arr[l] <= arr[r] {
			if d := arr[l] + 1 - arr[l+1]; d >= 0 {
				sum += d
				arr[l+1] += d
			}
			l++
		} else {
			if d := arr[r] + 1 - arr[r-1]; d >= 0 {
				sum += d
				arr[r-1] += d
			}
			r--
		}
	}
	Print(sum)
}


package main
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)
		fmt.Fprintf(out,"%v ",n)
		for j:=1;j<n;j++{
			fmt.Fprintf(out,"%v ",j)
		}
		fmt.Fprintln(out,)
	}
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		var n int
		fmt.Scanf("%d\n", &n)
		for j := 0; j < n-1; j++ {
			fmt.Printf("%d ", j+2)
		}
		fmt.Printf("%d\n", 1)
	}
}

package main

import (
	"fmt"
	"strconv"
	"strings"
)

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

func print(m int) {
	result := make([]string, m)
	for i := 1; i <= m; i++ {
		p := i - 1
		if p == 0 {
			p = m
		}
		result[i-1] = strconv.FormatInt(int64(p), 10)
	}
	fmt.Println(strings.Join(result, " "))
}

// You can edit this code!
// Click here and start typing.
package main

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

type Element struct {
	value int
	pos   int
}

var a []Element
var res []Element
var dp [100004]int64
var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }
func min(a int64, b int64) int64 {
	if a <= b {
		return a
	}
	return b
}
func max(a int64, b int64) int64 {
	if a >= b {
		return a
	}
	return b
}
func abs(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}
func main() {
	defer writer.Flush()
	var t, n int
	scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		scanf("%d\n", &n)
		printf("%v", n)
		for j := 1; j < n; j++ {
			printf(" %v", j)
		}
		printf("\n")
	}
}

package main

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

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

func solve(n int) string {
	rs := make([]string, n)
	rs = append(rs, fmt.Sprint(n))
	for i := 1; i < n; i++ {
		rs = append(rs, fmt.Sprint(i))
	}
	return strings.Join(rs, " ")
}

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

package main

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

func A4() {
	_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 int
		Fscan(in, &n)
		Fprint(out, n, " ")
		for i := 1; i < n; i++ {
			Fprint(out, i, " ")
		}
		Fprintln(out)
	}
	// Coding...ove!
	for i := 0; i < cas; i++ {
		sol()
	}
}
func main() { A4() }

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

func main() {
    in := bufio.NewReader(os.Stdin)
    tc := readInt(in)
    for tc > 0 {
        n := readInt(in)
        if n == 1 {
            fmt.Println(1)
            tc--
            continue
        }
        fmt.Printf("2")
        for i:=2; i<n; i++ {
            fmt.Printf(" %d", i+1)
        }
        fmt.Printf(" 1\n")
        tc--
    }
}

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

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)

		if n%2 == 0 {
			for i := 0; i < n; i++ {
				d := i
				if d%2 == 0 {
					d += 2
				}
				fmt.Fprintf(out, "%d ", d)
			}
		} else {
			fmt.Fprintf(out, "%d ", 1)
			for i := 1; i < n; i++ {
				d := i
				if i%2 != 0 {
					d += 2
				}
				fmt.Fprintf(out, "%d ", d)
			}
		}
		fmt.Fprintln(out)
	}
}

package main

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

func solve() {
	n := get()
	put(n)
	space()
	for i := 1; i < n; i++ {
		put(i)
		space()
	}
	line()
}

const (
	once       = false
	maxBufSize = 0 //10000000
)

var (
	splitFunc = bufio.ScanWords //bufio.SplitFunc(nil)
)

func main() {
	in = bufio.NewScanner(bufio.NewReader(os.Stdin))
	if splitFunc != nil {
		in.Split(splitFunc)
	}
	if maxBufSize > 0 {
		in.Buffer(make([]byte, maxBufSize), maxBufSize)
	}

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

	if once {
		solve()
		return
	}

	t := get()
	for t > 0 {
		solve()
		t--
	}
}

var (
	in  *bufio.Scanner
	out *bufio.Writer
)

func get() int {
	x, _ := strconv.Atoi(gets())
	return x
}

func geta(n int) []int {
	a := make([]int, n)
	for i := range a {
		a[i] = get()
	}
	return a
}

func geta1(n int) []int {
	a := make([]int, n)
	for i := range a {
		a[i] = get() - 1
	}
	return a
}

func get64() int64 {
	x, _ := strconv.ParseInt(gets(), 10, 64)
	return x
}

func get64a(n int) []int64 {
	a := make([]int64, n)
	for i := range a {
		a[i] = get64()
	}
	return a
}

func get64a1(n int) []int64 {
	a := make([]int64, n)
	for i := range a {
		a[i] = get64() - 1
	}
	return a
}

func getf() float64 {
	x, _ := strconv.ParseFloat(gets(), 64)
	return x
}

func getfa(n int) []float64 {
	a := make([]float64, n)
	for i := range a {
		a[i] = getf()
	}
	return a
}

func gets() string {
	scan()
	return in.Text()
}

func scanN(n int) {
	for n > 0 {
		scan()
		n--
	}
}

func scan() {
	in.Scan()
}

func putc(c rune) {
	out.WriteRune(c)
}

func line() {
	putc('\n')
}

func space() {
	putc(' ')
}

func put(x int) {
	out.WriteString(strconv.Itoa(x))
}

func putln(i int) {
	put(i)
	line()
}

func puta(a []int) {
	for _, v := range a {
		put(v)
		space()
	}
	line()
}

func put64(x int64) {
	out.WriteString(strconv.FormatInt(x, 10))
}

func put64ln(x int64) {
	put64(x)
	line()
}

func put64a(a []int64) {
	for _, v := range a {
		put64(v)
		space()
	}
	line()
}

func puts(s string) {
	out.WriteString(s)
}

func putsln(s string) {
	puts(s)
	line()
}

func yn(y bool) {
	if y {
		yes()
		return
	}
	no()
}

func yes() {
	puts("YES\n")
}

func no() {
	puts("NO\n")
}

func putf(x float64) {
	out.WriteString(strconv.FormatFloat(x, 'f', -1, 64))
}

func putfln(x float64) {
	putf(x)
	line()
}

func putfa(a []float64) {
	for _, v := range a {
		putf(v)
		space()
	}
	line()
}

type IntTp interface {
	int | int64
}

type Tp interface {
	IntTp | float64
}

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

func fabs(x float64) float64 {
	return math.Abs(x)
}

func max1[T Tp](x T, y T) T {
	if x > y {
		return x
	}
	return y
}

func max[T Tp](xs ...T) T {
	r := xs[0]
	for _, x := range xs[1:] {
		r = max1(r, x)
	}
	return r
}

func maxa[T Tp](a []T) (i int, val T) {
	i, val = 0, a[0]
	for j := 1; j < len(a); j++ {
		if a[j] <= val {
			continue
		}
		i = j
		val = a[j]
	}
	return
}

func min1[T Tp](x T, y T) T {
	if x < y {
		return x
	}
	return y
}

func min[T Tp](xs ...T) T {
	r := xs[0]
	for _, x := range xs[1:] {
		r = min1(r, x)
	}
	return r
}

func mina[T Tp](a []T) (i int, val T) {
	i, val = 0, a[0]
	for j := 1; j < len(a); j++ {
		if a[j] >= val {
			continue
		}
		i = j
		val = a[j]
	}
	return
}

func L(i int) int64 {
	return int64(i)
}

func F(i int) float64 {
	return float64(i)
}

func ints(n int, val int) (a []int) {
	a = make([]int, n)
	if val == 0 {
		return
	}
	for i := range a {
		a[i] = val
	}
	return
}

func int64s(n int, val int64) (a []int64) {
	a = make([]int64, n)
	if val == 0 {
		return
	}
	for i := range a {
		a[i] = val
	}
	return
}

func floats(n int, val float64) (a []float64) {
	a = make([]float64, n)
	if val == 0 {
		return
	}
	for i := range a {
		a[i] = val
	}
	return
}

const heapBase = 4

func children(i int) (int, int) {
	start := heapBase * i
	return start + 1, start + (1 + heapBase)
}

func parent(i int) int {
	return (i - 1) / heapBase
}

package main

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

func main() {
	input := bufio.NewReader(os.Stdin)
	cases := readInt(input)
	for asdf := 0; asdf < cases; asdf++ {
		n := readInt(input)
		fmt.Print(n)
		for i := 1; i < n; i++ {
			fmt.Print(" ")
			fmt.Print(i)
		}
		fmt.Println("")
	}
}

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.Atoi(nStr)
	return int64(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"
)

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

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

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

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

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

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

func main() {
	defer writer.Flush()
	for t := _int(); t > 0; t-- {
		n := _int()
		for i := 1; i <= n; i++ {
			c := i + 1
			if c > n {
				c -= n
			}
			printf("%d ", c)
		}
		printf("\n")
	}
}

package main

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

const cf = true

func solve() {
	var n int
	fmt.Fscan(in, &n)
	fmt.Fprint(out, n, " ")
	for i := 1; i < n; i++ {
		fmt.Fprint(out, i, " ")
	}
	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() {
	scanner := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	var ntests int
	fmt.Fscan(scanner, &ntests)
	for iter := 0; iter < ntests; iter++ {
		var n int
		fmt.Fscan(scanner, &n)
		for i := 2; i <= n; i++ {
			fmt.Fprintf(writer, "%d ", i)
		}
		fmt.Fprintln(writer, 1)
	}
}

package main

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

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

	tests, _ := strconv.Atoi(s[:len(s)-2])

	var n int
	for i := 0; i < tests; i++ {
		s, _ = reader.ReadString('\n')
		n, _ = strconv.Atoi(s[:len(s)-2])
		printPerm(n)
	}
}

func printPerm(n int) {
	fmt.Print(n)
	for i := 1; i < n; i++ {
		fmt.Printf(" %d", i)
	}
	fmt.Print("\n")
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var s string
	var err error

	s, err = reader.ReadString('\n')
	if err != nil {
		panic(err)
	}

	tests, err := strconv.Atoi(s[:len(s)-2])
	if err != nil {
		panic(err)
	}

	var n int
	for i := 0; i < tests; i++ {
		s, err = reader.ReadString('\n')
		if err != nil {
			panic(err)
		}

		n, err = strconv.Atoi(s[:len(s)-2])
		if err != nil {
			panic(err)
		}

		printPerm(n)
	}
}

func printPerm(n int) {
	for i := 0; i < n; i++ {
		if i == 0 {
			fmt.Print(n)
		} else {
			fmt.Printf(" %d", i)
		}

	}
	fmt.Print("\n")

}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var s string
	var err error

	s, err = reader.ReadString('\n')
	if err != nil {
		panic(err)
	}

	tests, err := strconv.Atoi(s[:len(s)-2])
	if err != nil {
		panic(err)
	}

	var n int
	for i := 0; i < tests; i++ {
		s, err = reader.ReadString('\n')
		if err != nil {
			panic(err)
		}

		n, err = strconv.Atoi(s[:len(s)-2])
		if err != nil {
			panic(err)
		}

		printPerm(minPerm(n))
	}
}

func minPerm(n int) []int {
	ret := make([]int, n)
	ret[0] = n
	for i := n - 1; i > 0; i-- {
		ret[i] = i
	}

	return ret
}

func printPerm(perm []int) {
	for i := range perm {
		if i == 0 {
			fmt.Print(perm[i])
		} else {
			fmt.Printf(" %d", perm[i])
		}

	}
	fmt.Print("\n")
}

package main

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

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

func CF1711A(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 int64
		fmt.Fscan(r, &n)
		for i := int64(1); i<n; i++ {
			fmt.Fprint(w,  i+1, " ")
		}
		fmt.Fprintln(w, 1 )
	}
}

package main

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

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

func CF1711A(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 int64
		fmt.Fscan(r, &n)
		for i := int64(1); i<n; i++ {
			fmt.Fprint(w,  i+1, " ")
		}
		fmt.Fprintln(w,  1)
	}
}

package main

import "fmt"

func main() {
	var (
		t int
		n int
	)
	fmt.Scan(&t)
	for t > 0 {
		t--
		fmt.Scan(&n)
		fmt.Printf("%d ", n)
		for i := 1; i < n; i++ {
			fmt.Printf("%d ", i)
		}
		fmt.Println()
	}
}

package main

import "fmt"

func main() {
	var (
		t int
		n int
	)
	fmt.Scan(&t)
	for t > 0 {
		t--
		fmt.Scan(&n)
		if n == 1 {
			fmt.Println(n)
			continue
		}
		if n % 2 == 0 {
			for i := 0; i < n; i++ {
				if i % 2 == 0 {
					fmt.Printf("%d ", i + 2)
				} else {
					fmt.Printf("%d ", i)
				}
			}
		} else {
			fmt.Printf("%d ", n)
			for i := 1; i < n; i++ {
				fmt.Printf("%d ", i)
			}
		}

		fmt.Println()
	}
}

package main

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

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

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

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

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

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

/**
Run solve the problem CF11711A
Date: 29/07/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1711/A
Problem: CF11711A
**/
func (in *CF11711A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		ans := strings.Builder{}
		ans.WriteString(fmt.Sprintf("%d", n))
		for i := 1; i < n; i++ {
			ans.WriteString(fmt.Sprintf(" %d", i))
		}
		fmt.Println(ans.String())
	}
}

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

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

package main

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

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

func solve() {
	var n int
	_, _ = fmt.Fscan(bufferedStdin, &n)
	_, _ = fmt.Fprintf(bufferedStdout, "%d ", n)
	for i := 1; i < n; i++ {
		_, _ = fmt.Fprintf(bufferedStdout, "%d ", i)
	}
	_, _ = fmt.Fprintf(bufferedStdout, "\n")
}

func main() {
	var t = 1
	_, _ = fmt.Fscan(bufferedStdin, &t)
	for i := 0; i < t; i++ {
		solve()
	}
	_ = bufferedStdout.Flush()
}

package main

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

var in = bufio.NewReader(os.Stdin)

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

func pl(a ...interface{}) { fmt.Println(a...) }
func pf(format string, a ...interface{}) { fmt.Printf(format, a...) }
func scan(a ...interface{}) { fmt.Fscan(in, a...) }

func solve() {
  var n int
  scan(&n)
  for i := 2; i <= n; i++ { pf("%d ", i) }
  pf("1\n")
}

func main() {
	var T int
	scan(&T)
	for ; T > 0; T-- {
    solve()
	}
}

func ys(b bool) string { return map[bool]string {true: "YES", false: "NO"}[b] }

package main

import "fmt"

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

	for varr := 0; varr <t; varr++ {
		var n int
		fmt.Scanln(&n)

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

		fmt.Println()
	}

}

package main

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

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

	var tests int
	fmt.Fscan(reader, &tests)
	for t := 0; t < tests; t++ {
		var n int
		fmt.Fscan(reader, &n)
		if n == 1 {
			fmt.Println(1)
			continue
		}
		for i := 2; i <= n; i++ {
			fmt.Print(i, " ")
		}
		fmt.Println(1)

	}
}

package main

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

var dnl = "%d\n"
var dws = "%d "

func main() {
	defer writer.Flush()
	var t, n, q uint32
	nlPtr := &dnl
	wsPtr := &dws
	scanf(*nlPtr, &t)
	for ; t > 0; t-- {
		scanf(*nlPtr, &n)
		for q = 2; q <= n; q++ {
			printf(*wsPtr, q)
		}
		printf(*nlPtr, 1)
	}
}

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

package main

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

var dnl = "%d\n"
var dws = "%d "

func main() {
	defer writer.Flush()
	var t, n int
	nlPtr := &dnl
	wsPtr := &dws
	scanf(*nlPtr, &t)
	for ; t > 0; t-- {
		scanf(*nlPtr, &n)
		incr := Incrementor()
		for q := 0; q < n-1; q++ {
			printf(*wsPtr, <-incr)
		}
		printf(*nlPtr, 1)
	}
}

func Incrementor() <-chan int {
	outCh := make(chan int)
	go func() {
		for i := 2; ; i++ {
			outCh <- i
		}
	}()
	return outCh
}

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

package main

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

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

	var buf bytes.Buffer

	tc := readNum(reader)

	for tc > 0 {
		tc--
		n := readNum(reader)
		res := solve(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) []int {
	// i % p[i] = 0
	res := make([]int, n)
	for i := 1; i < n; i++ {
		res[i-1] = i + 1
	}
	res[n-1] = 1

	return res
}

package main

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

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

func main() {
	defer out.Flush()
	var t, n int
	for fmt.Fscan(in, &t); t > 0; t-- {
		fmt.Fscan(in, &n)
		if n%2 == 1 {
			fmt.Fprintf(out, "1")
			for i := 2; i <= n; i += 2 {
				fmt.Fprintf(out, " %d %d", i+1, i)
			}
		} else {
			for i := 1; i <= n; i += 2 {
				fmt.Fprintf(out, "%d %d ", i+1, i)
			}
		}
		fmt.Fprintln(out)
	}
}

package main

import (
	"fmt"
)

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

	}
}

package main

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

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

func CF1711A(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 int64
		fmt.Fscan(r, &n)
		for i := int64(3); i<n; i++ {
			fmt.Fprint(w,  i+1, " ")
		}
		for i := int64(0); i<3; i++ {
			fmt.Fprint(w,  i+1, " ")
		}
		fmt.Fprintln(w )
	}
}

package main

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

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

func CF1711A(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 int64
		fmt.Fscan(r, &n)
		for i := int64(0); i<n; i++ {
			fmt.Fprint(w,  i+1, " ")
		}
		fmt.Fprintln(w)
	}
}

package main

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

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

func CF1711A(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 int64
		fmt.Fscan(r, &n)
		for i := int64(0); i<n; i++ {
			fmt.Fprint(w,  i+1, " ")
		}
		// fmt.Fprintln(w,  1)
	}
}

package main

import "fmt"

func main() {
	var (
		t int
		n int
	)
	fmt.Scan(&t)
	for t > 0 {
		t--
		fmt.Scan(&n)
		if n == 1 {
			fmt.Println(n)
			continue
		}
		for i := 0; i < n; i++ {
			if i % 2 == 0 {
				fmt.Printf("%d ", i + 2)
			} else {
				fmt.Printf("%d ", i)
			}
		}
		fmt.Println()
	}
}

package main

import "fmt"

func main() {
	var (
		t int
		n int
	)
	fmt.Scan(&t)
	for t > 0 {
		t--
		fmt.Scan(&n)
		for i := 0; i < n; i++ {
			if i % 2 == 0 {
				fmt.Printf("%d ", i + 2)
			} else {
				fmt.Printf("%d ", i)
			}
		}
		fmt.Println()
	}
}

package main

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

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

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

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

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

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

/**
Run solve the problem CF11711A
Date: 29/07/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1711/A
Problem: CF11711A
**/
func (in *CF11711A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		ans := strings.Builder{}
		for i := 0; i < n; i++ {
			ans.WriteString(fmt.Sprintf("%d ", n-i))
		}
		fmt.Println(ans.String())
	}
}

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

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

package main

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

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

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

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

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

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

/**
Run solve the problem CF11711A
Date: 29/07/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1711/A
Problem: CF11711A
**/
func (in *CF11711A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		ans := strings.Builder{}
		for i := 0; i < n; i++ {
			ans.WriteString(fmt.Sprintf("%d ", i+1))
		}
		fmt.Println(ans.String())
	}
}

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

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

package main

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

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

func solve() {
	var n int
	_, _ = fmt.Fscan(bufferedStdin, &n)
	_, _ = fmt.Fprintf(bufferedStdout, "%d ", n)
	for i := 2; i <= n; i++ {
		_, _ = fmt.Fprintf(bufferedStdout, "%d ", i)
	}
	_, _ = fmt.Fprintf(bufferedStdout, "\n")
}

func main() {
	var t = 1
	_, _ = fmt.Fscan(bufferedStdin, &t)
	for i := 0; i < t; i++ {
		solve()
	}
	_ = bufferedStdout.Flush()
}

package main

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

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

func solve() {
	var n int
	_, _ = fmt.Fscan(bufferedStdin, &n)
	_, _ = fmt.Fprintf(bufferedStdout, "%d ", n)
	for i := 2; i <= n; i++ {
		_, _ = fmt.Fprintf(bufferedStdout, "%d ", i)
	}
	_, _ = fmt.Fprintf(bufferedStdout, "\n")
}

func main() {
	var t = 1
	//_, _ = fmt.Fscan(bufferedStdin, &t)
	for i := 0; i < t; i++ {
		solve()
	}
	_ = bufferedStdout.Flush()
}

package main
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:=1;j<=n;j++{
			fmt.Fprintf(out,"%v ",j)
		}
		fmt.Fprintln(out,)
	}
}

package main

import "fmt"

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

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

	fmt.Println()
}

package main

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

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

	var tests int
	fmt.Fscan(reader, &tests)
	for t := 0; t < tests; t++ {
		var n int
		fmt.Fscan(reader, &n)
		if n == 1 {
			fmt.Println(1)
			continue
		}
		if n == 3 {
			fmt.Println("1 3 2")
			continue
		}
		if n % 2 == 0 {
			for i := n; i >= 1; i-- {
				fmt.Print(i, " ")
			}
		} else {
			var mid = n / 2 + 1
			fmt.Print(mid, " ")
			for i := n; i >= 1; i-- {
				if i != mid {
					fmt.Print(i, " ")
				}
			}
		}

		fmt.Println()
	}
}


package main

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

func main() {
	input := bufio.NewReader(os.Stdin)
	cases := readInt(input)
	for asdf := 0; asdf < cases; asdf++ {
		arr := readArrInt(input)
		n := arr[0]
		m := arr[1]
		fmt.Println(solve(n, m))
	}
}

func solve(n, m int) string {
	if (n+m)%2 == 0 {
		return "Tonya"
	} else {
		return "Burenka"
	}

}

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 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.Atoi(nStr)
	return int64(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"
	"os"
	"fmt"
)

const MOD int64 = 1000000007

var n, m int

var h[]int

// ByAge implements sort.Interface based on the Age field.
type ByV []*pair

func (a ByV) Len() int           { return len(a) }
func (a ByV) Less(i, j int) bool { return a[i].v < a[j].v }
func (a ByV) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {

	read := bufio.NewReader(os.Stdin)

	var t int
	fmt.Fscan(read, &t)

	for i := 0; i < t; i++ {

		fmt.Fscan(read, &n, &m)

		fmt.Println(solve())
	}
}

type pair struct {
	v int
	idx []int
}

func solve() string {
	if (n + m) % 2 == 1 {
		return "Burenka"
	}
	return "Tonya"
}

//IQ = 87

//........105....99...87..87..87..87.87.......87....

//            86

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

package main

import (
    "fmt"
    "sort"
)

/*
type IA []int
func (a IA) Len int { return len(a) }
func (a IA) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a IA) Less(i, j int) bool { return a[i]<a[j] }
*/

func sorti(a []int) {
    sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })
}

func main() {
    var tc int;
    fmt.Scanf("%d\n", &tc)
    var m, n int64
    // m, n := 0, 0
    // ia, ib := make([]byte, 1024), make([]byte, 1024)
    for ti:=0; ti<tc; ti++ {
        fmt.Scanf("%d %d\n", &n, &m)
        n = n&1
        m = m&1
        n ^= m;
        if n==0 {
            fmt.Println("Tonya")
        } else {
            fmt.Println("Burenka")
        }
        // fmt.Scanf("%s %s", &ia, &ib)
        // fmt.Println(len(ia), len(ib))
    }
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for ; t > 0; t-- {
		var n, m int
		fmt.Scanf("%d %d\n", &n, &m)
		sum := n + m
		if sum%2 == 0 {
			fmt.Println("Tonya")
		} else {
			fmt.Println("Burenka")
		}
	}
}

package main
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 r,c int
		fmt.Fscan(in,&r,&c)
		if (r%2 == 0 && c%2 == 0) || (r%2 != 0 && c%2 != 0) {
			fmt.Fprintln(out,"Tonya")
		} else {
			fmt.Fprintln(out,"Burenka")
		}
	}
}

package main

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

var in *bufio.Reader = bufio.NewReader(os.Stdin)

func main() {
	var t int
	fmt.Fscanf(in, "%d\n", &t)
	for t > 0 {
		var n, m int
		fmt.Fscanf(in, "%d %d\n", &n, &m)
		if (n+m)%2 == 1 {
			fmt.Println("Burenka")
		} else {
			fmt.Println("Tonya")
		}
		t--
	}
}

package main

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

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

func scan(a ...interface{}) {
	fmt.Fscan(in, a...)
}
func printf(f string, a ...interface{}) {
	fmt.Fprintf(out, f, a...)
}
func solve() {
	var n, m int
	scan(&n, &m)
	if (n+m)%2 == 0 {
		printf("Tonya\n")
	} else {
		printf("Burenka\n")
	}

}
func main() {
	defer out.Flush()
	n := 0
	scan(&n)
	for i := 0; i < n; i++ {
		solve()
	}
}

package main

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

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

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

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

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

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

/**
Run solve the problem CF1719A
Date: 8/19/2022
User: wotan
URL: https://codeforces.com/contest/1719/problem/A
Problem: CF1719A
**/
func (in *CF1719A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n, m := in.NextInt64(), in.NextInt64()
		if (n+m)%2 == 0 {
			fmt.Println("Tonya")
		} else {
			fmt.Println("Burenka")
		}
	}
}

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

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

package main

import (
	"fmt"
	"os"
)

func main() {
	in := os.Stdin
	var t int
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		var n, m int
		fmt.Fscan(in, &n)
		fmt.Fscan(in, &m)
		if (m%2 == 0 && n%2 == 0) || (m%2 == 1 && n%2 == 1) {
			fmt.Println("Tonya")
		} else {
			fmt.Println("Burenka")
		}
	}
}

package main

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

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

func solve(n, m int) string {
	var r int
	if (n-1)%2 == 1 {
		r++
	}
	if (m-1)%2 == 1 {
		r++
	}
	if r%2 == 0 {
		return "Tonya"
	}
	return "Burenka"
}

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

// 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, m int64
		fmt.Fscan(reader, &n, &m)
		total := n + m - 1
		if total%2 == 1 {
			fmt.Println("Tonya")
		} else {
			fmt.Println("Burenka")
		}

	}
}

package main

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

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)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt() int {
	impl.Scan()
	bb := impl.Bytes()
	i := 0
	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)
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

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

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

type writerImpl struct {
	*bufio.Writer
}

func NewWriter(writer io.Writer) Writer {
	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()
}

func main() {
	reader := NewWordScanner(os.Stdin)
	writer := NewWriter(os.Stdout)
	defer writer.Flush()
	t := reader.NextInt()
	for i := 0; i < t; i++ {
		n := reader.NextInt()
		m := reader.NextInt()
		if n == m {
			writer.Printf("Tonya\n")
		} else if (n%2 == 0 && m%2 == 0) || (n%2 != 0 && m%2 != 0) {
			writer.Printf("Tonya\n")
		} else {
			writer.Printf("Burenka\n")
		}
	}
}

package main

import "fmt"

func main() {
	var t, n, m int
	fmt.Scan(&t)
	for t > 0 {
		t--
		fmt.Scan(&n, &m)
		if (n+m)&1 == 0 {
			fmt.Println("Tonya")
		} else {
			fmt.Println("Burenka")
		}
	}
}

package main

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

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

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

	var T int
	var x int
	var y int

	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &x)
		Fscan(in, &y)

		ans := "Burenka"
		if (x + y ) % 2 == 0 {
			ans = "Tonya"
		}

		Fprintln(out, ans)
	}
}

package main

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

var (
	in   *bufio.Scanner
	out  *bufio.Writer
	once = false
)

func solve() {
	in.Scan()
	m, _ := strconv.Atoi(in.Text())
	in.Scan()
	n, _ := strconv.Atoi(in.Text())
	if m < n {
		n, m = m, n
	}
	if (m-n)%2 == 0 {
		out.WriteString("Tonya\n")
	} else {
		out.WriteString("Burenka\n")
	}
}

func main() {
	in = bufio.NewScanner(os.Stdin)
	in.Split(bufio.ScanWords)
	out = bufio.NewWriter(os.Stdout)
	defer out.Flush()

	if once {
		solve()
		return
	}
	in.Scan()
	x, _ := strconv.Atoi(in.Text())
	for t := 0; t < x; t++ {
		solve()
	}
}

package main

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

const N int = 1e5 + 7
const INF int = math.MaxInt

var a []int = make([]int, N)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t, n, m int64

	fmt.Fscan(in, &t)
	for ; t != 0; t-- {
		fmt.Fscan(in, &n, &m)
		ans := ((n % 2) + (m % 2)) % 2
		if ans == 0 {
			fmt.Fprintln(out, "Tonya")
		} else {
			fmt.Fprintln(out, "Burenka")
		}
	}
}

package main

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

var (
	reader bufio.Reader
	writer bufio.Writer
)

func main() {
	inp, err := os.Open("in.txt")
	if err == nil {
		os.Stdin = inp
		outp, _ := os.Create("out.txt")
		os.Stdout = outp
		defer outp.Close()
		defer inp.Close()
	}
	reader = *bufio.NewReader(os.Stdin)
	writer = *bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var T int
	scan(&T)

	for ; T > 0; T-- {
		var n, m int
		scan(&n, &m)

		if (n + m) % 2 == 0 {
			printf("Tonya\n")
		} else {
			printf("Burenka\n")
		}
	}
}

func scan(a ...interface{}) (n int, err error) {
	return fmt.Fscan(&reader, a...)
}

func printf(format string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(&writer, format, a...)
}

package main

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

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

	var t, n, m int
	fmt.Fscan(in, &t)
	for t > 0 {
		t--
		fmt.Fscan(in, &n, &m)
		if n < m {
			n, m = m, n
		}
		if (n - m) % 2 == 1 {
			fmt.Fprintln(out, "Burenka")
		} else {
			fmt.Fprintln(out, "Tonya")
		}

	}

}

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

package main

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

const MOD int64 = 1000000007

var n, m int

var h[]int

// ByAge implements sort.Interface based on the Age field.
type ByV []*pair

func (a ByV) Len() int           { return len(a) }
func (a ByV) Less(i, j int) bool { return a[i].v < a[j].v }
func (a ByV) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {

	read := bufio.NewReader(os.Stdin)

	var t int
	fmt.Fscan(read, &t)

	for i := 0; i < t; i++ {

		fmt.Fscan(read, &n, &m)

		fmt.Println(solve())
	}
}

type pair struct {
	v int
	idx []int
}

func solve() string {
	if (n + m) % 1 == 0 {
		return "Burenka"
	}
	return "Tonya"
}

//IQ = 87

//........105....99...87..87..87..87.87.......87....

//            86

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

package main

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

const MOD int64 = 1000000007

var n, m int

var h[]int

// ByAge implements sort.Interface based on the Age field.
type ByV []*pair

func (a ByV) Len() int           { return len(a) }
func (a ByV) Less(i, j int) bool { return a[i].v < a[j].v }
func (a ByV) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {

	read := bufio.NewReader(os.Stdin)

	var t int
	fmt.Fscan(read, &t)

	for i := 0; i < t; i++ {

		fmt.Fscan(read, &n, &m)

		fmt.Println(solve())
	}
}

type pair struct {
	v int
	idx []int
}

func solve() string {
	if n == 2 && m == 2 {
		return "Tonya"
	}
	if n % 2 == 0 && m % 2 == 0 {
		return "Burenka"
	}
	if (n % 2 == 0 && m % 2 == 1) || (n % 2 == 1 && m % 2 == 0) {
		return "Burenka"
	}
	return "Tonya"
}

//IQ = 87

//........105....99...87..87..87..87.87.......87....

//            86

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

package main

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

const MOD int64 = 1000000007

var n, m int

var h[]int

// ByAge implements sort.Interface based on the Age field.
type ByV []*pair

func (a ByV) Len() int           { return len(a) }
func (a ByV) Less(i, j int) bool { return a[i].v < a[j].v }
func (a ByV) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {

	read := bufio.NewReader(os.Stdin)

	var t int
	fmt.Fscan(read, &t)

	for i := 0; i < t; i++ {

		fmt.Fscan(read, &n, &m)

		fmt.Println(solve())
	}
}

type pair struct {
	v int
	idx []int
}

func solve() string {
	if n == 1 && m == 1 {
		return "Tonya"
	}
	if n % 2 == 0 && m % 2 == 0 {
		return "Tonya"
	}
	if (n % 2 == 0 && m % 2 == 1) || (n % 2 == 1 && m % 2 == 0) {
		return "Burenka"
	}
	return "Burenka"
}

//IQ = 87

//........105....99...87..87..87..87.87.......87....

//            86

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

package main

import (
    "fmt"
    "sort"
)

/*
type IA []int
func (a IA) Len int { return len(a) }
func (a IA) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a IA) Less(i, j int) bool { return a[i]<a[j] }
*/

func sorti(a []int) {
    sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })
}

func main() {
    var tc int;
    fmt.Scanf("%d\n", &tc)
    var m, n int64
    // m, n := 0, 0
    // ia, ib := make([]byte, 1024), make([]byte, 1024)
    for ti:=0; ti<tc; ti++ {
        fmt.Scanf("%d %d\n", &n, &m)
        n = n/2
        m = m/2
        n ^= m;
        if n==0 {
            fmt.Println("Tonya")
        } else {
            fmt.Println("Burenka")
        }
        // fmt.Scanf("%s %s", &ia, &ib)
        // fmt.Println(len(ia), len(ib))
    }
}

package main

import (
    "fmt"
    "sort"
)

/*
type IA []int
func (a IA) Len int { return len(a) }
func (a IA) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a IA) Less(i, j int) bool { return a[i]<a[j] }
*/

func sorti(a []int) {
    sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })
}

func main() {
    var tc int;
    fmt.Scanf("%d", &tc)
    var m, n int64
    // m, n := 0, 0
    // ia, ib := make([]byte, 1024), make([]byte, 1024)
    for ti:=0; ti<tc; ti++ {
        fmt.Scanf("%d %d", &n, &m)
        n = n/2
        m = m/2
        n ^= m;
        if n==0 {
            fmt.Println("Tonya")
        } else {
            fmt.Println("Burenka")
        }
        // fmt.Scanf("%s %s", &ia, &ib)
        // fmt.Println(len(ia), len(ib))
    }
}


package main
// github.com/jamesgrimard/codeforces
import(
    "fmt"
    "bufio"
    "os"
    "math"
)
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 x int
		fmt.Fscan(in,&x)
		if x < 3 {
			fmt.Fprintln(out,3)
		} else if x & 1 == 1 {
			fmt.Fprintln(out,1)
		} else if isIntegral(math.Log2(float64(x))) == true {
			fmt.Fprintln(out,x+1)
		} else {
			j:= 1
			for j <= x / 2 {
				j <<= 1
				if x & j > 0 {
					fmt.Fprintln(out,j)
					break
				}
			}
		}
	}
}
func isIntegral(x float64) bool {
	return float64(int(x)) == x
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)
var wrtr = bufio.NewWriterSize(os.Stdout, 10_000_000)
var rdr = bufio.NewScanner(os.Stdin)
func gs() string  { rdr.Scan(); return rdr.Text() }
func gi() int     { i,e := strconv.Atoi(gs()); if e != nil {panic(e)}; return i }
func gi2() (int,int) { return gi(),gi() }
func gi3() (int,int,int) { return gi(),gi(),gi() }
func gi4() (int,int,int,int) { return gi(),gi(),gi(),gi() }
func gis(n int) []int  { res := make([]int,n); for i:=0;i<n;i++ { res[i] = gi() }; return res }
func gf() float64 { f,e := strconv.ParseFloat(gs(),64); if e != nil {panic(e)}; return f }
func gbs() []byte { return []byte(gs()) }
func gfs(n int) []float64  { res := make([]float64,n); for i:=0;i<n;i++ { res[i] = gf() }; return res }
func gss(n int) []string  { res := make([]string,n); for i:=0;i<n;i++ { res[i] = gs() }; return res }
func ia(m int) []int { return make([]int,m) }
func iai(m int,v int) []int { a := make([]int,m); for i:=0;i<m;i++ { a[i] = v }; return a }
func twodi(n int,m int,v int) [][]int {
	r := make([][]int,n); for i:=0;i<n;i++ { x := make([]int,m); for j:=0;j<m;j++ { x[j] = v }; r[i] = x }; return r
}
func fill2(m int) ([]int,[]int) { a,b := ia(m),ia(m); for i:=0;i<m;i++ {a[i],b[i] = gi(),gi()}; return a,b }
func fill3(m int) ([]int,[]int,[]int) { a,b,c := ia(m),ia(m),ia(m); for i:=0;i<m;i++ {a[i],b[i],c[i] = gi(),gi(),gi()}; return a,b,c }
func fill4(m int) ([]int,[]int,[]int,[]int) { a,b,c,d := ia(m),ia(m),ia(m),ia(m); for i:=0;i<m;i++ {a[i],b[i],c[i],d[i] = gi(),gi(),gi(),gi()}; return a,b,c,d }
func abs(a int) int { if a < 0 { return -a }; return a }
func rev(a []int) { i,j := 0,len(a)-1; for i < j { a[i],a[j] = a[j],a[i]; i++; j-- } }
func max(a,b int) int { if a > b { return a }; return b }
func min(a,b int) int { if a > b { return b }; return a }
func tern(cond bool, a int, b int) int { if cond { return a }; return b }
func terns(cond bool, a string, b string) string { if cond { return a }; return b }
func maxarr(a []int) int { ans := a[0]; for _,aa := range(a) { if aa > ans { ans = aa } }; return ans }
func minarr(a []int) int { ans := a[0]; for _,aa := range(a) { if aa < ans { ans = aa } }; return ans }
func sumarr(a []int) int { ans := 0; for _,aa := range(a) { ans += aa }; return ans }
func zeroarr(a []int) { for i:=0; i<len(a); i++ { a[i] = 0 } }
func powmod(a,e,mod int) int { res, m := 1, a; for e > 0 { if e&1 != 0 { res = res * m % mod }; m = m * m % mod; e >>= 1 }; return res }
func powint(a,e int) int { res, m := 1, a; for e > 0 { if e&1 != 0 { res = res * m }; m = m * m; e >>= 1 }; return res }
func gcd(a,b int) int { for b != 0 { t:=b; b=a%b; a=t }; return a }
func gcdExtended(a,b int) (int,int,int) { if a == 0 { return b,0,1 }; gcd,x1,y1 := gcdExtended(b%a,a); return gcd, y1-(b/a)*x1,x1 }
func modinv(a,m int) (int,bool) { g,x,_ := gcdExtended(a,m); if g != 1 { return 0,false }; return (x % m + m) % m,true  }
func makefact(n int,mod int) ([]int,[]int) {
	fact,factinv := make([]int,n+1),make([]int,n+1)
	fact[0] = 1; for i:=1;i<=n;i++ { fact[i] = fact[i-1] * i % mod }
	factinv[n] = powmod(fact[n],mod-2,mod); for i:=n-1;i>=0;i-- { factinv[i] = factinv[i+1] * (i+1) % mod }
	return fact,factinv
}
func vecintstring(a []int) string { astr := make([]string,len(a)); for i,a := range a { astr[i] = strconv.Itoa(a) }; return strings.Join(astr," ") }
func main() {
	//f1, _ := os.Create("cpu.prof"); pprof.StartCPUProfile(f1); defer pprof.StopCPUProfile()
	defer wrtr.Flush()
	infn := ""; if infn == "" && len(os.Args) > 1 {	infn = os.Args[1] }
	if infn != "" {	f, e := os.Open(infn); if e != nil { panic(e) }; rdr = bufio.NewScanner(f) }
	rdr.Split(bufio.ScanWords); rdr.Buffer(make([]byte,1024),1_000_000_000)
	// PROGRAM STARTS HERE
	T := gi()
	for tt:=1;tt<=T;tt++ {
		X := gi(); ans := 0
		if X == 1 {
			ans = 3
		} else {
			ans = 1
			for X & ans == 0 { ans = ans << 1 }
			if X ^ ans == 0 { ans |= 1 }
		}
		fmt.Fprintln(wrtr,ans)
	}
}

// 给定x 求最小的y使得x和y按位与和按位异或得到结果均大于0
//https://codeforces.com/contest/1688/problem/A#
/**
0&0 0
0&1 0
1&0 0
1&1 1

0^0 0
0^1 1
1^0 1
1^1 0

按位与 得到1xxxxxx，找到x二进制最高位数，设置为1，后续位数根据异或判定
若异或结果非0 此时为最小y
若异或结果0，从最小位开始增加直到不为0结束
**/

package main

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

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

	var testCases int
	Fscan(in, &testCases)

	for c := 0; c < testCases; c++ {
		var x, y int
		Fscan(in, &x)

		for i := 0; i < 31; i++ {
			y = 1 << i
			if x&y > 0 {
				break
			}
		}

		if x^y == 0 {
			for i := 0; i < 31; i++ {
				num := y | (1 << i)
				if x^num > 0 {
					y = num
					break
				}
			}
		}

		Fprintln(out, y)
	}

}

package main

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

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

	var testCases int
	Fscan(in, &testCases)

	for c := 0; c < testCases; c++ {
		var n int
		Fscan(in, &n)

		Fprintln(out, solve(n))
	}

}

func solve(n int) int {
	first_one := -1
	second_one := -1
	for i := 0; n > 0; i++ {
		d := n % 2
		if d == 1 {
			if first_one == -1 {
				first_one = i
			} else if second_one == -1 {
				second_one = i
			}
		}

		n = n / 2
	}

	bits := make([]int, max(first_one, second_one)+5)

	bits[first_one] = 1

	if second_one == -1 {
		if first_one > 0 {
			bits[0] = 1
		} else {

			bits[first_one+1] = 1
		}
	}

	ans := 0
	p := 1
	for i := range bits {
		ans = ans + bits[i]*p
		p = p * 2
	}
	return ans
}

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

package main

import (
	"bufio"
	"fmt"
	"math/bits"
	"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 uint64
		fmt.Fscan(in, &n)

		if n&1 > 0 && n^1 > 0 {
			fmt.Fprintln(out, 1)
		} else if n == 1 {
			fmt.Fprintln(out, 3)
		} else {
			z := bits.TrailingZeros64(n)
			g := uint64(1 << z)
			if n&g > 0 && n^g > 0 {
				fmt.Fprintln(out, g)
			} else {
				fmt.Fprintln(out, g+1)
			}
		}
	}
}

package main

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

/*
0101
0001
0001
0100

1010
0010
0010
1001

0010
0011
0010
0001

*/

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

	y := 0

	for i := 0; i < 31; i++ {
		num := 1 << i
		if x&num > 0 {
			y = num
			break
		}
	}

	if x^y == 0 {
		for i := 0; i < 31; i++ {
			num := y | (1 << i)
			if x&num > 0 && x^num > 0 {
				y = num
				break
			}
		}
	}

	fmt.Fprintln(writer, y)
}

//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 min(nums ...int) int {
	return nums[minIdx(nums...)]
}

//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 max(nums ...int) int {
	return nums[maxIdx(nums...)]
}

//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 sum(nums ...int) (sum int) {
	for _, num := range nums {
		sum += num
	}
	return
}

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

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

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

	for i := int64(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))
}

//goland:noinspection GoUnusedFunction
func factorize(num int64) []int64 {
	factors := make([]int64, 0)

	for ftr := int64(2); ftr*ftr <= num; ftr++ {
		for num%ftr == 0 {
			num /= ftr
			factors = append(factors, ftr)
		}
	}

	if num > 1 {
		factors = append(factors, num)
	}

	return factors
}

package main

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

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

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

	var T int
	var x int

	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &x)

		ans := 0
		if x == 1 {
			ans = 3
		} else if x%2 == 0 {
			lb := x & -x
			ans = lb
			if lb == x {
				ans++
			}
		} else {
			ans = 1
		}

		Fprintln(out, ans)
	}
}

package main

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

var r = bufio.NewReader(os.Stdin)
var w = bufio.NewWriter(os.Stdout)

func slove() {
	var n int
	fmt.Fscan(r, &n)
	ans := 0
	i := 0
	cnt := 0
	for n != 0{
		if n % 2 == 1 {
			if ans == 0 {
				ans += (1<<i)
			}
			cnt++
		}
		n /= 2
		i++
	}
	if cnt == 1 {
		if ans == 1 {
			ans = 3
		} else {
			ans += 1
		}
	}
	fmt.Fprintln(w, ans)
}

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

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 int
		Fscan(in, &n)
		if n == 1 {
			Fprintln(out, 3)
			return
		}
		var pos, cnt int
		for i := 30; i >= 0; i-- {
			if n&(1<<i) != 0 {
				cnt++
				pos = i
			}
		}
		if cnt == 1 {
			Fprintln(out, n+1)
			return
		}
		Fprintln(out, 1<<pos)
	}
	// Coding...ove!
	for i := 0; i < cas; i++ {
		sol()
	}
}
func main() { A1() }

package main

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

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

func main() {
	defer out.Flush()

	var tc int
	for fmt.Fscan(in, &tc); tc > 0; tc-- {
		var x, y int
		fmt.Fscan(in, &x)
		if x == 1 {
			fmt.Fprintln(out, 3)
			continue
		}
		for y = 1; x&y == 0; y *= 2 {
		}
		if x == y {
			y++
		}
		fmt.Fprintln(out, y)
	}
}

package main
// github.com/jamesgrimard/codeforces
import(
    "fmt"
    "bufio"
    "os"
    "math"
)
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 x int
		fmt.Fscan(in,&x)
		if x == 1 {
			fmt.Fprintln(out,3)
		} else if x & 1 == 1 {
			fmt.Fprintln(out,1)
		} else if isIntegral(math.Log2(float64(x))) == true {
			fmt.Fprintln(out,x+1)
		} else {
			j:= 1
			for j <= x / 2 {
				j <<= 1
				if x & j > 0 {
					fmt.Fprintln(out,j)
					break
				}
			}
		}
	}
}
func isIntegral(x float64) bool {
	return float64(int(x)) == x
}

//

package main

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

func solve(in *bufio.Reader, out io.Writer) {
	var x uint
	fmt.Fscan(in, &x)
	tmp := x
	tot := 0
	for tmp != 0 {
		if (tmp & 1) != 0 {
			tot++
		}
		tmp >>= 1
	}
	ans := uint(0)
	for i := 0; i <= 30; i++ {
		var p uint
		p = uint(1 << uint(i))
		if (p&x) > 0 && tot > 1 {
			fmt.Fprintln(out, p)
			return
		}
		if (p&x) == 0 && ans == uint(0) {
			ans |= p
		}
		if (p & x) != 0 {
			tot -= 1
		}
	}
	for i := 0; i <= 30; i++ {
		var p uint
		p = uint(1 << uint(i))
		if (p & x) > 0 {
			ans |= p
			fmt.Fprintln(out, ans)

			return
		}
	}

}
func run(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	var kase int
	fmt.Fscan(in, &kase)
	for mmm := 1; mmm <= kase; mmm++ {
		solve(in, out)
	}
	fmt.Fprintln(out, os.Getenv("ONLINE_JUDGE"))
}

func main() {

	file, err := os.Open("C:\\Users\\tiany\\GolandProjects\\awesomeProject\\data.txt")
	if err != nil {
		file = os.Stdin
	}
	run(file, os.Stdout)

}

package main

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

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

func scan(a ...interface{}) {
	fmt.Fscan(in, a...)
}
func printf(f string, a ...interface{}) {
	fmt.Fprintf(out, f, a...)
}

func solve() {
	var x int
	scan(&x)
	y := 1
	if x%2 == 1 {
		if x == 1 {
			y = 3
		} else {
			y = 1
		}
	} else {
		one := 0
		for i := 0; (1 << i) <= x; i++ {
			b := (x >> i) & 1
			if b == 1 {
				if one == 0 {
					y = 1 << i
				}
				one++
			}
		}
		if one == 1 {
			y += 1
		}
	}
	printf("%d\n", y)
}
func main() {
	defer out.Flush()
	n := 0
	scan(&n)
	for i := 0; i < n; i++ {
		solve()
	}
}

package main

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

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

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

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

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

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

/**
Run solve the problem CF1688A
Date: 14/06/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1688/A
Problem: CF1688A
**/
func (in *CF1688A) Run() {
	var str strings.Builder
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		ans := 0

		count := 0
		for i:=0;i<31;i++{
			if n&(1<<i) != 0 {
				count++
			}
		}

		and := false
		xor := count > 1

		for i := 0; i <= 30; i++ {
			if n&(1<<i) != 0 {
				if !and {
					ans = ans | (1 << i)
					and = true
				}
			}else {
				if !xor {
					ans = ans | (1 << i)
					xor = true
				}
			}

			if xor && and {
				break
			}
		}
		str.WriteString(fmt.Sprintf("%d\n", ans))
	}
	fmt.Print(str.String())
}

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

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

package main

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

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

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

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

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

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

/**
Run solve the problem CF1688A
Date: 14/06/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1688/A
Problem: CF1688A
**/
func (in *CF1688A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		ans := 0

		count := 0
		for i:=0;i<31;i++{
			if n&(1<<i) != 0 {
				count++
			}
		}

		and := false
		xor := count > 1

		for i := 0; i <= 30; i++ {
			if n&(1<<i) != 0 {
				if !and {
					ans = ans | (1 << i)
					and = true
				}
			}else {
				if !xor {
					ans = ans | (1 << i)
					xor = true
				}
			}

			if xor && and {
				break
			}
		}
		fmt.Println(ans)
	}
}

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

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

package main

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

func main() {
	scanner := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	var ntests int
	fmt.Fscan(scanner, &ntests)
	for iter := 0; iter < ntests; iter++ {
		var x, y int64
		fmt.Fscan(scanner, &x)
		for y = 1; x&y == 0; y = y << 1 {
		}
		for x&y == 0 || x^y == 0 {
			y++
		}
		fmt.Fprintln(writer, y)
	}
}

package main
// github.com/jamesgrimard/codeforces
import(
    "fmt"
    "bufio"
    "os"
    "math"
)
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 x int
		fmt.Fscan(in,&x)
		if x & 1 == 1 {
			fmt.Fprintln(out,1)
		} else if isIntegral(math.Log2(float64(x))) == true {
			fmt.Fprintln(out,x+1)
		} else {
			j:= 1
			for j <= x / 2 {
				j <<= 1
				if x & j > 0 {
					fmt.Fprintln(out,j)
					break
				}
			}
		}
	}
}
func isIntegral(x float64) bool {
	return float64(int(x)) == x
}

//

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 x int
		fmt.Fscan(in,&x)
		for j:=1;j<=1000000;j++{
			if x & j > 0 && x ^ j > 0 {
				fmt.Fprintln(out,j)
				break
			}
		}
	}
}

package main

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

func run(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	var kase int
	fmt.Fscan(in, &kase)
	for mmm := 1; mmm <= kase; mmm++ {

		var x int64
		fmt.Fscan(in, &x)
		tmp := x
		tot := 0
		for tmp != 0 {
			tot++
			tmp >>= 1
		}
		var ans uint
		ans = 0
		for i := 0; i <= 30; i++ {
			p := uint(1 << uint(i))
			if (uint(x) & p) == 0 {
				ans = (uint(x) | p)
				break
			}
		}
		fmt.Fprintln(out, ans)

	}
	fmt.Fprintln(out, os.Getenv("ONLINE_JUDGE"))
}

func main() {

	file, _ := os.Open("C:\\Users\\tiany\\GolandProjects\\awesomeProject\\data.txt")
	run(file, os.Stdout)

}

package main

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

func run(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	var kase int
	fmt.Fscan(in, &kase)
	for mmm := 1; mmm <= kase; mmm++ {

		var x int64
		fmt.Fscan(in, &x)
		tmp := x
		tot := 0
		for tmp != 0 {
			tot++
			tmp >>= 1
		}
		var ans uint
		ans = 0
		for i := 0; i <= 30; i++ {
			p := uint(1 << uint(i))
			if (uint(x) & p) == 0 {
				ans = (uint(x) | p)
				break
			}
		}
		fmt.Fprintln(out, ans)
	}
}

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

package main

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

func run(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	var kase int
	fmt.Scan(in, &kase)
	for mmm := 1; mmm <= kase; mmm++ {

		var x int64
		fmt.Fscan(in, &x)
		tmp := x
		tot := 0
		for tmp != 0 {
			tot++
			tmp >>= 1
		}
		var ans uint
		ans = 0
		for i := 0; i <= 30; i++ {
			p := uint(1 << uint(i))
			if (uint(x) & p) == 0 {
				ans = (uint(x) | p)
				break
			}
		}
		fmt.Fprintln(out, ans)
	}
}

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


package main

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

const MAX_N int = 4e5+10
const INF int = 0x3f3f3f3f

type Node struct {
	first int
	second int
}

type DifferArray struct {
	array [MAX_N]int
	num [MAX_N]int
}
func (this *DifferArray) add(left int, right int, num int) {
	if left > right {
		return
	}
	this.array[left] += num
	this.array[right+1] -= num
}
func (this *DifferArray) init(n int) {
	for i:=0; i<=n; i++ {
		this.array[i] = 0
	}
}
func (this *DifferArray) cal(n int) {
	this.num[0] = this.array[0]
	for i:=1; i<=n; i++ {
		this.num[i] = this.num[i-1]+this.array[i]
	}
}

func swap(a *int, b *int) {
	var c int = *a
	*a = *b
	*b = c
}

var read *bufio.Reader = bufio.NewReader(os.Stdin)
var write *bufio.Writer = bufio.NewWriter(os.Stdout)
var node [MAX_N]Node
var diff DifferArray

func main() {
	defer write.Flush()
	var t int
	fmt.Fscan(read, &t)
	for ; t>0; t-- {
		var n, k int
		fmt.Fscan(read, &n, &k)
		diff.init(k*2)
		for i:=0; i<n/2; i++ {
			fmt.Fscan(read, &node[i].first)
		}
		for i:=n/2-1; i>=0; i-- {
			fmt.Fscan(read, &node[i].second)
			if node[i].first>node[i].second {
				swap(&node[i].first, &node[i].second)
			}
		}
		for i:=0; i<n/2; i++ {
			var left int = 1+node[i].first
			var right int = k+node[i].second
			var mid int = node[i].first+node[i].second
			diff.add(2, left-1, 2)
			diff.add(left, mid-1, 1)
			diff.add(mid+1, right, 1)
			diff.add(right+1, k*2, 2)
		}
		diff.cal(k*2)
		var ans int = INF
		for i:=2; i<=k*2; i++ {
			if ans>diff.num[i] {
				ans = diff.num[i]
			}
		}
		fmt.Fprintln(write, ans)
		//write.Flush()
	}
}

package main

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

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 main() {
	reader := bufio.NewReader(os.Stdin)

	tc := readNum(reader)

	for tc > 0 {
		tc--
		N, K := readTwoNums(reader)

		A := readNNums(reader, N)

		fmt.Println(solve(N, K, A))
	}
}

func solve(N int, K int, A []int) int {
	// double with 2, to avoid divide 2 get non-integer points
	// K *= 2

	h := N >> 1
	// var R int

	// ps := make([]Pair, h)
	cnt := make([]int, 2*K+1)

	for i := 0; i < h; i++ {
		cnt[A[i]+A[N-1-i]]++
	}

	pref := make([]int, 2*K+2)

	for i := 0; i < h; i++ {
		a, b := A[i], A[N-1-i]
		if a > b {
			a, b = b, a
		}
		// a < b
		pref[a+1]++
		pref[b+K+1]--
	}

	for i := 1; i < len(pref); i++ {
		pref[i] += pref[i-1]
	}

	best := N

	for sum := 2; sum <= 2*K; sum++ {
		temp := pref[sum] - cnt[sum] + (h-pref[sum])*2
		if temp < best {
			best = temp
		}
	}

	return best
}

// https://acm.timus.ru/problem.aspx?space=1&num=1741
package main

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

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

func main () {
	var (
		T, n, K int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input := bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		fmt.Fscan(input, &n, &K)
		a := make([]int, n)
		for k := 0; k < n; k++ {
			fmt.Fscan(input, &a[k])
		}

		m := n / 2
		pref := make([]int, 2*K + 2)
		for k := 0; k < m; k++ {
			l := min(a[k], a[n - 1 - k]) + 1
			r := max(a[k], a[n - 1 - k]) + K
			pref[l]++
			pref[r + 1]--
		}

		for k := 1; k < len(pref); k++ {
			pref[k] = pref[k] + pref[k - 1]
		}

		x := make(map[int]int)
		for k := 0; k < m; k++ {
			x[a[k] + a[n - 1 - k]]++
		}

		ans := int(1e9)
		for k := 2; k <= 2*K; k++ {
			ans = min(ans, n - pref[k] - x[k])
		}

		fmt.Println(ans)
	}
}

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
}

/*
URL:
https://codeforces.com/problemset/problem/1343/D
*/

package main

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

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

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

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

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	t    int
	n, k int
	A    []int
)

func main() {
	t = ReadInt()
	for i := 0; i < t; i++ {
		n, k = ReadInt2()
		A = ReadIntSlice(n)

		solve()
	}
	stdout.Flush()
}

func solve() {
	ans := INF_BIT30

	cnts := make([]int, 2*k+100)
	prefs := make([]int, 2*k+100)

	for i := 0; i < n/2; i++ {
		l, r := A[i], A[n-1-i]

		cnts[l+r]++
		prefs[Min(l, r)+1]++
		prefs[Max(l, r)+k+1]--
	}
	for i := 1; i <= 2*k+10; i++ {
		prefs[i] += prefs[i-1]
	}

	for x := 2; x <= 2*k; x++ {
		tmp := prefs[x] - cnts[x] + (n/2-prefs[x])*2
		ChMin(&ans, tmp)
	}

	PrintfBufStdout("%d\n", ans)
}

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

// Min returns the min integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Min(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m > integer {
			m = integer
		}
	}
	return m
}

// func solve() {
// 	ans := INF_BIT30

// 	for x := 2; x <= 2*k; x++ {
// 		tmp := BinarySearch(n, -1, func(mid int) bool {
// 			cnt := 0
// 			for i := 0; i < n/2; i++ {
// 				l, r := A[i], A[n-1-i]
// 				s := l + r

// 				if s == x {
// 					continue
// 				}

// 				if (x-r >= 1 && x-r <= k) || (x-l >= 1 && x-l <= k) {
// 					cnt++
// 				} else {
// 					cnt += 2
// 				}

// 				if cnt > mid {
// 					return false
// 				}
// 			}

// 			return cnt <= mid
// 		})

// 		ChMin(&ans, tmp)
// 	}

// 	PrintfBufStdout("%d\n", ans)
// }

func BinarySearch(initOK, initNG int, isOK func(mid int) bool) (ok int) {
	ng := initNG
	ok = initOK
	for int(math.Abs(float64(ok-ng))) > 1 {
		mid := (ok + ng) / 2
		if isOK(mid) {
			ok = mid
		} else {
			ng = mid
		}
	}

	return ok
}

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

/*******************************************************************/

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

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

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

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

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

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

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

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

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

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

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

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

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

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

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

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

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

	return string(res)
}

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

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

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

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

package main

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

func main() {
	var i int32
	inBuf := bufio.NewReader(os.Stdin)
	fmt.Fscanf(inBuf, "%d\n", &i)
	for ; i > 0; i-- {
		var n int32
		var k int32
		fmt.Fscanf(inBuf, "%d %d\n", &n, &k)
		var ans int32 = n
		numbers := make([]int32, n)
		format := "%d"
		for t := int32(0); t < n; t++ {
			fmt.Fscanf(inBuf, format, &numbers[t])
			format = " %d"
		}

		fmt.Fscanf(inBuf, "\n", nil)
		res := make([]int32, k*2+2)
		for t := int32(0); t < n/2; t++ {
			sum := numbers[t] + numbers[n-t-1]
			low := sum
			if numbers[t] < numbers[n-t-1] {
				low = sum - (numbers[n-t-1] - 1)
			} else {
				low = sum - (numbers[t] - 1)
			}
			high := sum
			if numbers[t] < numbers[n-t-1] {
				high = sum + (k - numbers[t])
			} else {
				high = sum + (k - numbers[n-t-1])
			}
			res[0] += 2
			res[low] += -1
			res[high+1] += 1
			res[sum] += -1
			res[sum+1] += 1
		}
		for t := int32(1); t <= k*2+1; t++ {
			res[t] += res[t-1]
			if ans > res[t] {
				ans = res[t]
			}
		}
		fmt.Println(ans)
	}
}

package main

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

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

	var t, n, k int
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &n, &k)
		a := make([]int, n)
		for i := range a {
			Fscan(in, &a[i])
		}
		ps := make([]int, 2*k+2)
		for i, v := range a[:n/2] {
			w := a[n-1-i]
			if v > w {
				v, w = w, v
			}
			ps[v+1]--
			ps[v+w]--
			ps[v+w+1]++
			ps[w+k+1]++
		}
		ans := n
		c := n
		for _, d := range ps {
			c += d
			if c < ans {
				ans = c
			}
		}
		Fprintln(out, ans)
	}
}

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

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1343D(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	type pair struct{ v, delta int }

	var t, n, k int
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &n, &k)
		a := make([]int, n)
		for i := range a {
			Fscan(in, &a[i])
		}
		ps := make([]pair, 0, 2*n)
		for i, v := range a[:n/2] {
			w := a[n-1-i]
			if v > w {
				v, w = w, v
			}
			ps = append(ps, pair{v+1, -1}, pair{v + w, -1}, pair{v + w + 1, 1}, pair{w + k + 1, 1})
		}
		sort.Slice(ps, func(i, j int) bool { return ps[i].v < ps[j].v })
		ans := n
		c := n
		for i := 0; i < 2*n; {
			c += ps[i].delta
			for i++; i < 2*n && ps[i].v == ps[i-1].v; i++ {
				c += ps[i].delta
			}
			if c < ans {
				ans = c
			}
		}
		Fprintln(out, ans)
	}
}

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

// Author: sighduck
// URL: https://codeforces.com/problemset/problem/1343/D

package main

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

type Pair struct {
	L int
	R int
}

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

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func Solve(n int, k int, a []int) int {
	pairs := make([]Pair, n/2)
	sums := make(map[int]int)
	for i := 0; i < n/2; i++ {
		x := a[i]
		y := a[n-i-1]
		pairs[i] = Pair{min(x, y) + 1, max(x, y) + k}
		sums[x+y] += 1
	}
	prefix := make([]int, 2*k+2)
	for _, p := range pairs {
		prefix[p.L] += 1
		prefix[p.R+1] -= 1
	}
	for i := 1; i < 2*k+1; i++ {
		prefix[i] += prefix[i-1]
	}
	ans := math.MaxInt32
	for i := 2; i <= 2*k; i++ {
		ans = min(ans, prefix[i]-sums[i]+2*(n/2-prefix[i]))
	}
	return ans
}

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

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

package main

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

const MAX_N int = 4e5+10
const INF int = 0x3f3f3f3f

type Node struct {
	first int
	second int
}

type DifferArray struct {
	array [MAX_N]int
	num [MAX_N]int
}
func (this *DifferArray) add(left int, right int, num int) {
	if left > right {
		return
	}
	this.array[left] += num
	this.array[right+1] -= num
}
func (this *DifferArray) init(n int) {
	for i:=0; i<=n; i++ {
		this.array[i] = 0
	}
}
func (this *DifferArray) cal(n int) {
	this.num[0] = this.array[0]
	for i:=1; i<=n; i++ {
		this.num[i] = this.num[i-1]+this.array[i]
	}
}

func swap(a *int, b *int) {
	var c int = *a
	*a = *b
	*b = c
}

var read *bufio.Reader = bufio.NewReader(os.Stdin)
var write *bufio.Writer = bufio.NewWriter(os.Stdout)
var node [MAX_N]Node
var diff DifferArray

func main() {
	defer write.Flush()
	var t int
	fmt.Fscan(read, &t)
	for ; t>0; t-- {
		var n, k int
		fmt.Fscan(read, &n, &k)
		diff.init(k*2)
		for i:=0; i<n/2; i++ {
			fmt.Fscan(read, &node[i].first)
		}
		for i:=n/2-1; i>=0; i-- {
			fmt.Fscan(read, &node[i].second)
			if node[i].first<node[i].second {
				swap(&node[i].first, &node[i].second)
			}
		}
		for i:=0; i<n/2; i++ {
			var left int = 1+node[i].first
			var right int = k+node[i].second
			var mid int = node[i].first+node[i].second
			diff.add(2, left-1, 2)
			diff.add(left, mid-1, 1)
			diff.add(mid+1, right, 1)
			diff.add(right+1, k*2, 2)
		}
		diff.cal(k*2)
		var ans int = INF
		for i:=2; i<=k*2; i++ {
			if ans>diff.num[i] {
				ans = diff.num[i]
			}
		}
		fmt.Fprintln(write, ans)
		//write.Flush()
	}
}

package main

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

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 main() {
	reader := bufio.NewReader(os.Stdin)

	tc := readNum(reader)

	for tc > 0 {
		tc--
		N, K := readTwoNums(reader)

		A := readNNums(reader, N)

		fmt.Println(solve(N, K, A))
	}
}

func solve(N int, K int, A []int) int {
	// double with 2, to avoid divide 2 get non-integer points
	// K *= 2
	mem := make(map[int]int)
	y := NewBit(yy, MAX_K)
	h := N >> 1
	// var R int

	// ps := make([]Pair, h)

	for i := 0; i < h; i++ {
		a, b := A[i], A[N-1-i]
		if a > b {
			a, b = b, a
		}
		y.Set(b, 1)
		// ps[i] = Pair{a, b}
		mem[a+b]++
	}

	// sort.Sort(Pairs(ps))

	// D := ps[0].x + ps[0].y

	var best = N

	for d := 2 * K; d > 0; d-- {
		// cnt0 is the points at x + y == d
		var cnt0 int = mem[d]

		cnt := h - cnt0

		if d > K {
			// d - y > k
			// y < d - k
			// x0 + y0 < d
			// inorder to get x + y0 == d, the better way is to make x = d - y
			// but if y0 < d / 2, it will make x > d / 2 => x > K,
			// so we cant just replace one, instead, we need to replace two
			// because x <= y for all points
			cnt2 := y.Get(d - K - 1)
			cnt = 2*cnt2 + (h - cnt2 - cnt0)
		} else {
			// we can't replace any elements as 0,
			// x + y = d, if y >= d, then we have to make x = 0
			cnt2 := h - y.Get(d-1)
			cnt = 2*cnt2 + (h - cnt2 - cnt0)
		}

		if cnt < best {
			best = cnt
		}
	}

	return best
}

type Pair struct {
	x int
	y int
}

type Pairs []Pair

func (ps Pairs) Len() int {
	return len(ps)
}

func (ps Pairs) Less(i, j int) bool {
	return ps[i].x+ps[i].y > ps[j].x+ps[j].y
}

func (ps Pairs) Swap(i, j int) {
	ps[i], ps[j] = ps[j], ps[i]
}

const MAX_K = 200000

// var xx []int
var yy []int

func init() {
	// xx = make([]int, MAX_K+1)
	yy = make([]int, MAX_K+1)
}

type Bit struct {
	arr []int
	n   int
}

func NewBit(arr []int, n int) Bit {

	for i := 0; i <= n; i++ {
		arr[i] = 0
	}

	return Bit{arr[:n+1], n}
}

func (bit *Bit) Set(pos int, v int) {
	pos++
	for pos <= bit.n {
		bit.arr[pos] += v
		pos += pos & -pos
	}
}

func (bit Bit) Get(pos int) int {
	pos++
	var res int
	for pos > 0 {
		res += bit.arr[pos]
		pos -= pos & -pos
	}
	return res
}

package main

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

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 main() {
	reader := bufio.NewReader(os.Stdin)

	tc := readNum(reader)

	for tc > 0 {
		tc--
		N, K := readTwoNums(reader)

		A := readNNums(reader, N)

		fmt.Println(solve(N, K, A))
	}
}

func solve(N int, K int, A []int) int {
	// double with 2, to avoid divide 2 get non-integer points
	// K *= 2
	mem := make(map[int]int)
	y := NewBit(yy, MAX_K)
	h := N >> 1
	// var R int

	// ps := make([]Pair, h)

	for i := 0; i < h; i++ {
		a, b := A[i], A[N-1-i]
		if a > b {
			a, b = b, a
		}
		y.Set(b, 1)
		// ps[i] = Pair{a, b}
		mem[a+b]++
	}

	// sort.Sort(Pairs(ps))

	// D := ps[0].x + ps[0].y

	var best = N

	for d := 2 * K; d > 0; d-- {
		// cnt0 is the points at x + y == d
		var cnt0 int = mem[d]

		y.Set(d, -cnt0)

		// if y >= d, x + y == d, then x <= 0, which should be avoided
		// and d - K - 1 < d - 1 < d
		var cnt2 int = h - y.Get(d-1)

		y.Set(d, cnt0)

		if d > K {
			// d - y > k
			// y < d - k
			// x0 + y0 < d
			// inorder to get x + y0 == d, the better way is to make x = d - y
			// but if y0 < d - k, it will make x = d - y0 > k
			// so we cant just replace one, instead, we need to replace two
			// because x <= y for all points
			cnt2 += y.Get(d - K - 1)
		}

		cnt := 2*cnt2 + (h - cnt2 - cnt0)

		if cnt < best {
			best = cnt
		}
	}

	return best
}

type Pair struct {
	x int
	y int
}

type Pairs []Pair

func (ps Pairs) Len() int {
	return len(ps)
}

func (ps Pairs) Less(i, j int) bool {
	return ps[i].x+ps[i].y > ps[j].x+ps[j].y
}

func (ps Pairs) Swap(i, j int) {
	ps[i], ps[j] = ps[j], ps[i]
}

const MAX_K = 200000

// var xx []int
var yy []int

func init() {
	// xx = make([]int, MAX_K+1)
	yy = make([]int, MAX_K+1)
}

type Bit struct {
	arr []int
	n   int
}

func NewBit(arr []int, n int) Bit {

	for i := 0; i <= n; i++ {
		arr[i] = 0
	}

	return Bit{arr[:n+1], n}
}

func (bit *Bit) Set(pos int, v int) {
	pos++
	for pos <= bit.n {
		bit.arr[pos] += v
		pos += pos & -pos
	}
}

func (bit Bit) Get(pos int) int {
	pos++
	var res int
	for pos > 0 {
		res += bit.arr[pos]
		pos -= pos & -pos
	}
	return res
}

package main

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

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 main() {
	reader := bufio.NewReader(os.Stdin)

	tc := readNum(reader)

	for tc > 0 {
		tc--
		N, K := readTwoNums(reader)

		A := readNNums(reader, N)

		fmt.Println(solve(N, K, A))
	}
}

func solve(N int, K int, A []int) int {
	// double with 2, to avoid divide 2 get non-integer points
	// K *= 2
	mem := make(map[int]int)
	y := NewBit(yy, MAX_K)
	h := N >> 1
	// var R int

	// ps := make([]Pair, h)

	for i := 0; i < h; i++ {
		a, b := A[i], A[N-1-i]
		if a > b {
			a, b = b, a
		}
		y.Set(b, 1)
		// ps[i] = Pair{a, b}
		mem[a+b]++
	}

	// sort.Sort(Pairs(ps))

	// D := ps[0].x + ps[0].y

	var best = N

	for d := 2 * K; d > 0; d-- {
		// cnt0 is the points at x + y == d
		var cnt0 int = mem[d]

		// if y >= d, x + y == d, then x <= 0, which should be avoided
		// and d - K - 1 < d - 1
		var cnt2 int = h - y.Get(d-1)

		if d > K {
			// d - y > k
			// y < d - k
			// x0 + y0 < d
			// inorder to get x + y0 == d, the better way is to make x = d - y
			// but if y0 < d / 2, it will make x > d / 2 => x > K,
			// so we cant just replace one, instead, we need to replace two
			// because x <= y for all points
			cnt2 += y.Get(d - K - 1)
		}

		cnt := 2*cnt2 + (h - cnt2 - cnt0)

		if cnt < best {
			best = cnt
		}
	}

	return best
}

type Pair struct {
	x int
	y int
}

type Pairs []Pair

func (ps Pairs) Len() int {
	return len(ps)
}

func (ps Pairs) Less(i, j int) bool {
	return ps[i].x+ps[i].y > ps[j].x+ps[j].y
}

func (ps Pairs) Swap(i, j int) {
	ps[i], ps[j] = ps[j], ps[i]
}

const MAX_K = 200000

// var xx []int
var yy []int

func init() {
	// xx = make([]int, MAX_K+1)
	yy = make([]int, MAX_K+1)
}

type Bit struct {
	arr []int
	n   int
}

func NewBit(arr []int, n int) Bit {

	for i := 0; i <= n; i++ {
		arr[i] = 0
	}

	return Bit{arr[:n+1], n}
}

func (bit *Bit) Set(pos int, v int) {
	pos++
	for pos <= bit.n {
		bit.arr[pos] += v
		pos += pos & -pos
	}
}

func (bit Bit) Get(pos int) int {
	pos++
	var res int
	for pos > 0 {
		res += bit.arr[pos]
		pos -= pos & -pos
	}
	return res
}

// https://acm.timus.ru/problem.aspx?space=1&num=1741
package main

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

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

func main () {
	var (
		T, n, kk int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input := bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		fmt.Fscan(input, &n, &kk)
		pp := 0
		a := make([]int, n)
		for k := 0; k < n; k++ {
			fmt.Fscan(input, &a[k])
		}

		m := n / 2
		x := make(map[int]int)

		for k := 0; k < m; k++ {
			if a[k] < kk && a[n - 1 - k] < kk {
				pp ++
			}
			x[a[k] + a[n - 1 - k]]++
		}

		maxV := 0
		for _, v := range x {
			maxV = max(v, maxV)
		}

		fmt.Println(m - maxV + pp)
	}
}

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

// https://acm.timus.ru/problem.aspx?space=1&num=1741
package main

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

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

func main () {
	var (
		T, n, K int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input := bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		fmt.Fscan(input, &n, &K)
		a := make([]int, n)
		for k := 0; k < n; k++ {
			fmt.Fscan(input, &a[k])
		}

		m := n / 2
		pref := make([]int, 2*K + 2)
		for k := 0; k < m; k++ {
			l := min(a[k], a[n - 1 - k]) + 1
			r := max(a[k], a[n - 1 - k]) + K
			pref[l]++
			pref[r + 1]--
		}

		for k := 1; k < len(pref); k++ {
			pref[k] = pref[k] + pref[k - 1]
		}

		x := make(map[int]int)
		for k := 0; k < m; k++ {
			x[a[k] + a[n - 1 - k]]++
		}

		ans := int(1e9)
		for k := 0; k < 2*K; k++ {
			ans = min(ans, n - pref[k] - x[k])
		}

		fmt.Println(ans)
	}
}

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
}

package main

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

func main() {
	var i int32
	inBuf := bufio.NewReader(os.Stdin)
	fmt.Fscanf(inBuf, "%d\n", &i)
	for ; i > 0; i-- {
		var n int32
		var k int32
		fmt.Fscanf(inBuf, "%d %d\n", &n, &k)
		var ans int32 = n
		numbers := make([]int32, n)
		format := "%d"
		for t := int32(0); t < n; t++ {
			fmt.Fscanf(inBuf, format, &numbers[t])
			format = " %d"
		}

		fmt.Fscanf(inBuf, "\n", nil)
		res := make([]int32, k*2+2)
		for t := int32(0); t < n/2; t++ {
			sum := numbers[t] + numbers[n-t-1]
			low := sum
			if numbers[t] < numbers[n-t-1] {
				low = sum - (numbers[n-t-1] - 1)
			} else {
				low = sum - (numbers[t] - 1)
			}
			high := sum
			if numbers[t] < numbers[n-t-1] {
				high = sum + (k - numbers[t])
			} else {
				high = sum + (k - numbers[n-t-1])
			}
			res[0] += 2
			res[low-1] += -1
			res[high+1] += 1
			res[sum] += -1
			res[sum+1] += 1
		}
		for t := int32(1); t <= k*2+1; t++ {
			res[t] += res[t-1]
			if ans > res[t] {
				ans = res[t]
			}
		}
		fmt.Println(ans)
	}
}

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1343D(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	type pair struct{ v, delta int }

	var t, n, k int
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &n, &k)
		a := make([]int, n)
		for i := range a {
			Fscan(in, &a[i])
		}
		ps := make([]pair, 0, 2*n)
		for i, v := range a[:n/2] {
			w := a[n-1-i]
			if v > w {
				v, w = w, v
			}
			ps = append(ps, pair{v, -1}, pair{v + w, -1}, pair{v + w + 1, 1}, pair{w + k + 1, 1})
		}
		sort.Slice(ps, func(i, j int) bool { return ps[i].v < ps[j].v })
		ans := n
		c := n
		for i := 0; i < 2*n; {
			c += ps[i].delta
			for i++; i < 2*n && ps[i].v == ps[i-1].v; i++ {
				c += ps[i].delta
			}
			if c < ans {
				ans = c
			}
		}
		Fprintln(out, ans)
	}
}

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