← Home
```go
package main

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

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

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

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

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

		sorted := make([]int, n)
		copy(sorted, a)
		sort.Ints(sorted)

		// We want to maximize sadness (minimum swaps to transform b into a)
		// The minimum number of swaps = n - (number of cycles in the permutation mapping b to a)
		// To maximize swaps, we want to minimize cycles, i.e., maximize cycle length
		// 
		// Strategy: assign values such that b[i] != a[i] as much as possible
		// The optimal approach: sort a, then shift by n/2 positions
		
		b := make([]int, n)
		half := n / 2
		for i := 0; i < n; i++ {
			b[i] = sorted[(i+half)%n]
		}

		for i := 0; i < n; i++ {
			if i > 0 {
				fmt.Fprint(writer, " ")
			}
			fmt.Fprint(writer, b[i])
		}
		fmt.Fprintln(writer)
	}
}
```