package main

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

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

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

	n := nextInt()
	a1, a2, atemp := make([]int, n), make([]int, n), make([]int, n)
	pos1, pos2 := 0, 0

	for i := 0; i < n; i++ {
		a1[i] = nextInt()
	}

	copy(atemp, a1)

	for i := 0; i < n; i++ {
		pos := 0

		for j := 0; j < n; j++ {
			if a1[j] != 0 {
				pos = j
				break
			}
		}

		for j := pos; j < n; j++ {
			if a1[j] != 0 && a1[j] < a1[pos] {
				pos = j
			}
		}

		a2[i] = pos
		a1[pos] = 0
	}

	i := 0
	a1 = atemp

	for ; i < n - 1; i++ {
		if a1[a2[i]] == a1[a2[i + 1]] {
			pos1 = i
			i++
			break
		}
	}

	for ; i < n - 1; i++ {
		if a1[a2[i]] == a1[a2[i + 1]] {
			pos2 = i
			break
		}
	}

	if pos2 == 0 {
		 println("NO")
	} else {
		println("YES")
		printSlice(a2)
		a2[pos1], a2[pos1 + 1] = a2[pos1 + 1], a2[pos1]
		printSlice(a2)
		a2[pos2], a2[pos2 + 1] = a2[pos2 + 1], a2[pos2]
		printSlice(a2)
	}

	// println(a2, a1, pos1, pos2)
}

func printSlice(a []int) {
	for i := 0; i < len(a); i++ {
		print(a[i] + 1, " ")
	}
	print("\n")
}

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

func nextInt() int {
	n, err := strconv.Atoi(next())
	if err != nil {
		panic(err)
	}
	return n
}

func nextFloat() float64 {
	n, err := strconv.ParseFloat(next(), 64)
	if err != nil {
		panic(err)
	}
	return n
}

func println(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

func print(a ...interface{}) {
	fmt.Fprint(writer, a...)
}

package main

import (
	"fmt"
	"sort"
)

type Work struct {
	Complexity int
	Index int
}

type ByComplexity []Work

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

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]Work, n)
	for i := 0; i < n; i++ {
		var x int
		fmt.Scan(&x)
		a[i] = Work{x, i+1}
	}
	sort.Sort(ByComplexity(a))
	ret := make([][]int, 3)
	ret[0] = make([]int, n)
	ret[1] = make([]int, n)
	ret[2] = make([]int, n)

	first := 0
	splitted := false
	part_splitted := false
	for first < n {
		next := first + 1
		for next < n && a[next].Complexity == a[first].Complexity {
			next++
		}

		if next - first > 2 {
			splitted = true
			ret[0][first] = a[first].Index
			ret[0][first+1] = a[first+1].Index
			ret[0][first+2] = a[first+2].Index

			ret[1][first] = a[first+1].Index
			ret[1][first+1] = a[first].Index
			ret[1][first+2] = a[first+2].Index

			ret[2][first] = a[first+2].Index
			ret[2][first+1] = a[first+1].Index
			ret[2][first+2] = a[first].Index
			for i := first + 3; i < next; i++ {
				ret[0][i] = a[i].Index
				ret[1][i] = a[i].Index
				ret[2][i] = a[i].Index
			}
		} else if next - first == 2 {
			if part_splitted {
				splitted = true
				ret[0][first] = a[first].Index
				ret[0][first+1] = a[first+1].Index

				ret[1][first] = a[first+1].Index
				ret[1][first+1] = a[first].Index

				ret[2][first] = a[first].Index
				ret[2][first+1] = a[first+1].Index
			} else {
				part_splitted = true
				ret[0][first] = a[first].Index
				ret[0][first+1] = a[first+1].Index

				ret[1][first] = a[first].Index
				ret[1][first+1] = a[first+1].Index

				ret[2][first] = a[first+1].Index
				ret[2][first+1] = a[first].Index
			}
		} else {
			ret[0][first] = a[first].Index
			ret[1][first] = a[first].Index
			ret[2][first] = a[first].Index
		}

		first = next
	}

	if splitted {
		fmt.Println("YES")
		for i := 0; i < 3; i++ {
			for j := 0; j < n; j++ {
				fmt.Print(ret[i][j], " ")
			}
			fmt.Println()
		}
	} else {
		fmt.Println("NO")
	}
}

//https://codeforces.com/problemset/problem/471/b
//http://bigocoder.com/courses/BLUE20/BLUE20_LEC18/BLUE_LEC18P01/statement
package main

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

type node struct {
	p int
	i int
}

func solve(arr []node, cache map[int]int) [][]node {
	result := make([][]node, 3)
	sort.Slice(arr, func(i, j int) bool { return arr[i].p < arr[j].p })

	for i := range result {
		result[i] = make([]node, len(arr))
	}
	copy(result[0], arr)
	j := 1

	for i := range arr {
		if cache[arr[i].p] > 1 {
			temp := arr[i]
			arr[i] = arr[i+1]
			arr[i+1] = temp
			cache[arr[i].p]--
			copy(result[j], arr)
			j++
			if j == 3 {
				break
			}
		}
	}

	return result
}

func main() {
	r := bufio.NewReader(os.Stdin)
	var n, p, dupeNumber int
	var isHaveEnoughDuplicate bool
	fmt.Fscanf(r, "%d\n", &n)
	arr := make([]node, n)
	cache := make(map[int]int, n)

	for i := range arr {
		fmt.Fscanf(r, "%d", &p)
		arr[i] = node{p, i + 1}
		cache[arr[i].p]++
	}

	for _, v := range cache {
		if v > 2 {
			isHaveEnoughDuplicate = true
			break
		}
		if v > 1 {
			dupeNumber++
		}
		if dupeNumber >= 2 {
			break
		}
	}

	if isHaveEnoughDuplicate || dupeNumber >= 2 {
		fmt.Fprintf(os.Stdout, "%s\n", "YES")
		res := solve(arr, cache)
		for i := range res {
			for j := range res[i] {
				fmt.Fprintf(os.Stdout, "%d ", res[i][j].i)
			}
			fmt.Fprintln(os.Stdout)
		}
	} else {
		fmt.Fprintf(os.Stdout, "%s\n", "NO")
	}
}

package main

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

type node struct {
	p int
	i int
}

func solve(arr []node, cache map[int]int) [][]node {
	j := 1
	result := make([][]node, 3)
	sort.Slice(arr, func(i, j int) bool { return arr[i].p < arr[j].p })

	for i := range result {
		result[i] = make([]node, len(arr))
	}
	copy(result[0], arr)

	for i := range arr {
		if cache[arr[i].p] > 1 {
			swap(arr, i, j)
			cache[arr[i].p]--
			copy(result[j], arr)
			j++
			if j == 3 {
				break
			}
		}
	}

	return result
}

func swap(arr []node, i int, j int) {
	temp := arr[i]
	arr[i] = arr[i+1]
	arr[i+1] = temp
}

func main() {
	r := bufio.NewReader(os.Stdin)
	var n, p, dupeNumber int
	var isHaveEnoughDuplicate bool
	fmt.Fscanf(r, "%d\n", &n)
	arr := make([]node, n)
	cache := make(map[int]int, n)

	for i := range arr {
		fmt.Fscanf(r, "%d", &p)
		arr[i] = node{p, i + 1}
		cache[arr[i].p]++
	}

	for _, value := range cache {
		if value > 2 {
			isHaveEnoughDuplicate = true
			//to have 3 distinct result, we need at least 3 duplicate numbers or 2 pairs of dupe numbers
			break
		}
		if value > 1 {
			dupeNumber++
		}
		if dupeNumber >= 2 {
			break
		}
	}

	if isHaveEnoughDuplicate || dupeNumber >= 2 {
		fmt.Fprintf(os.Stdout, "%s\n", "YES")
		res := solve(arr, cache)
		for i := range res {
			for j := range res[i] {
				fmt.Fprintf(os.Stdout, "%d ", res[i][j].i)
			}
			fmt.Fprintln(os.Stdout)
		}
	} else {
		fmt.Fprintf(os.Stdout, "%s\n", "NO")
	}
}

package main

import (
    "fmt"
    "sort"
)

type Pair struct {
    index, value int
}

type ByValue []Pair

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

func main() {
    var n, a int
    fmt.Scan(&n)
    arr := make([]Pair, n)
    for i := 0; i < n; i++ {
        fmt.Scan(&a)
        arr[i] = Pair{index: i + 1, value: a}
    }
    sort.Sort(ByValue(arr))

    pos := make([]Pair, 0)
    for i := 1; i < n; i++ {
        if arr[i].value == arr[i-1].value {
            pos = append(pos, Pair{i, i - 1})
        }
    }
    if len(pos) < 2 {
        fmt.Println("NO")
    } else {
        fmt.Println("YES")
        for _, v := range arr {
            fmt.Printf("%d ", v.index)
        }
        fmt.Println()

        arr[pos[0].index], arr[pos[0].value] = arr[pos[0].value], arr[pos[0].index]
        for _, v := range arr {
            fmt.Printf("%d ", v.index)
        }
        fmt.Println()

        arr[pos[1].index], arr[pos[1].value] = arr[pos[1].value], arr[pos[1].index]
        for _, v := range arr {
            fmt.Printf("%d ", v.index)
        }
        fmt.Println()
    }
}

package main

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

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

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

	n := nextInt()
	a1, a2, atemp := make([]int, n), make([]int, n), make([]int, n)
	pos1, pos2 := 0, 0

	for i := 0; i < n; i++ {
		a1[i] = nextInt()
	}

	copy(atemp, a1)

	for i := 0; i < n; i++ {
		pos := 0

		for j := 0; j < n; j++ {
			if a1[j] != 0 {
				pos = j
				break
			}
		}

		for j := pos; j < n; j++ {
			if a1[j] != 0 && a1[j] < a1[pos] {
				pos = j
			}
		}

		a2[i] = pos
		a1[pos] = 0
	}

	i := 0
	a1 = atemp

	for ; i < n - 1; i++ {
		if a1[a2[i]] == a1[a2[i + 1]] {
			pos1 = i
			i += 2
			break
		}
	}

	for ; i < n - 1; i++ {
		if a1[a2[i]] == a1[a2[i + 1]] {
			pos2 = i
			break
		}
	}

	if pos2 == 0 {
		 println("NO")
	} else {
		println("YES")
		printSlice(a2)
		a2[pos1], a2[pos1 + 1] = a2[pos1 + 1], a2[pos1]
		printSlice(a2)
		a2[pos2], a2[pos2 + 1] = a2[pos2 + 1], a2[pos2]
		printSlice(a2)
	}

	// println(a2, a1, pos1, pos2)
}

func printSlice(a []int) {
	for i := 0; i < len(a); i++ {
		print(a[i] + 1, " ")
	}
	print("\n")
}

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

func nextInt() int {
	n, err := strconv.Atoi(next())
	if err != nil {
		panic(err)
	}
	return n
}

func nextFloat() float64 {
	n, err := strconv.ParseFloat(next(), 64)
	if err != nil {
		panic(err)
	}
	return n
}

func println(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

func print(a ...interface{}) {
	fmt.Fprint(writer, a...)
}


package main

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

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

	n := readNum(reader)

	A := readNNums(reader, n)

	res := solve(n, A)

	var buf bytes.Buffer

	for i := 0; i < len(res); i++ {
		buf.WriteString(fmt.Sprintf("%d ", res[i]))
	}
	fmt.Print(buf.String())
}

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
}

const MX = 81

const dx, dy, dz = MX + 1, MX + 1, MX*(MX+1)/2 + 1

var dp [dx][dy][dz]int

const INF = 100000000

func init() {
	for i := 0; i < dx; i++ {
		for j := 0; j < dy; j++ {
			for k := 0; k < dz; k++ {
				dp[i][j][k] = INF
			}
		}
	}
}

func solve(n int, A []int) []int {
	gg := make([]int, 0, n/2)

	for i := 0; i <= n; i++ {
		j := i
		for i < n && A[i] == 0 {
			i++
		}
		gg = append(gg, i-j)
	}

	p := make([]int, len(gg))
	p[0] = gg[0]
	for i := 1; i < len(gg); i++ {
		p[i] = gg[i] + p[i-1]
	}
	dp[0][0][0] = 0

	k := len(gg)
	l := p[len(p)-1]

	N := n * (n - 1) / 2

	for i := 0; i < k; i++ {
		for j := 0; j <= l; j++ {
			for s := 0; s <= N; s++ {
				if dp[i][j][s] == INF {
					continue
				}
				for q := j; q <= l; q++ {
					min(&dp[i+1][q][s+abs(q-p[i])], dp[i][j][s]+(q-j)*(q-j))
				}
			}
		}
	}

	res := make([]int, 0, N+1)
	cur := INF
	for s := 0; s <= N; s++ {
		min(&cur, dp[k][l][s])
		val := l*l - cur
		res = append(res, val/2)
	}
	return res
}

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

func min(a *int, b int) {
	if *a > b {
		*a = b
	}
}

package main

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

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

	n := readNum(reader)

	A := readNNums(reader, n)

	res := solve(n, A)

	var buf bytes.Buffer

	for i := 0; i < len(res); i++ {
		buf.WriteString(fmt.Sprintf("%d ", res[i]))
	}
	fmt.Print(buf.String())
}

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
}

const MX = 103

const dx, dy, dz = MX + 1, MX + 1, MX*(MX+1)/2 + 1

var dp [dx][dy][dz]int

const INF = 100000000

func init() {
	for i := 0; i < dx; i++ {
		for j := 0; j < dy; j++ {
			for k := 0; k < dz; k++ {
				dp[i][j][k] = INF
			}
		}
	}
}

func solve(n int, A []int) []int {
	gg := make([]int, 0, n/2)

	for i := 0; i <= n; i++ {
		j := i
		for i < n && A[i] == 0 {
			i++
		}
		gg = append(gg, i-j)
	}

	p := make([]int, len(gg))
	p[0] = gg[0]
	for i := 1; i < len(gg); i++ {
		p[i] = gg[i] + p[i-1]
	}
	dp[0][0][0] = 0

	k := len(gg)
	l := p[len(p)-1]

	N := n * (n - 1) / 2

	for i := 0; i < k; i++ {
		for j := 0; j <= l; j++ {
			for s := 0; s <= N; s++ {
				if dp[i][j][s] == INF {
					continue
				}
				for q := j; q <= l; q++ {
					min(&dp[i+1][q][s+abs(q-p[i])], dp[i][j][s]+(q-j)*(q-j))
				}
			}
		}
	}

	res := make([]int, 0, N+1)
	cur := INF
	for s := 0; s <= N; s++ {
		min(&cur, dp[k][l][s])
		val := l*l - cur
		res = append(res, val/2)
	}
	return res
}

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

func min(a *int, b int) {
	if *a > b {
		*a = b
	}
}


package main

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

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

func flush()                            { out.Flush() }
func scan(a ...interface{})             { fmt.Fscan(in, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(out, f, a...) }
func assert(f bool) {
	if !f {
		panic("gg")
	}
}

// ----------------------------- TEMPLATE END ----------------------------------

const TAM = int(2e5 + 10)

var a [TAM]int
var ans [TAM]byte
var start []int
var end []int
var graph [TAM][]int
var order [TAM]int

func addEdge(a, b int) {
	graph[a] = append(graph[a], b)
	graph[b] = append(graph[b], a)
}

func impossible() {
	printf("NO\n")
	flush()
	os.Exit(0)
}

var colors []byte = []byte{'L', 'R'}

func fill(start int) bool {
	i := start
	c := 1
	ans[i] = colors[0]
	for j := graph[i][0]; j != start; {
		ans[j] = colors[c]
		if graph[j][0] == i {
			i = j
			j = graph[i][1]
		} else {
			i = j
			j = graph[i][0]
		}
		c ^= 1
	}
	return true
}

func main() {
	defer flush()
	var nArrays int
	scan(&nArrays)
	start = make([]int, nArrays)
	end = make([]int, nArrays)

	last := make(map[int]int, nArrays)
	for arrIndex := 0; arrIndex < nArrays; arrIndex++ {
		if arrIndex > 0 {
			start[arrIndex] = end[arrIndex-1]
		}
		var sz int
		scan(&sz)
		end[arrIndex] = start[arrIndex] + sz
		for i := 0; i < sz; i++ {
			scan(&a[start[arrIndex]+i])
			order[i] = start[arrIndex] + i
		}
		sort.Slice(order[:sz], func(i, j int) bool {
			return a[order[i]] < a[order[j]]
		})

		lastI := -1
		for orderIndex := 0; orderIndex < sz; orderIndex++ {
			if orderIndex+1 < sz && a[order[orderIndex+1]] == a[order[orderIndex]] {
				ans[order[orderIndex+1]] = 'L'
				ans[order[orderIndex]] = 'R'
				orderIndex++
			} else {
				i := order[orderIndex]
				x := a[i]
				j, found := last[x]
				if found {
					delete(last, x)
					addEdge(i, j)
				} else {
					last[x] = i
				}

				if lastI != -1 {
					addEdge(lastI, i)
					lastI = -1
				} else {
					lastI = i
				}
			}
		}

		assert(lastI == -1)
	}

	if len(last) > 1 {
		impossible()
	}

	for i := 0; i < end[nArrays-1]; i++ {
		if ans[i] == 0 {
			fill(i)
		}
	}

	printf("YES\n")
	for i := 0; i < nArrays; i++ {
		printf("%s\n", ans[start[i]:end[i]])
	}
}

package main

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

const MOD int64 = 1000000007

var m int

var a [][]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)

	fmt.Fscan(read, &m)

	a = make([][]int, m)

	for j := 0; j < m; j++ {
		var n int
		fmt.Fscan(read, &n)

		a[j] = make([]int, n)

		for i := 0; i < n; i++ {
			fmt.Fscan(read, &a[j][i])
		}
	}

	solve()

}

type pair struct {
	v int
	idx []int
}

func solve()  {

	var res [][]int

	res = make([][]int, m)

	for i := 0; i < m; i++ {
		res[i] = make([]int, len(a[i]))

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

	check := make(map[int]int)

	//for each num -> rows where that number is present in odd quantity
	rows := make(map[int]map[int]bool)
	//nums with odd count in each row
	odds := make([]map[int]int, m)

	for i := 0; i < m; i++ {
		mp1 := make(map[int]int)
		mp2 := make(map[int]int)

		for j := 0; j < len(a[i]); j++ {
			mp1[a[i][j]]++
			mp2[a[i][j]] = j
			check[a[i][j]]++
		}

		for k, v := range mp1 {
			if v % 2 == 1 {
				if odds[i] == nil {
					odds[i] = make(map[int]int)
				}
				odds[i][k] = mp2[k]

				if rows[k] == nil {
					rows[k] = make(map[int]bool)
				}

				rows[k][i] = true
			}
		}
	}

	for _, v := range check {
		if v % 2 == 1 {
			fmt.Println("NO")
			return
		}
	}
	fmt.Println("YES")

	for i := 0; i < m; i++ {
		mp := odds[i]
		in := 0

		for len(mp) > 0 {
			if len(mp) < 2 {
				panic("len must be even")
			}

			var key1 int
			var v1 int
			var key2 int
			var v2 int

			for k, v := range mp {
				if res[i][v] != -1 {
					continue
				}
				key1 = k
				break
			}
			v1 = mp[key1]
			delete(mp, key1)

			res[i][v1] = in
			in = in ^ 1

			for k, v := range mp {
				if res[i][v] != -1 {
					continue
				}
				key2 = k
				break
			}

			v2 = mp[key2]
			delete(mp, key2)

			res[i][v2] = in
			in = in ^ 1

			delete(rows[key1], i)
			delete(rows[key2], i)

			rec(key2, &rows, &odds, in, &res)
		}
	}

	for i := 0; i < m; i++ {
		mp := make(map[int][]int)

		for j := 0; j < len(a[i]); j++ {
			mp[a[i][j]] = append(mp[a[i][j]], j)
		}

		in := 0

		for _, v := range mp{
			for p := 0; p < len(v); p++ {
				if res[i][v[p]] != -1 {
					continue
				}
				res[i][v[p]] = in

				in = in ^ 1
			}
		}
	}

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

		for j := 0; j < len(res[i]); j++ {
			if res[i][j] == 0 {
				fmt.Print("L")
			} else if res[i][j] == 1 {
				fmt.Print("R")
			} else {
				panic("incorrect")
			}
		}
		fmt.Println()
	}
}

func rec(key int, rows *map[int]map[int]bool, odds *[]map[int]int, cur int, res *[][]int) {

	if len((*rows)[key]) == 0 {
		return
	}

	var next int

	for k, _ := range (*rows)[key] {
		next = k
		break
	}

	delete((*rows)[key], next)

	idx := (*odds)[next][key]

	(*res)[next][idx] = cur
	cur = cur ^ 1

	delete((*odds)[next], key)

	var _k int
	var _v int
	for k, v := range (*odds)[next] {
		_k = k
		_v = v
		break
	}

	delete((*odds)[next], _k)

	(*res)[next][_v] = cur
	cur = cur ^ 1

	delete((*rows)[_k], next)

	rec(_k, rows, odds, cur, res)
}

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

package main

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

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

func flush()                            { out.Flush() }
func scan(a ...interface{})             { fmt.Fscan(in, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(out, f, a...) }
func assert(f bool) {
	if !f {
		panic("gg")
	}
}

// ----------------------------- TEMPLATE END ----------------------------------

const TAM = int(2e5 + 10)

var a [TAM]int
var ans [TAM]byte
var start []int
var end []int
var graph [TAM][]int

func addEdge(a, b int) {
	graph[a] = append(graph[a], b)
	graph[b] = append(graph[b], a)
}

func impossible() {
	printf("NO\n")
	flush()
	os.Exit(0)
}

func rec(i int, c byte) bool {
	if ans[i] != '.' {
		return ans[i] == c
	}
	ans[i] = c
	if c == 'L' {
		c = 'R'
	} else {
		c = 'L'
	}
	for _, j := range graph[i] {
		if !rec(j, c) {
			return false
		}
	}
	return true
}

func main() {
	defer flush()
	var n int
	scan(&n)
	start = make([]int, n)
	end = make([]int, n)

	last := make(map[int]int, n)
	for arrIndex := 0; arrIndex < n; arrIndex++ {
		if arrIndex > 0 {
			start[arrIndex] = end[arrIndex-1]
		}
		scan(&end[arrIndex])
		end[arrIndex] += start[arrIndex]
		lastInArray := make(map[int]int, n)
		for i := start[arrIndex]; i < end[arrIndex]; i++ {
			ans[i] = '.'
			scan(&a[i])
			j, found := lastInArray[a[i]]
			if found {
				ans[j] = 'L'
				ans[i] = 'R'
				delete(lastInArray, a[i])
			} else {
				lastInArray[a[i]] = i
			}
		}
		lastI := -1
		for x, i := range lastInArray {
			j, found := last[x]
			if found {
				delete(last, x)
				addEdge(i, j)
			} else {
				last[x] = i
			}

			if lastI != -1 {
				addEdge(lastI, i)
				lastI = -1
			} else {
				lastI = i
			}
		}

		assert(lastI == -1)
	}

	if len(last) > 1 {
		impossible()
	}

	for i := 0; i < end[n-1]; i++ {
		if ans[i] == '.' {
			if !rec(i, 'L') {
				impossible()
			}
		}
	}

	for i := 0; i < n; i++ {
		printf("%s\n", ans[start[i]:end[i]])
	}
}


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)
		P := solve(n)
		for i := 0; i < n; i++ {
			buf.WriteString(fmt.Sprintf("%d ", P[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 {
	// lcm(1, pi)
	p := make([]int, n)
	for i := 0; i < n; i++ {
		p[i] = i + 1
	}
	for i := n - 1; i > 0; i -= 2 {
		p[i], p[i-1] = p[i-1], p[i]
	}
	return p
}

package main

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

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

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

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

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

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

/**
Run solve the problem CF1712A
Date: 8/20/2022
User: wotan
URL: https://codeforces.com/problemset/problem/1712/B
Problem: CF1712A
**/
func (in *CF1712A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()

		if n == 1 {
			fmt.Println(1)
		} else if n >= 2 {
			if n%2 == 0 {
				for i := 1; i <= n; i += 2 {
					fmt.Print(i+1, i, " ")
				}
			} else {
				fmt.Print(1, " ")
				for i := 3; i <= n; i += 2 {
					fmt.Print(i, i-1, " ")
				}
			}
			fmt.Println()
		}
	}
}

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

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

package main

import "fmt"

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}
func lcm(x, y int) int {
	return x / gcd(x, y) * y
}
func main() {
	var T int
	fmt.Scan(&T)
	for t := 0; t < T; t++ {
		var n int
		fmt.Scan(&n)
		if n%2 == 0 {
			for i := 1; i <= n; i++ {
				if i%2 == 0 {
					fmt.Printf("%v ", i-1)
				} else {
					fmt.Printf("%v ", i+1)
				}
			}
			fmt.Println("")
		} else {
			fmt.Printf("%v ", 1)
			for i := 2; i <= n; i++ {
				if i%2 == 0 {
					fmt.Printf("%v ", i+1)
				} else {
					fmt.Printf("%v ", i-1)
				}
			}
			fmt.Println("")
		}
	}

}

package main

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

const cf = true

func solve() {
	var n int
	fmt.Fscan(in, &n)
	arr := make([]int, n)
	for i := range arr {
		arr[i] = i + 1
	}
	for i := n - 1; i > 0; i -= 2 {
		arr[i], arr[i-1] = arr[i-1], arr[i]
	}
	for i := range arr {
		fmt.Fprint(out, arr[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(
    "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 j:=0;j<t;j++{
		var n int
		fmt.Fscan(in,&n)
		list:= make([]int,n)
		for k:=1;k<=n;k++{
			list[k-1]=k
		}
		for k:=n-2;k>=0;k-=2{
			list[k],list[k+1] = list[k+1],list[k]
		}
		for k:=0;k<n;k++{
			fmt.Fprintf(out,"%v ",list[k])
		}
		fmt.Fprintln(out,)

	}
}

package main

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

func readLine() string {
	s, err := in.ReadString('\n')
	if err != nil {
		panic(err)
	}
	s = strings.ReplaceAll(s, "\n", "")
	s = strings.ReplaceAll(s, "\r", "")
	return s
}

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

func readInt() int {
	n, err := strconv.ParseInt(readLine(), 10, 32)
	if err != nil {
		panic(err)
	}
	return int(n)
}

func readInt2() (int, int) {
	as := readInts(2)
	return as[0], as[1]
}

func readInt3() (int, int, int) {
	as := readInts(3)
	return as[0], as[1], as[2]
}

func readUint() uint64 {
	n, err := strconv.ParseUint(readLine(), 10, 64)
	if err != nil {
		panic(err)
	}
	return n
}

func readInts(n int) []int {
	s := readLine()
	as := strings.SplitN(s, " ", n)
	if len(as) != n {
		panic("invalid len")
	}
	arr := make([]int, n)
	for k, a := range as {
		x, _ := strconv.ParseInt(a, 10, 64)
		arr[k] = int(x)
	}
	return arr
}

func readStrings(n int) []string {
	s := readLine()
	as := strings.SplitN(s, " ", n)
	if len(as) != n {
		panic("invalid len")
	}
	return as
}

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

const MAXN int = 1e5 + 7

var in = bufio.NewReader(os.Stdin)
var a [MAXN]int

func main() {
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t, n, i int
	var ch byte
	t = readInt()
	for ; t != 0; t-- {
		n = readInt()
		for i = n; i > 0; i -= 2 {
			if i >= 2 {
				a[i] = i - 1
				a[i-1] = i
			} else {
				a[i] = i
			}
		}
		for i = 1; i <= n; i++ {
			if i == n {
				ch = '\n'
			} else {

				ch = ' '
			}
			fmt.Fprintf(out, "%d%c", a[i], ch)
		}
	}
}

package main

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

func main() {
	woefulPermutationRead()
}

func woefulPermutationRead() {
	in := bufio.NewReader(os.Stdin)
	var t int

	fmt.Fscan(in, &t)

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

		// solve
		res := woefulPermutation(n)
		fmt.Print(res[0])
		for j := 1; j < n; j++ {
			fmt.Printf(" %d", res[j])
		}
		fmt.Println()
	}
}

func woefulPermutation(n int) []int {
	res := make([]int, n)
	for i := n - 1; i > 0; i -= 2 {
		res[i] = i
		res[i-1] = i + 1
	}
	if res[0] == 0 {
		res[0] = 1
	}
	return res
}

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)

		aa := make([]int, n)
		if n%2 == 0 {
			for i := 0; i < n; i += 2 {
				aa[i] = i + 2
			}
			for i := 1; i < n; i += 2 {
				aa[i] = i
			}
		} else {
			aa[0] = 1
			for i := 1; i < n; i += 2 {
				aa[i] = i + 2
			}
			for i := 2; i < n; i += 2 {
				aa[i] = i
			}
		}

		for _, v := range aa {
			fmt.Fprintf(out, "%d ", v)
		}
		fmt.Fprintln(out)
	}
}

package main

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

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

func main() {
	defer out.Flush()

	var test int
	fmt.Fscan(in, &test)
	for i := 0; i < test; i++ {
		solve()
	}
}

func solve() {
	var n int
	fmt.Fscan(in, &n)
	a := make([]int, n)
	i := n - 2
	for i >= 0 {
		a[i] = i + 2
		a[i+1] = i + 1
		i -= 2
	}
	if a[0] == 0 {
		a[0] = 1
	}
	for _, x := range a {
		fmt.Fprintf(out, "%d ", x)
	}
	fmt.Fprintln(out)
}

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

func solve(n int) {
	arr := []int{}
	for i := 1; i <= n; i++ {
		arr = append(arr, i)
	}
	for i := n - 1; i > 0; i -= 2 {
		arr[i], arr[i-1] = arr[i-1], arr[i]
	}
	for i := 0; i < n; i++ {
		fmt.Print(arr[i], " ")
	}
	fmt.Println()
}

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"
	"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 int
	scan(&n)
	if n%2 == 1 {
		printf("1 ")
		for i := 2; i <= n; i += 2 {
			printf("%d %d ", i+1, i)
		}
		printf("\n")
	} else {
		for i := 2; i <= n; i += 2 {
			printf("%d %d ", i, i-1)
		}
		printf("\n")
	}
}
func main() {
	defer out.Flush()
	n := 0
	scan(&n)
	for i := 0; i < n; i++ {
		solve()
	}
}

package main

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

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

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

func rw(r io.Reader, w io.Writer) {
	var t int
	fmt.Fscan(r, &t)
	for ti := 0; ti < t; ti++ {
		var n int
		fmt.Fscan(r, &n)
		w1 := do(n)
		for _, v := range w1 {
			fmt.Fprint(w, v, " ")
		}
		fmt.Fprintln(w)
	}
}

func do(n int) []int {
	a := make([]int, n)
	a[0] = 1
	for i := n - 2; i >= 0; i -= 2 {
		a[i] = i + 2
		a[i+1] = i + 1
	}
	return a
}

package main

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

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

func read(value ...interface{}) {
	_, _ = fmt.Fscan(bufferedStdin, value...)
}

func printf(format string, value ...interface{}) {
	_, _ = fmt.Fprintf(bufferedStdout, format, value...)
}

func printfErr(format string, value ...interface{}) {
	_, _ = fmt.Fprintf(os.Stderr, format, value...)
}

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

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

func findElementIds(array []int, f func(int) bool) []int {
	var result = make([]int, 0)
	for i := 0; i < len(array); i++ {
		if f(array[i]) {
			result = append(result, i)
		}
	}
	return result
}

func reduce(array []int, defaultValue int, f func(int, int) int) int {
	for i := 0; i < len(array); i++ {
		defaultValue = f(defaultValue, array[i])
	}
	return defaultValue
}

func solve(test int) {
	var n int
	read(&n)
	var start = 1
	if n % 2 == 1 {
		printf("1")
		start = 2
	}
	for i := start; i <= n; i += 2 {
		printf(" %d %d", i + 1, i)
	}
	printf("\n")
}

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

package main

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

var (
	reader bufio.Reader
	writer bufio.Writer
)

func solve() {
	var n int
	scan(&n)

	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = i + 1;
	}

	for i := n - 1; i >= 1; i -= 2 {
		a[i - 1], a[i] = a[i], a[i - 1]
	}

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

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
	T = 1
	scan(&T)

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

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

func solve() {
	var n int
	fmt.Scan(&n)
	arr := make([]int, n)
	for i := n - 2; i >= 0; i -= 2 {
		arr[i] = i + 2
		arr[i+1] = i + 1
	}
	if n%2 == 1 {
		arr[0] = 1
	}
	for _, v := range arr {
		fmt.Printf("%d ", v)
	}
	fmt.Println()
}

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

}

package main

import "fmt"

func main() {

	t := 0
	if _, err := fmt.Scan(&t); err != nil {
		return
	}
	for ; t > 0; t-- {
		n := 0
		if _, err := fmt.Scan(&n); err != nil {
			return
		}
		i := 1
		if n%2 == 1 {
			fmt.Print(i, " ")
			i++
		}
		for ; i <= n; i++ {
			if i < n {
				fmt.Print(i+1, " ", i, " ")
				i++
			} else {
				fmt.Print(i)
			}
		}
	}

}

// 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 int
		fmt.Fscan(reader, &n)
		a := make([]int, n)
		for i := 1; i <= n; i++ {
			a[i-1] = i
		}
		for i := n - 1; i > 0; i -= 2 {
			a[i], a[i-1] = a[i-1], a[i]
		}
		for i := 0; i < n; i++ {
			fmt.Print(a[i])
			if i != n-1 {
				fmt.Print(" ")
			}
		}
		fmt.Println()
	}
}

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 == 1 {
			Fprint(out, 1, " ")
			for i := 2; i <= n; i += 2 {
				Fprint(out, i+1, i, " ")
			}
			Fprintln(out)
		} else {
			for i := 1; i <= n; i += 2 {
				Fprint(out, i+1, i, " ")
			}
			Fprintln(out)
		}
	}
	// Coding...ove!
	for i := 0; i < cas; i++ {
		sol()
	}
}
func main() { A1() }

package main

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

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

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

// func maxSquare(a int) int {
// 	tmp := int(math.Sqrt(float64(a)))
// 	if tmp*tmp == a {
// 		return tmp * tmp
// 	} else {
// 		return (tmp + 1) * (tmp + 1)
// 	}
// }

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var niter int
	fmt.Fscan(in, &niter)
	for iiter := 0; iiter < niter; iiter++ {
		var n int
		fmt.Fscan(in, &n)
		if n%2 == 0 {
			for i := 1; i < n; i += 2 {
				fmt.Fprintf(out, "%d %d ", i+1, i)
			}
			fmt.Fprintln(out)
		} else {
			fmt.Fprintf(out, "%d ", 1)
			for i := 2; i < n; i += 2 {
				fmt.Fprintf(out, "%d %d ", i+1, i)
			}
			fmt.Fprintln(out)
		}
	}
}

package main

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

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

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

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

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

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

/**
Run solve the problem CF1712A
Date: 8/20/2022
User: wotan
URL: https://codeforces.com/problemset/problem/1712/B
Problem: CF1712A
**/
func (in *CF1712A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()

		if n == 1 {
			fmt.Println(1)
		} else if n >= 2 {
			for i := 1; i <= n; i += 2 {
				fmt.Print(i+1, i, " ")
			}
			fmt.Println()
		}
	}
}

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

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

package main

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

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

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

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

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

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

/**
Run solve the problem CF1712A
Date: 8/20/2022
User: wotan
URL: https://codeforces.com/problemset/problem/1712/B
Problem: CF1712A
**/
func (in *CF1712A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()

		arr := make([]bool, n+1)
		if n == 1 {
			fmt.Println(1)
		} else if n >= 2 {
			fmt.Print(2, 1, " ")
			arr[2] = true
			arr[1] = true

			for i := 3; i < n; i++ {
				for j := 3; j < len(arr); j++ {
					if i%j != 0 && !arr[j] {
						fmt.Print(j, " ")
						arr[j] = true
					}
				}
			}
			fmt.Println()
		}
	}
}

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

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

package main

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

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

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

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

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

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

/**
Run solve the problem CF1712A
Date: 8/20/2022
User: wotan
URL: https://codeforces.com/problemset/problem/1712/B
Problem: CF1712A
**/
func (in *CF1712A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()

		if n == 1 {
			fmt.Print(1)
		}

		if n >= 2 {
			fmt.Print(2, 1)
		}
		for i := n; i >= 3; i-- {
			fmt.Print(i, " ")
		}
		fmt.Println()
	}
}

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

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

package main

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

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

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

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

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

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

/**
Run solve the problem CF1712A
Date: 8/20/2022
User: wotan
URL: https://codeforces.com/problemset/problem/1712/B
Problem: CF1712A
**/
func (in *CF1712A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		for i := 1; i <= n; i++ {
			fmt.Print(i, " ")
		}
		fmt.Println()
	}
}

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

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

package main

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

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

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

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

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

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

/**
Run solve the problem CF1712A
Date: 8/20/2022
User: wotan
URL: https://codeforces.com/problemset/problem/1712/B
Problem: CF1712A
**/
func (in *CF1712A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		for i := n; i > 0; i-- {
			fmt.Print(i, " ")
		}
		fmt.Println()
	}
}

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

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

package main

import "fmt"

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}
func lcm(x, y int) int {
	return x / gcd(x, y) * y
}
func main() {
	var T int
	fmt.Scan(&T)
	for t := 0; t < T; t++ {
		var n int
		fmt.Scan(&n)
		for i := 0; i < n; i++ {
			fmt.Printf("%v ", (i-1+n)%n+1)
		}
		fmt.Println("")
	}

}

package main

import "fmt"

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}
func lcm(x, y int) int {
	return x / gcd(x, y) * y
}
func main() {
	var T int
	fmt.Scan(&T)
	for t := 0; t < T; t++ {
		var n int
		fmt.Scan(&n)
		for i := 1; i <= n; i++ {
			fmt.Printf("%v ", (i)%n+1)
		}
		fmt.Println("")
	}

}

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

const cf = true

func solve() {
	var n int
	fmt.Fscan(in, &n)
	for i := 2; i <= n; i++ {
		fmt.Fprint(out, i, " ")
	}
	fmt.Fprintln(out, "1 ")
}

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(
    "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 j:=0;j<t;j++{
		var n int
		fmt.Fscan(in,&n)
		for k:=1;k<=n;k+=2{
			fmt.Fprintf(out,"%v %v ",k+1,k)
		}
		fmt.Fprintln(out,)
	}
}

package main

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

func readLine() string {
	s, err := in.ReadString('\n')
	if err != nil {
		panic(err)
	}
	s = strings.ReplaceAll(s, "\n", "")
	s = strings.ReplaceAll(s, "\r", "")
	return s
}

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

func readInt() int {
	n, err := strconv.ParseInt(readLine(), 10, 32)
	if err != nil {
		panic(err)
	}
	return int(n)
}

func readInt2() (int, int) {
	as := readInts(2)
	return as[0], as[1]
}

func readInt3() (int, int, int) {
	as := readInts(3)
	return as[0], as[1], as[2]
}

func readUint() uint64 {
	n, err := strconv.ParseUint(readLine(), 10, 64)
	if err != nil {
		panic(err)
	}
	return n
}

func readInts(n int) []int {
	s := readLine()
	as := strings.SplitN(s, " ", n)
	if len(as) != n {
		panic("invalid len")
	}
	arr := make([]int, n)
	for k, a := range as {
		x, _ := strconv.ParseInt(a, 10, 64)
		arr[k] = int(x)
	}
	return arr
}

func readStrings(n int) []string {
	s := readLine()
	as := strings.SplitN(s, " ", n)
	if len(as) != n {
		panic("invalid len")
	}
	return as
}

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

var in = bufio.NewReader(os.Stdin)

func main() {
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t, n, temp int
	var ch byte
	t = readInt()
	for ; t != 0; t-- {
		n = readInt()
		for i := 1; i <= n; i++ {
			if i == n {
				ch = '\n'
			} else {
				ch = ' '
			}
			if i == 1 {
				temp = n
			} else {
				temp = i - 1
			}
			fmt.Fprintf(out, "%d%c", temp, ch)
		}
	}
}

package main

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

func main() {
	woefulPermutationRead()
}

func woefulPermutationRead() {
	in := bufio.NewReader(os.Stdin)
	var t int

	fmt.Fscan(in, &t)

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

		// solve
		res := woefulPermutation(n)
		fmt.Print(res[0])
		for j := 1; j < n; j++ {
			fmt.Printf(" %d", res[j])
		}
	}
}

func woefulPermutation(n int) []int {
	res := make([]int, n)
	for i := n - 1; i > 0; i -= 2 {
		res[i] = i
		res[i-1] = i + 1
	}
	if res[0] == 0 {
		res[0] = 1
	}
	return res
}

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)

		for i := n; i >= 1; i-- {
			fmt.Fprintf(out, "%d ", i)
		}
		fmt.Fprintln(out)
	}
}

package main

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

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

func main() {
	defer out.Flush()

	var test int
	fmt.Fscan(in, &test)
	for i := 0; i < test; i++ {
		solve()
	}
}

func solve() {
	var n int
	fmt.Fscan(in, &n)
	fmt.Fprintf(out, "%d ", n)
	for i := 1; i < n; i++ {
		fmt.Fprintf(out, "%d ", i)
	}
	fmt.Fprintln(out)
}

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)
		for i := 2; i <= n; i++ {
			fmt.Print(i, " ")
		}
		fmt.Println(1)
	}
}

func solve(n int) int {
	return -1
}

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

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

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

func main() {
	defer writer.Flush()
	hsmp := make(map[int]int)
	var n, m, t1 int
	scanf("%d %d\n", &n, &m)
	for i := 0; i < m; i++ {
		scanf("%d", &t1)
		hsmp[t1]++
		if len(hsmp) == n {
			printf("1")
			for j := 1; j <= n; j++ {
				hsmp[j]--
				if hsmp[j] == 0 {
					delete(hsmp, j)
				}
			}
		} else {
			printf("0")
		}
	}
}

package main

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

var in = bufio.NewReaderSize(os.Stdin, 2<<16)

func main() {
	var n, m int
	fmt.Fscan(in, &n, &m)
	cnts := make([]int, n+1)
	bent := make([]int, m+1)
	held := 0
	ans := make([]byte, m)
	for i := range ans {
		var a int
		fmt.Fscan(in, &a)
		cnts[a]++
		bent[cnts[a]]++
		if bent[held+1] == n {
			held++
			ans[i] = '1'
		} else {
			ans[i] = '0'
		}
	}
	fmt.Printf("%s\n", ans)
}

package main

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

func solveSequential(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := uint64(readInt64(scanner))
	m := readInt64(scanner)

	minCount := uint64(0)
	aToCount := make([]uint64, n)

	countToDistinctA := make([]uint64, m+1)
	countToDistinctA[0] = n

	for i := int64(0); i < m; i++ {
		a := readInt64(scanner) - 1

		aCount := aToCount[a]

		countToDistinctA[aCount] -= 1
		if countToDistinctA[aCount] == 0 && minCount == aCount {
			minCount += 1
			writef(writer, "1")
		} else {
			writef(writer, "0")
		}
		aToCount[a] += 1

		countToDistinctA[aCount+1] += 1
	}

	writef(writer, "\n")
}

func main() {
	var scanner *bufio.Scanner
	if len(os.Args) > 1 {
		reader, err := os.Open(os.Args[1])
		if err != nil {
			panic(err)
		}
		defer reader.Close()
		scanner = bufio.NewScanner(reader)
	} else {
		scanner = bufio.NewScanner(os.Stdin)
	}
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 0, 1024*1024), 1024*1024)

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

	solveSequential(scanner, writer)
}

func readInt64(sc *bufio.Scanner) int64 {
	if !sc.Scan() {
		panic("failed to scan next token")
	}

	res, err := strconv.ParseInt(sc.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return res
}

func writef(writer *bufio.Writer, formatStr string, values ...interface{}) {
	out := fmt.Sprintf(formatStr, values...)
	_, err := writer.WriteString(out)
	if err != nil {
		panic(err)
	}
}

package main

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

func main() {
	buf := bufio.NewReader(os.Stdin)
	var n, m int

	fmt.Fscanf(buf, "%d %d\n", &n, &m)
	cnt := make([]int, n+1)
	dp := make([]int, m+1)
	mat := make([]int, m+1)
	var front int = 1
	for i := 0; i < m; i++ {
		fmt.Fscanf(buf, "%d", &mat[i])
	}
	for i := 0; i < m; i++ {
		cnt[mat[i]]++
		dp[cnt[mat[i]]]++
		if dp[front] >= n{
			fmt.Printf("1")
			front++
		}else{
			fmt.Printf("0")
		}
	}
	fmt.Printf("\n")

}
/*
3 8
1 2 1 2 1 3 3 1

2 8
1 2 1 2 1 1 1 1
*/

package main

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

func main() {
	buf := bufio.NewReader(os.Stdin)
	var n, m int

	fmt.Fscanf(buf, "%d %d\n", &n, &m)
	cnt := make([]int, n+1)
	dp := make([]int, m+1)
	mat := make([]int, m+1)
	for i := 0;i <= m;i++{
		dp[i] = n
	}
	var front int = 1
	for i := 0; i < m; i++ {
		fmt.Fscanf(buf, "%d", &mat[i])
	}
	for i := 0; i < m; i++ {
		cnt[mat[i]]++
		dp[cnt[mat[i]]]--
		if dp[front] == 0{
			fmt.Printf("1")
			front++
		}else{
			fmt.Printf("0")
		}
	}
	fmt.Printf("\n")

}

package main

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

var in = bufio.NewReaderSize(os.Stdin, 2<<16)

func main() {
	var n, m int
	fmt.Fscan(in, &n, &m)
	ans := make([]int, n, n+5)
	need := n
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	for i := 0; i < m; i++ {
		var val int
		fmt.Fscan(in, &val)
		val--
		if ans[val] <= 0 {
			need--
		}
		ans[val]++
		if need == 0 {
			fmt.Fprint(out,1)
			need = n
			for j := 0; j < n; j++ {
				ans[j]--
				if ans[j] > 0 {
					need--
				}
			}
		} else {
			fmt.Fprint(out,0)
		}
	}
}

// Codeforces 1100 B Build a Contest comp
package main

import (
	"bufio"
	"fmt"
	"strings"
	"strconv"
	"os"
)
var in *bufio.Reader

func readFive() (int,int,int,int,int) {
	var a [5]int
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("first read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
	for i:=0; i<len(ss); i++ {
		a[i], err = strconv.Atoi(ss[i])
		if err != nil {
			fmt.Println("n atoi failure", err)
			panic(err)
		}
	}
	return a[0],a[1],a[2],a[3],a[4]
}

func readLineNumbs(n int) []int {
	a := make([]int, n)
	delim := byte(' ')
	for i:=0; i<n; i++ {
		if i==(n-1) {
			delim = byte('\n')
		}
		s, err := in.ReadString(delim)
		s = strings.Trim(s, " \n\r")
		if err != nil {
			fmt.Println("read failure", err)
			panic(err)
		}
		aa,err := strconv.Atoi(s)
		if err != nil {
			fmt.Println("aa conv failed", err)
			panic(err)
		}
		a[i] = aa
	}
	return a
}

var n,m int
var a []int
var rounds string

func readData() {
	in = bufio.NewReader(os.Stdin)
	n,m,_,_,_ = readFive()
	a = readLineNumbs(m)
}

func solve() {
	nnz := 0
	cnts := make([]int, n)
	ra := make([]byte, m)
	for i:=0; i<m; i++ {
		ia := a[i]-1
		if cnts[ia]==0 {
			nnz++
		}
		cnts[ia]++
		if nnz == n {
			ra[i] = '1';
			nnz = 0
			for j:=0; j<n; j++ {
				cnts[j]--
				if cnts[j]>0 {
					nnz++
				}
			}
		} else {
			ra[i] = '0'
		}
	}
	rounds = string(ra)
}

func printRes() {
	fmt.Println(rounds)
}

func main() {
	readData()
	solve()
	printRes()
}

package main

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

type CaseInput struct {
	K int64
	Tabs []int64
}

func readCaseInput(scanner *bufio.Scanner) CaseInput {
	size := readInt64(scanner)
	k := readInt64(scanner)
	tabs := make([]int64, size)
	for i := range tabs {
		tabs[i] = readInt64(scanner)
	}
	return CaseInput{k, tabs}
}

type CaseOutput struct {
	MaxDiff int64
}

func writeCaseOutput(writer *bufio.Writer, out CaseOutput) {
	writef(writer, "%d\n", abs64(out.MaxDiff))
}

func solveCase(in CaseInput) CaseOutput {
	diffs := make([]int64, in.K)
	diffsTotal := int64(0)
	for i, t := range in.Tabs {
		diffs[int64(i) % in.K] += t
		diffsTotal += t
	}

	maxDiff := abs64(diffsTotal - diffs[0])
	for b := int64(1); b < in.K; b++ {
		maxDiff = max64(abs64(diffsTotal - diffs[b]), maxDiff)
	}
	return CaseOutput{maxDiff}
}

func solveSequential(scanner *bufio.Scanner, writer *bufio.Writer) {
	writeCaseOutput(writer, solveCase(readCaseInput(scanner)))
}

func main() {
	var scanner *bufio.Scanner
	if len(os.Args) > 1 {
		reader, err := os.Open(os.Args[1])
		if err != nil {
			panic(err)
		}
		defer reader.Close()
		scanner = bufio.NewScanner(reader)
	} else {
		scanner = bufio.NewScanner(os.Stdin)
	}
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 0, 1024*1024), 1024*1024)

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

	solveSequential(scanner, writer)
}

func readInt64(sc *bufio.Scanner) int64 {
	if !sc.Scan() {
		panic("failed to scan next token")
	}

	res, err := strconv.ParseInt(sc.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return res
}

func writef(writer *bufio.Writer, formatStr string, values ...interface{}) {
	out := fmt.Sprintf(formatStr, values...)
	_, err := writer.WriteString(out)
	if err != nil {
		panic(err)
	}
}

func max64(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

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

package main

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

func main() {
	buf := bufio.NewReader(os.Stdin)
	var n, m int

	fmt.Fscanf(buf, "%d %d\n", &n, &m)
	cnt := make([]int, n+1)
	dp := make([]int, m+1)
	mat := make([]int, m+1)
	for i := 0;i <= n;i++{
		dp[i] = n
	}
	var front int = 1
	for i := 0; i < m; i++ {
		fmt.Fscanf(buf, "%d", &mat[i])
	}
	for i := 0; i < m; i++ {
		cnt[mat[i]]++
		dp[cnt[mat[i]]]--
		if dp[front] == 0{
			fmt.Printf("1")
			front++
		}else{
			fmt.Printf("0")
		}
	}
	fmt.Printf("\n")

}
/*

3 8
1 2 1 2 1 3 3 1
*/


package main

import (
	"flag"
	"fmt"
	"io/ioutil"
	"log"
	"os"
	"runtime/pprof"
	"strings"
)

var children [][]*edge
var parents []*edge
var edges []*edge
var in []int
var out []int
var A []int

type relation struct {
	o int
	x int64
	i int
}

type edge struct {
	u int
	v int
	x int64
	i int
}

var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")
var memprofile = flag.String("memprofile", "", "write memory profile to this file")

func main() {
	flag.Parse()
	if *cpuprofile != "" {
		f, err := os.Create(*cpuprofile)
		if err != nil {
			log.Fatal(err)
		}
		pprof.StartCPUProfile(f)
		defer pprof.StopCPUProfile()
	}

	buf := NewBuffer(os.Stdin)
	var n, m int
	buf.ScanInts(&n, &m)
	// fmt.Printf("read %d %d\n", n, m)

	// var relatives [n + 1][]relation
	relatives := make([][]relation, n+1)

	for i := int(1); i <= n-1; i++ {
		var u, v int
		var x int64
		buf.ScanInts(&u, &v)
		buf.ScanInt64s(&x)
		// fmt.Printf("read %d %d %d\n", u, v, x)
		relatives[u] = append(relatives[u], relation{o: v, x: x, i: i})
		relatives[v] = append(relatives[v], relation{o: u, x: x, i: i})
	}

	children = make([][]*edge, n+1)
	parents = make([]*edge, n+1)
	edges = make([]*edge, n)
	enroot(relatives, 1, 0)

	in = make([]int, n+1)
	out = make([]int, n+1)
	t := 1
	dfs(1, &t)
	// fmt.Println(in)
	// fmt.Println(out)
	A = make([]int, n+1)
	for i := 1; i <= n; i++ {
		A[i] = i
	}

	if *memprofile != "" {
		f, err := os.Create(*memprofile)
		if err != nil {
			log.Fatal(err)
		}
		pprof.WriteHeapProfile(f)
		// f.Close()
		// return
	}

	for i := 0; i < m; i++ {
		switch buf.NextInt() {
		case 1:
			var a, b int
			var y int64
			buf.ScanInts(&a, &b)
			buf.ScanInt64s(&y)
			// fmt.Printf("read 1 %d %d %d => %d\n", a, b, y, dist(a, b, y))
			fmt.Println(dist(a, b, y))
		case 2:
			p := buf.NextInt()
			c := buf.NextInt64()
			// fmt.Printf("read 2 %d %d\n", p, c)
			edges[p].x = c

		default:
			panic("BAD INT")
		}
	}
}

func enroot(relatives [][]relation, u int, parent int) {
	for _, r := range relatives[u] {
		if r.o != parent {
			e := edge{u: u, v: r.o, x: r.x, i: r.i}
			// fmt.Printf("read %v\n", e)
			children[e.u] = append(children[e.u], &e)
			parents[e.v] = &e
			edges[e.i] = &e
			enroot(relatives, r.o, u)
		}
	}
}

func dfs(u int, t *int) {
	in[u] = *t
	(*t)++
	for _, e := range children[u] {
		dfs(e.v, t)
	}
	out[u] = *t
}

func dist(a int, b int, y int64) int64 {
	y = distCommonAncestor(a, b, y)
	y = distCommonAncestor(b, a, y)
	return y
}

func distCommonAncestor(a int, b int, y int64) int64 {
	for y > 0 && !ancestor(a, b) {
		y /= parents[a].x
		a = parent(a)
	}
	return y
}

func ancestor(a int, b int) bool {
	return in[a] <= in[b] && out[b] <= out[a]
}

func parent(a int) int {
	e := parents[a]
	if e.x == 1 {
		f := edges[find(e.i)]
		for parents[f.u] != nil && parents[f.u].x == 1 {
			union(e.i, parents[f.u].i)
			f = edges[find(e.i)]
		}
		return edges[find(e.i)].u
	}
	return parents[a].u
}

func find(u int) int {
	if A[u] == u {
		return u
	}
	A[u] = find(A[u])
	return A[u]
}

func union(u int, v int) {
	A[find(u)] = find(v)
}

/////////////////////////////////////////////////////
// FUCKING GO                                      //
// SCANF IS FAST ENOUGH FOR C/C++, BUT NOOOO,      //
// GO'S SHITTY IMPLEMENTATION TIMES OUT            //
// SO I HAVE TO WRITE MY OWN FUCKING SCANNER, FUCK //
/////////////////////////////////////////////////////

type Buffer struct {
	words []string
	i     int
}

func NewBuffer(f *os.File) *Buffer {
	bytes, err := ioutil.ReadAll(os.Stdin)
	if err != nil {
		panic(err.Error())
	}
	s := string(bytes)
	s = strings.Replace(s, "\r", "", -1)
	s = strings.Replace(s, "\n", " ", -1)
	return &Buffer{
		words: strings.Split(s, " "),
		i:     0,
	}
}

func (b *Buffer) NextInt() int {
	x := 0
	for _, c := range b.words[b.i] {
		x = x*10 + int(c-'0')
	}
	b.i++
	return x
}

func (b *Buffer) ScanInts(ps ...*int) {
	for _, p := range ps {
		*p = b.NextInt()
	}
}

func (b *Buffer) NextInt64() int64 {
	x := int64(0)
	for _, c := range b.words[b.i] {
		x = x*10 + int64(c-'0')
	}
	b.i++
	return x
	// x, err := strconv.Atoi(b.words[b.i])
	// if err == nil {
	// 	b.i++
	// 	return int64(x)
	// }
	// var y int64
	// fmt.Sscanf(b.words[b.i], "%d", &y)
	// b.i++
	// return y
}

func (b *Buffer) ScanInt64s(ps ...*int64) {
	for _, p := range ps {
		*p = b.NextInt64()
	}
}

package main

import (
	"bufio"
	"flag"
	"fmt"
	"io/ioutil"
	"log"
	"os"
	"runtime/pprof"
	"strings"
)

var children [][]*edge
var parents []*edge
var edges []*edge
var in []int
var out []int
var A []int

type relation struct {
	o int
	x int64
	i int
}

type edge struct {
	u int
	v int
	x int64
	i int
}

var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")

func main() {
	flag.Parse()
	if *cpuprofile != "" {
		f, err := os.Create(*cpuprofile)
		if err != nil {
			log.Fatal(err)
		}
		pprof.StartCPUProfile(f)
		defer pprof.StopCPUProfile()
	}

	buf := bufio.NewReader(os.Stdin)

	var n, m int
	fmt.Fscanf(buf, "%d %d\r\n", &n, &m)
	// fmt.Printf("read %d %d\n", n, m)

	// var relatives [n + 1][]relation
	relatives := make([][]relation, n+1)

	for i := int(1); i <= n-1; i++ {
		var u, v int
		var x int64
		fmt.Fscanf(buf, "%d %d %d\r\n", &u, &v, &x)
		// fmt.Printf("read %d %d %d\n", u, v, x)
		relatives[u] = append(relatives[u], relation{o: v, x: x, i: i})
		relatives[v] = append(relatives[v], relation{o: u, x: x, i: i})
	}

	children = make([][]*edge, n+1)
	parents = make([]*edge, n+1)
	edges = make([]*edge, n)
	enroot(relatives, 1, 0)

	in = make([]int, n+1)
	out = make([]int, n+1)
	t := 1
	dfs(1, &t)
	// fmt.Println(in)
	// fmt.Println(out)
	A = make([]int, n+1)
	for i := 1; i <= n; i++ {
		A[i] = i
	}

	for i := 0; i < m; i++ {
		var op int
		fmt.Fscanf(buf, "%d", &op)
		switch op {
		case 1:
			var a, b int
			var y int64
			fmt.Fscanf(buf, "%d %d %d\r\n", &a, &b, &y)
			// fmt.Printf("read 1 %d %d %d => %d\n", a, b, y, dist(a, b, y))
			fmt.Println(dist(a, b, y))
		case 2:
			var p int
			var c int64
			fmt.Fscanf(buf, "%d %d\r\n", &p, &c)
			// fmt.Printf("read 2 %d %d\n", p, c)
			edges[p].x = c

		default:
			panic("BAD INT")
		}
	}
}

func enroot(relatives [][]relation, u int, parent int) {
	for _, r := range relatives[u] {
		if r.o != parent {
			e := edge{u: u, v: r.o, x: r.x, i: r.i}
			// fmt.Printf("read %v\n", e)
			children[e.u] = append(children[e.u], &e)
			parents[e.v] = &e
			edges[e.i] = &e
			enroot(relatives, r.o, u)
		}
	}
}

func dfs(u int, t *int) {
	in[u] = *t
	(*t)++
	for _, e := range children[u] {
		dfs(e.v, t)
	}
	out[u] = *t
}

func dist(a int, b int, y int64) int64 {
	y = distCommonAncestor(a, b, y)
	y = distCommonAncestor(b, a, y)
	return y
}

func distCommonAncestor(a int, b int, y int64) int64 {
	for y > 0 && !ancestor(a, b) {
		y /= parents[a].x
		a = parent(a)
	}
	return y
}

func ancestor(a int, b int) bool {
	return in[a] <= in[b] && out[b] <= out[a]
}

func parent(a int) int {
	e := parents[a]
	if e.x == 1 {
		f := edges[find(e.i)]
		for parents[f.u] != nil && parents[f.u].x == 1 {
			union(e.i, parents[f.u].i)
			f = edges[find(e.i)]
		}
		return edges[find(e.i)].u
	}
	return parents[a].u
}

func find(u int) int {
	if A[u] == u {
		return u
	}
	A[u] = find(A[u])
	return A[u]
}

func union(u int, v int) {
	A[find(u)] = find(v)
}

/////////////////////////////////////////////////////
// FUCKING GO                                      //
// SCANF IS FAST ENOUGH FOR C/C++, BUT NOOOO,      //
// GO'S SHITTY IMPLEMENTATION TIMES OUT            //
// SO I HAVE TO WRITE MY OWN FUCKING SCANNER, FUCK //
/////////////////////////////////////////////////////

type Buffer struct {
	words []string
	i     int
}

func NewBuffer(f *os.File) *Buffer {
	bytes, err := ioutil.ReadAll(os.Stdin)
	if err != nil {
		panic(err.Error())
	}
	s := string(bytes)
	s = strings.Replace(s, "\r", "", -1)
	s = strings.Replace(s, "\n", " ", -1)
	return &Buffer{
		words: strings.Split(s, " "),
		i:     0,
	}
}

func (b *Buffer) NextInt() int {
	x := 0
	for _, c := range b.words[b.i] {
		x = x*10 + int(c-'0')
	}
	b.i++
	return x
}

func (b *Buffer) ScanInts(ps ...*int) {
	for _, p := range ps {
		*p = b.NextInt()
	}
}

func (b *Buffer) NextInt64() int64 {
	x := int64(0)
	for _, c := range b.words[b.i] {
		x = x*10 + int64(c-'0')
	}
	b.i++
	return x
	// x, err := strconv.Atoi(b.words[b.i])
	// if err == nil {
	// 	b.i++
	// 	return int64(x)
	// }
	// var y int64
	// fmt.Sscanf(b.words[b.i], "%d", &y)
	// b.i++
	// return y
}

func (b *Buffer) ScanInt64s(ps ...*int64) {
	for _, p := range ps {
		*p = b.NextInt64()
	}
}

package main

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

var children [][]*edge
var parents []*edge
var edges []*edge
var in []int
var out []int
var A []int

type relation struct {
	o int
	x int64
	i int
}

type edge struct {
	u int
	v int
	x int64
	i int
}

func main() {

	buf := bufio.NewReader(os.Stdin)

	var n, m int
	fmt.Fscanf(buf, "%d %d\r\n", &n, &m)
	// fmt.Printf("read %d %d\n", n, m)

	relatives := make([][]relation, n+1)

	for i := int(1); i <= n-1; i++ {
		var u, v int
		var x int64
		fmt.Fscanf(buf, "%d %d %d\r\n", &u, &v, &x)
		// fmt.Printf("read %d %d %d\n", u, v, x)
		relatives[u] = append(relatives[u], relation{o: v, x: x, i: i})
		relatives[v] = append(relatives[v], relation{o: u, x: x, i: i})
	}

	children = make([][]*edge, n+1)
	parents = make([]*edge, n+1)
	edges = make([]*edge, n)
	enroot(relatives, 1, 0)

	in = make([]int, n+1)
	out = make([]int, n+1)
	t := 1
	dfs(1, &t)
	// fmt.Println(in)
	// fmt.Println(out)
	A = make([]int, n+1)
	for i := 1; i <= n; i++ {
		A[i] = i
	}

	for i := 0; i < m; i++ {
		var op int
		fmt.Fscanf(buf, "%d", &op)
		switch op {
		case 1:
			var a, b int
			var y int64
			fmt.Fscanf(buf, "%d %d %d\r\n", &a, &b, &y)
			// fmt.Printf("read 1 %d %d %d => %d\n", a, b, y, dist(a, b, y))
			fmt.Println(dist(a, b, y))
		case 2:
			var p int
			var c int64
			fmt.Fscanf(buf, "%d %d\r\n", &p, &c)
			// fmt.Printf("read 2 %d %d\n", p, c)
			edges[p].x = c

		default:
			panic("BAD INT")
		}
	}
}

func enroot(relatives [][]relation, u int, parent int) {
	for _, r := range relatives[u] {
		if r.o != parent {
			e := edge{u: u, v: r.o, x: r.x, i: r.i}
			// fmt.Printf("read %v\n", e)
			children[e.u] = append(children[e.u], &e)
			parents[e.v] = &e
			edges[e.i] = &e
			enroot(relatives, r.o, u)
		}
	}
}

func dfs(u int, t *int) {
	in[u] = *t
	(*t)++
	for _, e := range children[u] {
		dfs(e.v, t)
	}
	out[u] = *t
}

func dist(a int, b int, y int64) int64 {
	y = distCommonAncestor(a, b, y)
	y = distCommonAncestor(b, a, y)
	return y
}

func distCommonAncestor(a int, b int, y int64) int64 {
	for y > 0 && !ancestor(a, b) {
		y /= parents[a].x
		a = parent(a)
	}
	return y
}

func ancestor(a int, b int) bool {
	return in[a] <= in[b] && out[b] <= out[a]
}

func parent(a int) int {
	e := parents[a]
	if e.x == 1 {
		f := edges[find(e.i)]
		for parents[f.u] != nil && parents[f.u].x == 1 {
			union(e.i, parents[f.u].i)
			f = edges[find(e.i)]
		}
		return edges[find(e.i)].u
	}
	return parents[a].u
}

func find(u int) int {
	if A[u] == u {
		return u
	}
	A[u] = find(A[u])
	return A[u]
}

func union(u int, v int) {
	A[find(u)] = find(v)
}

package main

/*
LESSONS

- use bufio (2x faster than fmt.Scanf)
- if bufio isn't enough, use ./buffer.go (3x faster than bufio)
- use arrays, not maps (3x faster than maps)
*/

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

var children [][]*edge
var parents []*edge
var edges []*edge
var in []int
var out []int
var A []int

type relation struct {
	o int
	x int64
	i int
}

type edge struct {
	u int
	v int
	x int64
	i int
}

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

	var n, m int
	fmt.Fscanf(buf, "%d %d\r\n", &n, &m)
	// fmt.Printf("read %d %d\n", n, m)

	relatives := make([][]relation, n+1)

	for i := 1; i <= n-1; i++ {
		var u, v int
		var x int64
		fmt.Fscanf(buf, "%d %d %d\r\n", &u, &v, &x)
		// fmt.Printf("read %d %d %d\n", u, v, x)
		relatives[u] = append(relatives[u], relation{o: v, x: x, i: i})
		relatives[v] = append(relatives[v], relation{o: u, x: x, i: i})
	}

	children = make([][]*edge, n+1)
	parents = make([]*edge, n+1)
	edges = make([]*edge, n)
	enroot(relatives, 1, 0)

	in = make([]int, n+1)
	out = make([]int, n+1)
	t := 1
	dfs(1, &t)
	// fmt.Println(in)
	// fmt.Println(out)
	A = make([]int, n+1)
	for i := 1; i <= n; i++ {
		A[i] = i
	}

	for i := 0; i < m; i++ {
		var op int
		fmt.Fscanf(buf, "%d", &op)
		switch op {
		case 1:
			var a, b int
			var y int64
			fmt.Fscanf(buf, "%d %d %d\r\n", &a, &b, &y)
			// fmt.Printf("read 1 %d %d %d => %d\n", a, b, y, dist(a, b, y))
			fmt.Println(dist(a, b, y))
		case 2:
			var p int
			var c int64
			fmt.Fscanf(buf, "%d %d\r\n", &p, &c)
			// fmt.Printf("read 2 %d %d\n", p, c)
			edges[p].x = c

		default:
			panic("BAD INT")
		}
	}
}

func enroot(relatives [][]relation, u int, parent int) {
	for _, r := range relatives[u] {
		if r.o != parent {
			e := edge{u: u, v: r.o, x: r.x, i: r.i}
			// fmt.Printf("read %v\n", e)
			children[e.u] = append(children[e.u], &e)
			parents[e.v] = &e
			edges[e.i] = &e
			enroot(relatives, r.o, u)
		}
	}
}

func dfs(u int, t *int) {
	in[u] = *t
	(*t)++
	for _, e := range children[u] {
		dfs(e.v, t)
	}
	out[u] = *t
}

func dist(a int, b int, y int64) int64 {
	y = distCommonAncestor(a, b, y)
	y = distCommonAncestor(b, a, y)
	return y
}

func distCommonAncestor(a int, b int, y int64) int64 {
	for y > 0 && !ancestor(a, b) {
		y /= parents[a].x
		a = parent(a)
	}
	return y
}

func ancestor(a int, b int) bool {
	return in[a] <= in[b] && out[b] <= out[a]
}

func parent(a int) int {
	e := parents[a]
	if e.x == 1 {
		f := edges[find(e.i)]
		for parents[f.u] != nil && parents[f.u].x == 1 {
			union(e.i, parents[f.u].i)
			f = edges[find(e.i)]
		}
		return edges[find(e.i)].u
	}
	return parents[a].u
}

func find(u int) int {
	if A[u] == u {
		return u
	}
	A[u] = find(A[u])
	return A[u]
}

func union(u int, v int) {
	A[find(u)] = find(v)
}

package main

import (
	"fmt"
)

var children map[int][]*edge
var parents map[int]*edge
var edges map[int]*edge
var in map[int]int
var out map[int]int
var A map[int]int

func main() {
	var n, m int
	fmt.Scanf("%d %d\r\n", &n, &m)
	// fmt.Printf("read %d %d\n", n, m)
	children = make(map[int][]*edge)
	parents = make(map[int]*edge)
	edges = make(map[int]*edge)
	for i := 1; i <= n-1; i++ {
		var e edge
		e.i = i
		fmt.Scanf("%d %d %d\r\n", &e.u, &e.v, &e.x)
		// fmt.Printf("read %v\n", e)
		children[e.u] = append(children[e.u], &e)
		parents[e.v] = &e
		edges[i] = &e
	}

	in = make(map[int]int)
	out = make(map[int]int)
	t := 1
	dfs(1, &t)
	// fmt.Println(in)
	// fmt.Println(out)
	A = make(map[int]int)
	for i := 1; i <= n; i++ {
		A[i] = i
	}

	for i := 0; i < m; i++ {
		var a, b, y int
		scanned, _ := fmt.Scanf("1 %d %d %d\r\n", &a, &b, &y)
		if scanned > 0 {
			// fmt.Printf("read 1 %d %d %d => %d\n", a, b, y, dist(a, b, y))
			fmt.Println(dist(a, b, y))
		} else {
			var p, c int
			fmt.Scanf("%d %d\r\n", &p, &c)
			// fmt.Printf("read 2 %d %d\n", p, c)
			edges[p].x = c
		}
	}
}

type edge struct {
	u int
	v int
	x int
	i int
}

func dfs(u int, t *int) {
	in[u] = *t
	(*t)++
	for _, e := range children[u] {
		dfs(e.v, t)
	}
	out[u] = *t
}

func dist(a int, b int, y int) int {
	y = distCommonAncestor(a, b, y)
	y = distCommonAncestor(b, a, y)
	return y
}

func distCommonAncestor(a int, b int, y int) int {
	for y > 0 && !ancestor(a, b) {
		y /= parents[a].x
		a = parent(a)
	}
	return y
}

func ancestor(a int, b int) bool {
	return in[a] <= in[b] && out[b] <= out[a]
}

func parent(a int) int {
	e := parents[a]
	if e.x == 1 {
		f := edges[find(e.i)]
		for parents[f.u] != nil && parents[f.u].x == 1 {
			f = parents[f.u]
			union(e.i, f.i)
		}
		return edges[find(e.i)].u
	}
	return parents[a].u
}

func find(u int) int {
	if A[u] == u {
		return u
	}
	A[u] = find(A[u])
	return A[u]
}

func union(u int, v int) {
	A[find(u)] = find(v)
}

package main

import (
	"fmt"
)

func main() {
	var n, m int
	fmt.Scanf("%d %d", &n, &m)
	for i := 1; i <= m; i++ {
		fmt.Println(1337)
	}
}


package main

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

// import "math/rand"

var bufin *bufio.Reader
var bufout *bufio.Writer

func can(a []int, n int) bool {
	sort.Ints(a)
	cnt := 0
	for i := 1; i < n; i++ {
		if a[i] > a[cnt] {
			cnt++
			a[cnt] = a[i]
		}
	}

	n = cnt + 1

	if n > 3 {
		return false
	}

	if n <= 2 {
		return true
	}

	return a[1]-a[0] == a[2]-a[1]
}

func good(a []int, n int, x int) bool {
	k := -1
	for i := 0; i < n; i++ {
		d := a[i] - x
		if d < 0 {
			d = -d
		}
		if d != 0 {
			if k == -1 {
				k = d
			} else if k != d {
				return false
			}
		}
	}
	return true
}

func brute(a []int, n int) bool {
	for x := 0; x <= 10; x++ {
		if good(a, n, x) {
			return true
		}
	}
	return false
}

func main() {
	bufin = bufio.NewReader(os.Stdin)
	bufout = bufio.NewWriter(os.Stdout)
	defer bufout.Flush()

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

	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(bufin, "%d\n", &a[i])
	}

	if can(a, n) {
		fmt.Fprintf(bufout, "YES\n")
	} else {
		fmt.Fprintf(bufout, "NO\n")
	}

	// for test := 0; test <= 1000; test++ {
	// 	n := 6
	// 	m := 5
	// 	a := make([]int, n)
	// 	fmt.Fprintf(bufout, "%d\n", n)
	// 	for i := 0; i < n; i++ {
	// 		a[i] = rand.Int() % m
	// 		fmt.Fprintf(bufout, "%d ", a[i])
	// 	}
	// 	fmt.Fprintf(bufout, "\n")
	//
	// 	wanted := brute(a, n)
	// 	got := can(a, n)
	//
	// 	if wanted != got {
	// 		fmt.Fprintf(bufout, ">> WA!!! wanted %v, got %v\n", wanted, got)
	// 		break
	// 	} else {
	// 		fmt.Fprintf(bufout, ">> AC.\n")
	// 	}
	// }
}

package main

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

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, "\n") == nil {
		solve(n)
	}
}

func solve(n int) {
	var a, b, q int
	I(&a, " ")
	var c string
	for i := 1; i < n; i++ {
		o := " "
		if i == n-1 {
			o = "\n"
		}
		I(&b, o)
		t := abs(a - b)
		if q < 4 && t != 0 && !strings.Contains(c, "~"+strconv.Itoa(t)) {
			c += "~" + strconv.Itoa(t)
			q++
		}
	}
	var oo []string
	if len(c) > 0 {
		oo = strings.Split(c[1:], "~")
	}
	if len(oo) > 2 {
		O("NO", "\n")
		return
	}
	if len(oo) == 2 {
		x, _ := strconv.Atoi(oo[0])
		y, _ := strconv.Atoi(oo[1])
		if x*2 != y && y*2 != x {
			O("NO", "\n")
			return
		}
	}
	O("YES", "\n")
}

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

package main

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

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

	v := make([]int, 3)
	vi := 0
	overflow := false

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	for i := 0; i < n && scanner.Scan(); i++ {
		a, err := strconv.Atoi(scanner.Text())
		if err != nil {
			return
		}

		if overflow {
			continue
		}

		exist := false
		for j := 0; j < vi && j < 3; j++ {
			if v[j] == a {
				exist = true
			}
		}

		if !exist {
			if vi < 3 {
				v[vi] = a
				vi++
			} else {
				overflow = true
			}
		}
	}

	if overflow {
		fmt.Println("NO")
	} else if vi < 3 {
		fmt.Println("YES")
	} else {
		sum := int64(v[0]) + int64(v[1]) + int64(v[2])
		if sum%3 != 0 {
			fmt.Println("NO")
		} else {
			avg := sum / 3
			for i := 0; i < 3; i++ {
				if avg == int64(v[i]) {
					fmt.Println("YES")
					return
				}
			}
			fmt.Println("NO")
		}
	}
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	text, _ := reader.ReadString('\n')
	text = strings.TrimRight(text, "\r\n")
	s := strings.Split(text, " ")

	c, _ := strconv.Atoi(s[0])

	z := []int{}
	text, _ = reader.ReadString('\n')
	text = strings.TrimRight(text, "\r\n")
	s = strings.Split(text, " ")
	for i := 0; i < c; i++ {
		x, _ := strconv.Atoi(s[i])
		found := false
		for _, v := range z {
			if x == v {
				found = true
				break
			}
		}
		if found == false {
			z = append(z, x)
		}
		if len(z) > 3 {
			fmt.Println("NO")
			return
		}
	}
	if len(z) == 3 {
		sort.Ints(z)
		if (z[1] - z[0]) != (z[2] - z[1]) {
			fmt.Println("NO")
			return
		}
	}
	fmt.Println("YES")
}

package main

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

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, "\n") == nil {
		solve(n)
	}
}

func solve(n int) {
	var a, b, q int
	I(&a, " ")
	var c string
	for i := 1; i < n; i++ {
		o := " "
		if i == n-1 {
			o = "\n"
		}
		I(&b, o)
		t := abs(a - b)
		if t != 0 && !strings.Contains(c, "~"+strconv.Itoa(t)) {
			c += "~" + strconv.Itoa(t)
			q++
			if q > 2 {
				break
			}
		}
	}
	var oo []string
	if len(c) > 0 {
		oo = strings.Split(c[1:], "~")
	}
	if len(oo) > 2 {
		O("NO", "\n")
		return
	}
	if len(oo) == 2 {
		x, _ := strconv.Atoi(oo[0])
		y, _ := strconv.Atoi(oo[1])
		if x*2 != y && y*2 != x {
			O("NO", "\n")
			return
		}
	}
	O("YES", "\n")
}

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

package main

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

func can(a []int, n int) bool {
	sort.Ints(a)
	cnt := 0
	for i := 1; i < n; i++ {
		if a[i] > a[cnt] {
			cnt++
			a[cnt] = a[i]
		}
	}

	n = cnt + 1
	if n > 3 {
		return false
	}

	if n == 1 {
		return true
	}

	if n == 2 {
		return (a[1]-a[0])%2 == 0
	}

	return a[1]-a[0] == a[2]-a[1]
}

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

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

	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(bufin, "%d\n", &a[i])
	}

	if can(a, n) {
		fmt.Fprintf(bufout, "YES\n")
	} else {
		fmt.Fprintf(bufout, "NO\n")
	}
}

package main

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

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

	v := make([]int, 3)
	vi := 0
	overflow := false

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	for i := 0; i < n && scanner.Scan(); i++ {
		a, err := strconv.Atoi(scanner.Text())
		if err != nil {
			return
		}

		if overflow {
			continue
		}

		exist := false
		for j := 0; j < vi && j < 3; j++ {
			if v[j] == a {
				exist = true
			}
		}

		if !exist {
			if vi < 3 {
				v[vi] = a
				vi++
			} else {
				overflow = true
			}
		}
	}

	if overflow {
		fmt.Println("NO")
	} else if vi < 3 {
		fmt.Println("YES")
	} else {
		sum := float64(v[0]+v[1]+v[2]) / 3
		for i := 0; i < 3; i++ {
			if sum == float64(v[i]) {
				fmt.Println("YES")
				return
			}
		}
		fmt.Println("NO")
	}
}

package main

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

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

	v := make([]int, 3)
	vi := 0
	overflow := false

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	for i := 0; i < n && scanner.Scan(); i++ {
		a, err := strconv.Atoi(scanner.Text())
		if err != nil {
			return
		}

		if overflow {
			continue
		}

		exist := false
		for j := 0; j < vi && j < 3; j++ {
			if v[j] == a {
				exist = true
			}
		}

		if !exist {
			if vi < 3 {
				v[vi] = a
				vi++
			} else {
				overflow = true
			}
		}
	}

	if overflow || vi == 2 {
		fmt.Println("NO")
	} else if vi == 1 {
		fmt.Println("YES")
	} else {
		sum := float32(v[0]+v[1]+v[2]) / 3
		for i := 0; i < 3; i++ {
			if sum == float32(v[i]) {
				fmt.Println("YES")
				return
			}
		}
		fmt.Println("NO")
	}
}

package main

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

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

	v := make([]int, 3)
	vi := 0
	overflow := false

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	for i := 0; i < n && scanner.Scan(); i++ {
		a, err := strconv.Atoi(scanner.Text())
		if err != nil {
			return
		}

		if overflow {
			continue
		}

		exist := false
		for j := 0; j < vi && j < 3; j++ {
			if v[j] == a {
				exist = true
			}
		}

		if !exist {
			if vi < 3 {
				v[vi] = a
				vi++
			} else {
				overflow = true
			}
		}
	}

	if overflow {
		fmt.Println("NO")
	} else if vi < 3 {
		fmt.Println("YES")
	} else {
		sum := float32(v[0]+v[1]+v[2]) / 3
		for i := 0; i < 3; i++ {
			if sum == float32(v[i]) {
				fmt.Println("YES")
				return
			}
		}
		fmt.Println("NO")
	}
}


package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	n := 0
	fmt.Fscanf(in, "%d\n", &n)
	a := make([]int, n)
	haveOdd := false
	haveEven := false
	for i := 0; i < n; i++ {
		fmt.Fscanf(in, "%d", &a[i])
		if a[i]%2 == 0 {
			haveEven = true
		} else {
			haveOdd = true
		}
	}
	fmt.Fscanf(in, "\n")
	if haveEven && haveOdd {
		sort.Ints(a)
	}
	for i := 0; i < n-1; i++ {
		fmt.Fprintf(out, "%d ", a[i])
	}
	fmt.Fprintf(out, "%d\n", a[n-1])

	return
}
func minstep(a, b byte) int {
	return min(int(a-b+26)%26, int(b-a+26)%26)
}

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

package main

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

func main()  {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var n,x  int
	fmt.Fscan(in,&n)
	a := make([]int,0)
	// 1 2 6 4
	var odd,even = 0,0
	for i := 0; i < n ;i ++{
		fmt.Fscan(in,&x)
		a = append(a,x)
		if(x  % 2 == 0){
			even ++
		}else{
				odd ++
		}
	}
	if(odd >= 1 && even >= 1){
		sort.Ints(a)
	}
	for i := 0 ; i < n; i++{
		fmt.Fprint(out,a[i]," ")
	}

}

// Author: sighduck
// URL: https://codeforces.com/contest/1174/problem/B

package main

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

func Solve(n int, a []int) []int {
	even := 0
	odd := 0
	for _, elem := range a {
		if elem%2 == 0 {
			even += 1
		} else {
			odd += 1
		}
	}
	if even == n || odd == n {
		return a
	}
	sort.Ints(a)
	return a
}

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

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

	solution := Solve(n, a)
	for _, elem := range solution {
		fmt.Fprintf(writer, "%d ", elem)
	}
	fmt.Fprintf(writer, "\n")
}