package main

import (
	"fmt"
	"sort"
	"strings"
)
var (
	_firstCharStr = "a"
)

func main()  {
	var testCase int32
	fmt.Scanf("%d\n", &testCase)

	for ix := int32(0); ix < testCase; ix ++ {
		solve()
	}

}

func solve() {
	var inp string
	var len int32
	fmt.Scanf("%d\n", &len)
	fmt.Scanf("%s\n", &inp)

	allSubStr := getAllSubString(inp)
	//fmt.Println("allSubStr", allSubStr)
	var prevStr string
	for _, subStr := range allSubStr {
		if subStr == prevStr {
			continue
		}

		nextStr := getNextString(prevStr)
		//fmt.Println("getNextString", nextStr)
		if !strings.EqualFold(nextStr, subStr) {
			fmt.Println(nextStr)
			return
		}

		prevStr = subStr
	}

	fmt.Println("b")
}

func getNextString(inp string) string {
	if len(inp) == 0 {
		return _firstCharStr
	}

	var result string
	var carry uint8 = 1
	for ix := len(inp) - 1; ix >= 0; ix-- {
		currentChar := inp[ix] - _firstCharStr[0]
		modifiedChar := (currentChar + carry) % 26
		carry = (currentChar + carry) / 26
		result = string(modifiedChar + _firstCharStr[0]) + result
	}

	if carry == 1 {
		result = _firstCharStr + result
	}

	return result
}

func getAllSubString(inp string) []string {
	inpArr := strings.Split(inp, "")
	result := make([]string, 0)

	for left := 0 ;left < len(inpArr); left++ {
		var sb strings.Builder
		for right := left; right < len(inp); right++ {
			sb.WriteString(inpArr[right])
			result = append(result, sb.String())
		}
	}

	// Sort by len first and then with alphabets
	sort.SliceStable(result, func(i , j int) bool {
		if len(result[i]) != len(result[j]) {
			return len(result[i]) < len(result[j])
		}
		return result[i] < result[j]
	})

	return result
}

package main

/*
  Question: https://codeforces.com/contest/1536/problem/B
 */

import (
	"fmt"
	"sort"
	"strings"
)
var (
	_firstCharStr = "a"
)

func main()  {
	var testCase int32
	fmt.Scanf("%d\n", &testCase)

	for ix := int32(0); ix < testCase; ix ++ {
		solve()
	}

}

func solve() {
	var inp string
	var len int32
	fmt.Scanf("%d\n", &len)
	fmt.Scanf("%s\n", &inp)

	allSubStr := getAllSubString(inp)
	var prevStr string
	for _, subStr := range allSubStr {
		if subStr == prevStr {
			continue
		}

		nextStr := getNextString(prevStr)
		if nextStr != subStr {
			fmt.Println(nextStr)
			return
		}

		prevStr = subStr
	}

	fmt.Println("b")
}

func getNextString(inp string) string {
	if len(inp) == 0 {
		return _firstCharStr
	}

	//var result string
	var sb strings.Builder
	var carry uint8 = 1
	for ix := len(inp) - 1; ix >= 0; ix-- {
		currentChar := inp[ix] - _firstCharStr[0]
		modifiedChar := (currentChar + carry) % 26
		carry = (currentChar + carry) / 26
		sb.WriteString(string(modifiedChar + _firstCharStr[0]))
		//result += string(modifiedChar + _firstCharStr[0])
	}

	if carry == 1 {
		sb.WriteString(_firstCharStr)
		//result += _firstCharStr
	}

	return reverse(sb.String())
}

func getAllSubString(inp string) []string {
	inpArr := strings.Split(inp, "")
	result := make([]string, 0)

	for left := 0 ;left < len(inpArr); left++ {
		var sb strings.Builder
		for right := left; right < len(inp); right++ {
			sb.WriteString(inpArr[right])
			result = append(result, sb.String())
		}
	}

	// Sort by len first and then with alphabets
	sort.SliceStable(result, func(i , j int) bool {
		if len(result[i]) != len(result[j]) {
			return len(result[i]) < len(result[j])
		}
		return result[i] < result[j]
	})

	return result
}

func reverse(s string) string {
	n := len(s)
	runes := make([]rune, n)
	for _, rune := range s {
		n--
		runes[n] = rune
	}
	return string(runes[n:])
}

package main

/*
  Question: https://codeforces.com/contest/1536/problem/B
 */

import (
	"fmt"
	"sort"
	"strings"
)
var (
	_firstCharStr = "a"
)

func main()  {
	var testCase int32
	fmt.Scanf("%d\n", &testCase)

	for ix := int32(0); ix < testCase; ix ++ {
		solve()
	}

}

func solve() {
	var inp string
	var len int32
	fmt.Scanf("%d\n", &len)
	fmt.Scanf("%s\n", &inp)

	allSubStr := getAllSubString(inp)
	var prevStr string
	for _, subStr := range allSubStr {
		if subStr == prevStr {
			continue
		}

		nextStr := getNextString(prevStr)
		if nextStr != subStr {
			fmt.Println(nextStr)
			return
		}

		prevStr = subStr
	}

	fmt.Println("b")
}

func getNextString(inp string) string {
	if len(inp) == 0 {
		return _firstCharStr
	}

	var result string
	var carry uint8 = 1
	for ix := len(inp) - 1; ix >= 0; ix-- {
		currentChar := inp[ix] - _firstCharStr[0]
		modifiedChar := (currentChar + carry) % 26
		carry = (currentChar + carry) / 26
		result += string(modifiedChar + _firstCharStr[0])
	}

	if carry == 1 {
		result += _firstCharStr
	}

	return reverse(result)
}

func getAllSubString(inp string) []string {
	inpArr := strings.Split(inp, "")
	result := make([]string, 0)

	for left := 0 ;left < len(inpArr); left++ {
		var sb strings.Builder
		for right := left; right < len(inp); right++ {
			sb.WriteString(inpArr[right])
			result = append(result, sb.String())
		}
	}

	// Sort by len first and then with alphabets
	sort.SliceStable(result, func(i , j int) bool {
		if len(result[i]) != len(result[j]) {
			return len(result[i]) < len(result[j])
		}
		return result[i] < result[j]
	})

	return result
}

func reverse(s string) string {
	n := len(s)
	runes := make([]rune, n)
	for _, rune := range s {
		n--
		runes[n] = rune
	}
	return string(runes[n:])
}

package main

/*
  Question: https://codeforces.com/contest/1536/problem/B
 */

import (
	"fmt"
	"sort"
	"strings"
)
var (
	_firstCharStr = "a"
)

func main()  {
	var testCase int32
	fmt.Scanf("%d\n", &testCase)

	for ix := int32(0); ix < testCase; ix ++ {
		solve()
	}

}

func solve() {
	var inp string
	var len int32
	fmt.Scanf("%d\n", &len)
	fmt.Scanf("%s\n", &inp)

	allSubStr := getAllSubString(inp)
	var prevStr string
	for _, subStr := range allSubStr {
		if subStr == prevStr {
			continue
		}

		nextStr := getNextString(prevStr)
		if nextStr != subStr {
			fmt.Println(nextStr)
			return
		}

		prevStr = subStr
	}

	fmt.Println("b")
}

func getNextString(inp string) string {
	if len(inp) == 0 {
		return _firstCharStr
	}

	var result string
	var carry uint8 = 1
	for ix := len(inp) - 1; ix >= 0; ix-- {
		currentChar := inp[ix] - _firstCharStr[0]
		modifiedChar := (currentChar + carry) % 26
		carry = (currentChar + carry) / 26
		result = string(modifiedChar + _firstCharStr[0]) + result
	}

	if carry == 1 {
		result = _firstCharStr + result
	}

	return result
}

func getAllSubString(inp string) []string {
	inpArr := strings.Split(inp, "")
	result := make([]string, 0)

	for left := 0 ;left < len(inpArr); left++ {
		var sb strings.Builder
		for right := left; right < len(inp); right++ {
			sb.WriteString(inpArr[right])
			result = append(result, sb.String())
		}
	}

	// Sort by len first and then with alphabets
	sort.SliceStable(result, func(i , j int) bool {
		if len(result[i]) != len(result[j]) {
			return len(result[i]) < len(result[j])
		}
		return result[i] < result[j]
	})

	return result
}

package main

import (
	"bufio"
	"os"
	"fmt"

)

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

	var t int

	fmt.Fscan(r, &t)

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

		var s string
		fmt.Fscan(r, &s)

		ans := solve(s, n)

		fmt.Println(ans)
	}
}

func solve(s string, n int) string {

	str := "abcdefghijklmnopqrstuvwxyz"

	for k := 1; k <= 3; k++ {

		mp := make(map[string]bool)

		for i := 0; i <= n - k ; i++ {
			s := s[i : i + k]

			mp[s] = true
		}

		if k == 1 {
			for j := 0; j < len(str); j++ {

				if _, ok := mp[string(str[j])]; !ok {
					return string(str[j])
				}
			}
		}

		if k == 2 {
			for j := 0; j < len(str); j++ {
				for k := 0; k < len(str); k++ {
					v := string(str[j]) + string(str[k])

					if _, ok := mp[v]; !ok {
						return v
					}
				}
			}

		}

		if k == 3 {
			for j := 0; j < len(str); j++ {
				for k := 0; k < len(str); k++ {
					for p := 0; p < len(str); p++ {
						v := string(str[j]) + string(str[k]) + string(str[p])

						if _, ok := mp[v]; !ok {
							return v
						}
					}
				}
			}

		}
	}

	return ""
}

package main

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

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

	solve := func(Case int) {
		var n int
		var s string
		Fscan(in, &n, &s)

		for l := 1; ; l++ {
			has := map[string]bool{}
			for r := l; r <= n; r++ {
				has[s[r-l:r]] = true
			}
			t := make([]byte, l)
			var f func(p int) bool
			f = func(p int) bool {
				if p == l {
					return !has[string(t)]
				}
				for t[p] = 'a'; t[p] <= 'z'; t[p]++ {
					if f(p + 1) {
						return true
					}
				}
				return false
			}
			if f(0) {
				Fprintln(out, string(t))
				break
			}
		}
	}

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

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

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

package main

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

/*

 */

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

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

outer:
	for ; t > 0; t-- {
		var n int
		scanf("%d\n", &n)

		var s string
		scanf("%s\n", &s)

		for i := byte('a'); i <= 'z'; i++ {
			mex := string([]byte{i})

			if !strings.Contains(s, mex) {
				fmt.Fprintln(writer, mex)
				continue outer
			}
		}

		for i := byte('a'); i <= 'z'; i++ {
			for j := byte('a'); j <= 'z'; j++ {
				mex := string([]byte{i, j})

				if !strings.Contains(s, mex) {
					fmt.Fprintln(writer, mex)
					continue outer
				}
			}
		}

		for i := byte('a'); i <= 'z'; i++ {
			for j := byte('a'); j <= 'z'; j++ {
				for k := byte('a'); k <= 'z'; k++ {
					mex := string([]byte{i, j, k})

					if !strings.Contains(s, mex) {
						fmt.Fprintln(writer, mex)
						continue outer
					}
				}
			}
		}
	}
}

const maxUint = ^uint(0)

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

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

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

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

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

//goland:noinspection GoUnusedFunction
func divCeil(num, div int) int {
	quot := num / div
	if num%div != 0 {
		quot++
	}
	return quot
}

//goland:noinspection GoUnusedFunction
func min(nums ...int) int {
	minimum := nums[0]
	for _, num := range nums {
		if num < minimum {
			minimum = num
		}
	}
	return minimum
}

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

	return nums[idx], idx
}

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

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

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

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

	return true
}

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

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

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

	num = abs(num)

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

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

package main

import (
	"bufio"
	. "fmt"
	"io"
	"strings"

	//"math"
	"os"
)

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

	var t int
	for Fscan(in, &t); t > 0; t-- {
		var n int
		Fscan(in, &n)
		s := make([]byte, n)
		Fscan(in, &s)

		idx := 1
		for {
			var str []byte
			tmp := idx
			for tmp > 0 {
				str = append(str, byte('a' + (tmp - 1) % 26))
				tmp = (tmp - 1) / 26
			}
			left, right := 0, len(str) - 1
			for left < right {
				str[left], str[right] = str[right], str[left]
				left++; right--
			}
			if !strings.Contains(string(s), string(str)) {
				Fprintln(out, string(str))
				break
			}
			idx++
		}
	}
}

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

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

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

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

package main

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

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

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

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

		for i := 1; i <= n; i++ {
			mark := map[string]bool{}
			for j := i; j <= n; j++ {
				mark[s[j-i:j]] = true
			}
			arr := make([]byte, i)
			if valid(mark, arr, 0, i) {
				fmt.Fprintln(writer, string(arr))
				break
			}
		}
	}
}

func valid(mark map[string]bool, arr []byte, i, n int) bool {
	if i == n {
		return !mark[string(arr)]
	}
	for arr[i] = 'a'; arr[i] <= 'z'; arr[i]++ {
		if valid(mark, arr, i+1, n) {
			return true
		}
	}
	return false
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	solve := func(Case int) {
		var n int
		var s string
		fmt.Fscan(in, &n, &s)

		for l := 1; l <= n; l++ {
			sub := map[string]bool{}
			for r := l; r <= n; r++ {
				sub[s[r-l:r]] = true
			}
			ans := make([]byte, l)
			var find func(p int) bool
			find = func(p int) bool {
				if p == l {
					return !sub[string(ans)]
				}
				for ans[p] = 'a'; ans[p] <= 'z'; ans[p]++ {
					if find(p + 1) {
						return true
					}
				}
				return false
			}
			if find(0) {
				fmt.Fprintln(out, string(ans))
				break
			}
		}
	}

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

func max(x, y int64) int64 {
	if x < y {
		return y
	}
	return x
}

func gcd(x, y int) int {
	for y != 0 {
		x, y = y, x%y
	}
	return x
}

func reverse(s []byte) []byte {
	a := []byte(s)
	for i, j := 0, len(a)-1; i < j; i, j = i+1, j-1 {
		a[i], a[j] = a[j], a[i]
	}
	return a
}

package main

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

func main() {
	var tcs int
	in := bufio.NewReader(os.Stdin)
	_, _ = fmt.Fscan(in, &tcs)

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

		var s string
		_, _ = fmt.Fscan(in, &s)

		mp := make(map[string]bool)

		for i := 0; i < n; i++ {
			for j := i; j < n; j++ {
				mp[s[i:j+1]] = true
			}
		}

		fmt.Println(first(mp))
	}
}

func first(mp map[string]bool) string {
	alpha := "abcdefghijklmnopqrstuvwxyz"

	for _, c := range alpha {
		if !mp[string(c)] {
			return string(c)
		}
	}

	for _, c1 := range alpha {
		for _, c2 := range alpha {
			c := string(c1) + string(c2)
			if !mp[c] {
				return c
			}
		}
	}

	for _, c1 := range alpha {
		for _, c2 := range alpha {
			for _, c3 := range alpha {
				c := string(c1) + string(c2) + string(c3)
				if !mp[c] {
					return c
				}
			}
		}
	}

	return ""
}

/**
 * This snippet assumes large input and large output and that all the input contains numbers in the form of string
 */

package main

import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
	"sort"
	"unicode"
)

var bytes []byte
var l, max int
var ws *bufio.Writer

/**
 * Perform Quick Scan of 1 data(with no spaces in-between) on the buffered input
 */
func fastScan() int {
	for ;unicode.IsSpace(rune(bytes[l])); {l++}
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

func compress(s []byte) int {
	var ret int
	for i := 0;i < len(s);i++{
		ret *= 26;
		ret += int(s[i] - 'a')
	}
	return ret
}

func printString(s, n int) {
	tmp := make([]byte, n)
	for i := 0;i < n;i++{
		tmp[i] = byte((s%26) + 'a')
		s /= 26
	}
	for i := 0;i < len(tmp)/2;i++ {
		tmp[i], tmp[len(tmp) - i - 1] = tmp[len(tmp) - i - 1], tmp[i]
	}
	fmt.Println(string(tmp))
}

func solve(){
	//_, _ = ws.WriteString("Solving")
	//ws.Flush()
	n := fastScan()
	s := make([]byte, n + 1)
	for ;unicode.IsSpace(rune(bytes[l])); {l++}
	for i := 1;i <= n;i++ {
		s[i] = bytes[l]
		l++
	}
	//fmt.Println(s)
	listOfStrings := make([][]int, 3)
	for i := 1;i <= n;i++ {
		for j := 1;j <= 3;j++ {
			if(i + j > len(s)){
				break
			}
			listOfStrings[j - 1] = append(listOfStrings[j - 1], compress(s[i:i+j]))
		}
	}
	//fmt.Println(listOfStrings)
	curmax := 1
	for i := 0;i < 3;i++ {
		curmax *= 26
		curidx := 0
		sort.Ints(listOfStrings[i])
		//fmt.Println(listOfStrings[i])
		for j := 0; j < curmax;j++ {
			//fmt.Println(curidx)
			for curidx < len(listOfStrings[i]) && listOfStrings[i][curidx] < j {
				curidx++
			}
			if curidx == len(listOfStrings[i]) || listOfStrings[i][curidx] > j{
				printString(j, i + 1)
				return
			}
		}
	}
}

func main() {
	// Read all the input into Buffer
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1

	// Create a write buffer directed to STDOUT
	ws = bufio.NewWriter(os.Stdout)

	// Read the first param
	t := fastScan()

	for t > 0 {
		t--
		solve()
		//ws.WriteString(strconv.Itoa(t) + "\n")
	}
}

/**
 * This snippet assumes large input and large output and that all the input contains numbers in the form of string
 */

package main

import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
	"sort"
	"unicode"
)

var bytes []byte
var l, max int
var ws *bufio.Writer

/**
 * Perform Quick Scan of 1 data(with no spaces in-between) on the buffered input
 */
func fastScan() int {
	for ;unicode.IsSpace(rune(bytes[l])); {l++}
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

func compress(s []byte) int {
	var ret int
	for i := 0;i < len(s);i++{
		ret *= 26;
		ret += int(s[i] - 'a')
	}
	return ret
}

func printString(s, n int) {
	tmp := make([]byte, n)
	for i := 0;i < n;i++{
		tmp = append(tmp, byte((s%26) + 'a'))
		s /= 26
	}
	for i := len(tmp) - 1;i >= 0;i-- {
		fmt.Printf("%c", tmp[i])
	}
	fmt.Println()
	//_, _ = ws.WriteString("\n")
	_ = ws.Flush()
}

func solve(){
	//_, _ = ws.WriteString("Solving")
	//ws.Flush()
	n := fastScan()
	s := make([]byte, n + 1)
	for ;unicode.IsSpace(rune(bytes[l])); {l++}
	for i := 1;i <= n;i++ {
		s[i] = bytes[l]
		l++
	}
	//fmt.Println(s)
	listOfStrings := make([][]int, 3)
	for i := 1;i <= n;i++ {
		for j := 1;j <= 3;j++ {
			if(i + j > len(s)){
				break
			}
			listOfStrings[j - 1] = append(listOfStrings[j - 1], compress(s[i:i+j]))
		}
	}
	//fmt.Println(listOfStrings)
	curmax := 1
	for i := 0;i < 3;i++ {
		curmax *= 26
		curidx := 0
		sort.Ints(listOfStrings[i])
		//fmt.Println(listOfStrings[i])
		for j := 0; j < curmax;j++ {
			//fmt.Println(curidx)
			for curidx < len(listOfStrings[i]) && listOfStrings[i][curidx] < j {
				curidx++
			}
			if curidx == len(listOfStrings[i]) || listOfStrings[i][curidx] > j{
				printString(j, i + 1)
				return
			}
		}
	}
}

func main() {
	// Read all the input into Buffer
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1

	// Create a write buffer directed to STDOUT
	ws = bufio.NewWriter(os.Stdout)

	// Read the first param
	t := fastScan()

	for t > 0 {
		t--
		solve()
		//ws.WriteString(strconv.Itoa(t) + "\n")
	}
	ws.Flush()
}

/**
 * This snippet assumes large input and large output and that all the input contains numbers in the form of string
 */

package main

import (
	"bufio"
	"io/ioutil"
	"os"
	"sort"
	"unicode"
)

var bytes []byte
var l, max int
var ws *bufio.Writer

/**
 * Perform Quick Scan of 1 data(with no spaces in-between) on the buffered input
 */
func fastScan() int {
	for ;unicode.IsSpace(rune(bytes[l])); {l++}
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

func compress(s []byte) int {
	var ret int
	for i := 0;i < len(s);i++{
		ret *= 26;
		ret += int(s[i] - 'a')
	}
	return ret
}

func printString(s, n int) {
	tmp := make([]byte, n)
	for i := 0;i < n;i++{
		tmp = append(tmp, byte((s%26) + 'a'))
		s /= 26
	}
	for i := len(tmp) - 1;i >= 0;i-- {
		_ = ws.WriteByte(tmp[i])
	}
	//_, _ = ws.WriteString("\n")
	//_ = ws.Flush()
}

func solve(){
	//_, _ = ws.WriteString("Solving")
	//ws.Flush()
	n := fastScan()
	s := make([]byte, n + 1)
	for ;unicode.IsSpace(rune(bytes[l])); {l++}
	for i := 1;i <= n;i++ {
		s[i] = bytes[l]
		l++
	}
	//fmt.Println(s)
	listOfStrings := make([][]int, 3)
	for i := 1;i <= n;i++ {
		for j := 1;j <= 3;j++ {
			if(i + j > len(s)){
				break
			}
			listOfStrings[j - 1] = append(listOfStrings[j - 1], compress(s[i:i+j]))
		}
	}
	//fmt.Println(listOfStrings)
	curmax := 1
	for i := 0;i < 3;i++ {
		curmax *= 26
		curidx := 0
		sort.Ints(listOfStrings[i])
		//fmt.Println(listOfStrings[i])
		for j := 0; j < curmax;j++ {
			//fmt.Println(curidx)
			for curidx < len(listOfStrings[i]) && listOfStrings[i][curidx] < j {
				curidx++
			}
			if curidx == len(listOfStrings[i]) || listOfStrings[i][curidx] > j{
				printString(j, i + 1)
				return
			}
		}
	}
}

func main() {
	// Read all the input into Buffer
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1

	// Create a write buffer directed to STDOUT
	ws = bufio.NewWriter(os.Stdout)

	// Read the first param
	t := fastScan()

	for t > 0 {
		t--
		solve()
		//ws.WriteString(strconv.Itoa(t) + "\n")
	}
	ws.Flush()
}

/**
 * This snippet assumes large input and large output and that all the input contains numbers in the form of string
 */

package main

import (
	"bufio"
	"io/ioutil"
	"os"
	"sort"
	"unicode"
)

var bytes []byte
var l, max int
var ws *bufio.Writer

/**
 * Perform Quick Scan of 1 data(with no spaces in-between) on the buffered input
 */
func fastScan() int {
	for ;unicode.IsSpace(rune(bytes[l])); {l++}
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

func compress(s []byte) int {
	var ret int
	for i := 0;i < len(s);i++{
		ret *= 26;
		ret += int(s[i] - 'a')
	}
	return ret
}

func printString(s, n int) {
	tmp := make([]byte, n)
	for i := 0;i < n;i++{
		tmp = append(tmp, byte((s%26) + 'a'))
		s /= 26
	}
	for i := len(tmp) - 1;i >= 0;i-- {
		_ = ws.WriteByte(tmp[i])
	}
	ws.WriteString("\n")
	_ = ws.Flush()
}

func solve(){
	//_, _ = ws.WriteString("Solving")
	//ws.Flush()
	n := fastScan()
	s := make([]byte, n + 1)
	for ;unicode.IsSpace(rune(bytes[l])); {l++}
	for i := 1;i <= n;i++ {
		s[i] = bytes[l]
		l++
	}
	//fmt.Println(s)
	listOfStrings := make([][]int, 3)
	for i := 1;i <= n;i++ {
		for j := 1;j <= 3;j++ {
			if(i + j > len(s)){
				break
			}
			listOfStrings[j - 1] = append(listOfStrings[j - 1], compress(s[i:i+j]))
		}
	}
	//fmt.Println(listOfStrings)
	curmax := 1
	for i := 0;i < 3;i++ {
		curmax *= 26
		curidx := 0
		sort.Ints(listOfStrings[i])
		//fmt.Println(listOfStrings[i])
		for j := 0; j < curmax;j++ {
			//fmt.Println(curidx)
			for curidx < len(listOfStrings[i]) && listOfStrings[i][curidx] < j {
				curidx++
			}
			if curidx == len(listOfStrings[i]) || listOfStrings[i][curidx] > j{
				printString(j, i + 1)
				return
			}
		}
	}
}

func main() {
	// Read all the input into Buffer
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1

	// Create a write buffer directed to STDOUT
	ws = bufio.NewWriter(os.Stdout)

	// Read the first param
	t := fastScan()

	for t > 0 {
		t--
		solve()
		//ws.WriteString(strconv.Itoa(t) + "\n")
	}
	ws.Flush()
}

/**
 * This snippet assumes large input and large output and that all the input contains numbers in the form of string
 */

package main

import (
	"bufio"
	"io/ioutil"
	"os"
	"sort"
	"unicode"
)

var bytes []byte
var l, max int
var ws *bufio.Writer

/**
 * Perform Quick Scan of 1 data(with no spaces in-between) on the buffered input
 */
func fastScan() int {
	for ;unicode.IsSpace(rune(bytes[l])); {l++}
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

func compress(s []byte) int {
	var ret int
	for i := 0;i < len(s);i++{
		ret *= 26;
		ret += int(s[i] - 'a')
	}
	return ret
}

func printString(s, n int) {
	tmp := make([]byte, n)
	for i := 0;i < n;i++{
		tmp = append(tmp, byte((s%26) + 'a'))
		s /= 26
	}
	for i := len(tmp) - 1;i >= 0;i-- {
		_ = ws.WriteByte(tmp[i])
	}
	ws.WriteRune('\n')
	_ = ws.Flush()
}

func solve(){
	//_, _ = ws.WriteString("Solving")
	//ws.Flush()
	n := fastScan()
	s := make([]byte, n + 1)
	for ;unicode.IsSpace(rune(bytes[l])); {l++}
	for i := 1;i <= n;i++ {
		s[i] = bytes[l]
		l++
	}
	//fmt.Println(s)
	listOfStrings := make([][]int, 3)
	for i := 1;i <= n;i++ {
		for j := 1;j <= 3;j++ {
			if(i + j > len(s)){
				break
			}
			listOfStrings[j - 1] = append(listOfStrings[j - 1], compress(s[i:i+j]))
		}
	}
	//fmt.Println(listOfStrings)
	curmax := 1
	for i := 0;i < 3;i++ {
		curmax *= 26
		curidx := 0
		sort.Ints(listOfStrings[i])
		//fmt.Println(listOfStrings[i])
		for j := 0; j < curmax;j++ {
			//fmt.Println(curidx)
			for curidx < len(listOfStrings[i]) && listOfStrings[i][curidx] < j {
				curidx++
			}
			if curidx == len(listOfStrings[i]) || listOfStrings[i][curidx] > j{
				printString(j, i + 1)
				return
			}
		}
	}
}

func main() {
	// Read all the input into Buffer
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1

	// Create a write buffer directed to STDOUT
	ws = bufio.NewWriter(os.Stdout)

	// Read the first param
	t := fastScan()

	for t > 0 {
		t--
		solve()
		//ws.WriteString(strconv.Itoa(t) + "\n")
	}
	ws.Flush()
}

/**
 * This snippet assumes large input and large output and that all the input contains numbers in the form of string
 */

package main

import (
	"bufio"
	"io/ioutil"
	"os"
	"sort"
	"unicode"
)

var bytes []byte
var l, max int
var ws *bufio.Writer

/**
 * Perform Quick Scan of 1 data(with no spaces in-between) on the buffered input
 */
func fastScan() int {
	for ;unicode.IsSpace(rune(bytes[l])); {l++}
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

func compress(s []byte) int {
	var ret int
	for i := 0;i < len(s);i++{
		ret *= 26;
		ret += int(s[i] - 'a')
	}
	return ret
}

func printString(s, n int) {
	tmp := make([]byte, n)
	for i := 0;i < n;i++{
		tmp = append(tmp, byte((s%26) + 'a'))
		s /= 26
	}
	for i := len(tmp) - 1;i >= 0;i-- {
		_ = ws.WriteByte(tmp[i])
	}
	ws.WriteByte('\n')
	_ = ws.Flush()
}

func solve(){
	//_, _ = ws.WriteString("Solving")
	//ws.Flush()
	n := fastScan()
	s := make([]byte, n + 1)
	for ;unicode.IsSpace(rune(bytes[l])); {l++}
	for i := 1;i <= n;i++ {
		s[i] = bytes[l]
		l++
	}
	//fmt.Println(s)
	listOfStrings := make([][]int, 3)
	for i := 1;i <= n;i++ {
		for j := 1;j <= 3;j++ {
			if(i + j > len(s)){
				break
			}
			listOfStrings[j - 1] = append(listOfStrings[j - 1], compress(s[i:i+j]))
		}
	}
	//fmt.Println(listOfStrings)
	curmax := 1
	for i := 0;i < 3;i++ {
		curmax *= 26
		curidx := 0
		sort.Ints(listOfStrings[i])
		//fmt.Println(listOfStrings[i])
		for j := 0; j < curmax;j++ {
			//fmt.Println(curidx)
			for curidx < len(listOfStrings[i]) && listOfStrings[i][curidx] < j {
				curidx++
			}
			if curidx == len(listOfStrings[i]) || listOfStrings[i][curidx] > j{
				printString(j, i + 1)
				return
			}
		}
	}
}

func main() {
	// Read all the input into Buffer
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1

	// Create a write buffer directed to STDOUT
	ws = bufio.NewWriter(os.Stdout)

	// Read the first param
	t := fastScan()

	for t > 0 {
		t--
		solve()
		//ws.WriteString(strconv.Itoa(t) + "\n")
	}
	ws.Flush()
}

package main

import (
	"fmt"
	"sort"
	"strings"
)
var (
	_firstCharStr = "a"
)

func main()  {
	var testCase int32
	fmt.Scanf("%d\n", &testCase)

	for ix := int32(0); ix < testCase; ix ++ {
		solve()
	}

}

func solve() {
	var inp string
	var len int32
	fmt.Scanf("%d\n", &len)
	fmt.Scanf("%s\n", &inp)
	allSubStr := getAllSubString(inp)

	var prevStr string
	for _, subStr := range allSubStr {
		if subStr == prevStr {
			continue
		}

		nextStr := getNextString(prevStr)
		if !strings.EqualFold(nextStr, subStr) {
			fmt.Println(nextStr)
			return
		}

		prevStr = subStr
	}
}

func getNextString(inp string) string {
	if len(inp) == 0 {
		return _firstCharStr
	}

	var result string
	var carry uint8 = 1
	for ix := len(inp) - 1; ix >= 0; ix-- {
		currentChar := inp[ix] - _firstCharStr[0]
		modifiedChar := (currentChar + carry) % 26
		carry = (currentChar + carry) / 26
		result = string(modifiedChar + _firstCharStr[0]) + result
	}

	if carry == 1 {
		result = _firstCharStr + result
	}

	return result
}

func getAllSubString(inp string) []string {
	inpArr := strings.Split(inp, "")
	result := make([]string, 0)

	for left := 0 ;left < len(inpArr); left++ {
		var sb strings.Builder
		for right := left; right < len(inp); right++ {
			sb.WriteString(inpArr[right])
			result = append(result, sb.String())
		}
	}

	// Sort by len first and then with alphabets
	sort.SliceStable(result, func(i , j int) bool {
		if len(result[i]) != len(result[j]) {
			return len(result[i]) < len(result[j])
		}
		return result[i] < result[j]
	})

	return result
}

package main

import (
	"bufio"
	"os"
	"fmt"

)

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

	var t int

	fmt.Fscan(r, &t)

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

		var s string
		fmt.Fscan(r, &s)

		ans := solve(s, n)

		fmt.Println(ans)
	}
}

func solve(s string, n int) string {

	str := "abcdefghijklmnopqrstuvwxyz"

	for k := 1; k <= 3; k++ {

		mp := make(map[string]bool)

		for i := 0; i <= n - k ; i++ {
			s := s[i : i + k]

			mp[s] = true
		}

		if k == 1 {
			for j := 0; j < len(str); j++ {

				if _, ok := mp[string(str[j])]; !ok {
					return string(str[j])
				}
			}
		}

		if k == 2 {
			for j := 0; j < len(str); j++ {
				for k := j + 1; k < len(str); k++ {
					v := string(str[j]) + string(str[k])

					if _, ok := mp[v]; !ok {
						return v
					}
				}
			}

		}

		if k == 3 {
			for j := 0; j < len(str); j++ {
				for k := j + 1; k < len(str); k++ {
					for p := k + 1; p < len(str); p++ {
						v := string(str[j]) + string(str[k]) + string(str[p])

						if _, ok := mp[v]; !ok {
							return v
						}
					}
				}
			}

		}
	}

	return ""
}

package main

import (
	"bufio"
	"os"
	"fmt"

)

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

	var t int

	fmt.Fscan(r, &t)

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

		var s string
		fmt.Fscan(r, &s)

		ans := solve(s, n)

		fmt.Println(ans)
	}
}

func solve(s string, n int) string {

	str := "abcdefghijklmnopqrstuvwxyz"

	for k := 1; k <= 3; k++ {

		mp := make(map[string]bool)

		for i := 0; i <= n - k ; i++ {
			s := s[i : i + k]

			mp[s] = true
		}

		if k == 1 {
			for j := 0; j < len(str); j++ {

				if _, ok := mp[string(str[j])]; !ok {
					return string(str[j])
				}
			}
		}

		if k == 2 {
			for j := 0; j < len(str); j++ {
				for k := j + 1; k < len(str); k++ {
					v := string(str[j]) + string(str[k])

					if _, ok := mp[v]; !ok {
						return v
					}
				}
			}

		}

		if k == 3 {
			for j := 0; j < len(str); j++ {
				for k := j + 1; k < len(str); k++ {
					for p := k + 1; k < len(str); k++ {
						v := string(str[j]) + string(str[k]) + string(str[p])

						if _, ok := mp[v]; !ok {
							return v
						}
					}
				}
			}

		}
	}

	return ""
}

package main

import (
	"bufio"
	"os"
	"fmt"

)

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

	var t int

	fmt.Fscan(r, &t)

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

		var s string
		fmt.Fscan(r, &s)

		ans := solve(s, n)

		fmt.Println(ans)
	}
}

func solve(s string, n int) string {

	str := "abcdefghijklmnopqrstuvwxyz";

	for k := 1; k <= 3; k++ {

		mp := make(map[string]bool)

		for i := 0; i <= n - k ; i++ {
			s := s[i : i + k]

			mp[s] = true
		}

		if k == 1 {
			for j := 0; j < len(str); j++ {

				if _, ok := mp[string(str[j])]; !ok {
					return string(str[j])
				}
			}
		}

		if k == 2 {
			for j := 0; j < len(str); j++ {
				for k := j + 1; k < len(str); k++ {
					v := string(str[j]) + string(str[k])

					if _, ok := mp[v]; !ok {
						return v
					}
				}
			}

		}

		if k == 2 {
			for j := 0; j < len(str); j++ {
				for k := j + 1; k < len(str); k++ {
					for p := k + 1; k < len(str); k++ {
						v := string(str[j]) + string(str[k]) + string(str[p])

						if _, ok := mp[v]; !ok {
							return v
						}
					}
				}
			}

		}
	}

	return ""
}

package main

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

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

	solve := func(Case int) {
		var n int
		var s string
		Fscan(in, &n, &s)

		for l := 1; ; l++ {
			has := map[string]bool{}
			for r := l; r <= n; r++ {
				has[s[r-l:r]] = true
			}
			t := make([]byte, l)
			var f func(p int) bool
			f = func(p int) bool {
				if p == l {
					return !has[string(t)]
				}
				for t[p] = 'a'; t[p] < 'z'; t[p]++ {
					if f(p + 1) {
						return true
					}
				}
				return false
			}
			if f(0) {
				Fprintln(out, string(t))
				break
			}
		}
	}

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

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

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

package main

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

/*

 */

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

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

outer:
	for ; t > 0; t-- {
		var n int
		scanf("%d\n", &n)

		var s string
		scanf("%s\n", &s)

		for i := byte('a'); i <= 'z'; i++ {
			mex := string([]byte{i})

			if !strings.Contains(s, mex) {
				fmt.Fprintln(writer, mex)
				continue outer
			}
		}

		for i := byte('a'); i <= 'z'; i++ {
			for j := byte('a'); j <= 'z'; j++ {
				mex := string([]byte{i, j})

				if !strings.Contains(s, mex) {
					fmt.Fprintln(writer, mex)
					continue outer
				}
			}
		}
	}
}

const maxUint = ^uint(0)

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

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

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

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

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

//goland:noinspection GoUnusedFunction
func divCeil(num, div int) int {
	quot := num / div
	if num%div != 0 {
		quot++
	}
	return quot
}

//goland:noinspection GoUnusedFunction
func min(nums ...int) int {
	minimum := nums[0]
	for _, num := range nums {
		if num < minimum {
			minimum = num
		}
	}
	return minimum
}

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

	return nums[idx], idx
}

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

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

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

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

	return true
}

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

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

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

	num = abs(num)

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

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


package main

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

// github.com/EndlessCheng/codeforces-go
func CF1187E(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	var n, v, w int
	Fscan(in, &n)
	g := make([][]int, n+1)
	for i := 1; i < n; i++ {
		Fscan(in, &v, &w)
		//v--
		//w--
		g[v] = append(g[v], w)
		g[w] = append(g[w], v)
	}

	ans := int64(0)
	size := make([]int, n+1)
	sum := make([]int64, n+1)
	var f func(v, fa int) (int, int64)
	f = func(v, fa int) (sz int, s int64) {
		sz = 1
		for _, w := range g[v] {
			if w != fa {
				subSz, subSum := f(w, v)
				sz += subSz
				s += subSum
			}
		}
		size[v] = sz
		s += int64(sz)
		sum[v] = s
		return
	}
	f(1, 0)
	var f2 func(v, fa int, othersSum int64)
	f2 = func(v, fa int, othersSum int64) {
		s := int64(n) + othersSum
		for _, w := range g[v] {
			if w != fa {
				s += sum[w]
				f2(w, v, othersSum+int64(n-size[w])+sum[v]-int64(size[v])-sum[w])
			}
		}
		if s > ans {
			ans = s
		}
	}
	f2(1, 0, 0)
	Fprint(_w, ans)
}

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

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1187E(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	var n, v, w int
	Fscan(in, &n)
	g := make([][]int, n+1)
	for i := 1; i < n; i++ {
		Fscan(in, &v, &w)
		g[v] = append(g[v], w)
		g[w] = append(g[w], v)
	}

	size := make([]int, n+1)
	sum := make([]int64, n+1)
	var f func(v, fa int) (int, int64)
	f = func(v, fa int) (sz int, s int64) {
		sz = 1
		for _, w := range g[v] {
			if w != fa {
				subSz, subSum := f(w, v)
				sz += subSz
				s += subSum
			}
		}
		size[v] = sz
		s += int64(sz)
		sum[v] = s
		return
	}
	f(1, 0)

	ans := int64(0)
	var reroot func(v, fa int, othersSum int64)
	reroot = func(v, fa int, othersSum int64) {
		for _, w := range g[v] {
			if w != fa {
				reroot(w, v, othersSum+int64(n-size[w])+sum[v]-int64(size[v])-sum[w])
			}
		}
		if s := int64(n) + othersSum + sum[v] - int64(size[v]); s > ans {
			ans = s
		}
	}
	reroot(1, 0, 0)
	Fprint(_w, ans)
}

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


package main
// github.com/jamesgrimard/codeforces
import(
    "fmt"
    "bufio"
    "os"
    "sort"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		a:= make([]int,n)
		for j:=0;j<n;j++{
			fmt.Fscan(in,&a[j])
		}
		a2:= make([]int,len(a))
		copy(a2[:],a)
		sort.Ints(a2)
		for j:=0;j<n;j++{
			if a[j] == a2[n-1] {
				fmt.Fprintf(out,"%v ",a[j]-a2[n-2])
				continue
			}
			fmt.Fprintf(out,"%v ",a[j]-a2[n-1])
		}
		fmt.Fprintln(out)
	}
}

/*
	A template for Go on codeforces.com
	Author: Yakov, frvr.ru
*/

package main

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

// to sort a string
type sortRunes []rune

func (s sortRunes) Less(i, j int) bool {
	return s[i] < s[j]
}

func (s sortRunes) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

func (s sortRunes) Len() int {
	return len(s)
}

func SortString(s string) string {
	r := []rune(s)
	sort.Sort(sortRunes(r))
	return string(r)
}

func main() {
	n := readInt()
	for i := 0; i < n; i++ {
		l := readInt()
		arr := readInts()
		cp := make([]int, len(arr))
		copy(cp, arr)
		sort.Ints(arr)
		//writeLine(cp)
		//writeLine(arr)
		for i := 0; i < l; i++ {
			var d int
			if cp[i] == arr[len(arr)-1] {
				d = cp[i] - arr[len(arr)-2]
			} else {
				d = cp[i] - arr[len(arr)-1]
			}
			//fmt.Printf("d====>%v\n", d)
			fmt.Printf("%v ", d)
		}
		writeLine()
	}
}

/* ~~~~~~~~~~ */
/* ~~~~~~~~~~ */
/* ~~~~~~~~~~ */

var in = bufio.NewReader(os.Stdin)

type float = float32
type double = float64
type long = int64
type ulong = uint64

func typeOf(arg interface{}) string {
	switch reflect.TypeOf(arg).Kind() {
	case reflect.Int:
		return "int"
	case reflect.Int8:
		return "int8"
	case reflect.Int16:
		return "int16"
	case reflect.Int32:
		return "int32"
	case reflect.Int64:
		return "int64"
	case reflect.Uint:
		return "uint"
	case reflect.Uint8:
		return "uint8"
	case reflect.Uint16:
		return "uint16"
	case reflect.Uint32:
		return "uint32"
	case reflect.Uint64:
		return "uint64"
	case reflect.Float32:
		return "float32"
	case reflect.Float64:
		return "float64"
	case reflect.Complex64:
		return "complex64"
	case reflect.Complex128:
		return "complex128"
	case reflect.Bool:
		return "bool"
	case reflect.String:
		return "string"
	case reflect.Chan:
		return "chan"
	case reflect.Ptr:
		return "ptr"
	case reflect.Uintptr:
		return "uintptr"
	case reflect.UnsafePointer:
		return "unsafeptr"
	case reflect.Interface:
		return "interface"
	case reflect.Array:
		return "array"
	case reflect.Slice:
		return "slice"
	case reflect.Map:
		return "map"
	case reflect.Struct:
		return "struct"
	case reflect.Func:
		return "func"
	case reflect.Invalid:
		return "invalid"
	default:
		return "nil"
	}
}

/* ~~~~~~~~~~ */

func _scln() string {
	ln, _ := in.ReadString('\n')
	return strings.Trim(ln, " \r\n")
}
func _sc(s []string) string {
	if len(s) == 0 {
		return _scln()
	}
	return s[0]
}

func readLine() string              { return _scln() }
func readString() string            { return _scln() }
func readStrings() []string         { return strings.Split(_scln(), " ") }
func readBool(s ...string) bool     { t, _ := strconv.ParseBool(_sc(s)); return t }
func readByte(s ...string) byte     { t, _ := strconv.ParseUint(_sc(s), 10, 8); return byte(t) }
func readDouble(s ...string) double { t, _ := strconv.ParseFloat(_sc(s), 64); return t }
func readFloat(s ...string) float   { t, _ := strconv.ParseFloat(_sc(s), 32); return float32(t) }
func readInt(s ...string) int       { t, _ := strconv.Atoi(_sc(s)); return t }
func readLong(s ...string) long     { t, _ := strconv.ParseInt(_sc(s), 10, 64); return t }
func readULong(s ...string) ulong   { t, _ := strconv.ParseUint(_sc(s), 10, 64); return t }

/* ~~~~~~~~~~ */

// Too much overhead with universal method using interface{}, wait for the generics,
// but for now — just don't look at the redundancy of the code after that commentary :)

func readBools() []bool {
	strs := readStrings()
	arr := make([]bool, len(strs))
	for i, s := range strs {
		arr[i] = readBool(s)
	}
	return arr
}
func readBytes() []byte {
	strs := readStrings()
	arr := make([]byte, len(strs))
	for i, s := range strs {
		arr[i] = readByte(s)
	}
	return arr
}
func readDoubles() []double {
	strs := readStrings()
	arr := make([]double, len(strs))
	for i, s := range strs {
		arr[i] = readDouble(s)
	}
	return arr
}
func readFloats() []float {
	strs := readStrings()
	arr := make([]float, len(strs))
	for i, s := range strs {
		arr[i] = readFloat(s)
	}
	return arr
}
func readInts() []int {
	strs := readStrings()
	arr := make([]int, len(strs))
	for i, s := range strs {
		arr[i] = readInt(s)
	}
	return arr
}
func readLongs() []long {
	strs := readStrings()
	arr := make([]long, len(strs))
	for i, s := range strs {
		arr[i] = readLong(s)
	}
	return arr
}
func readULongs() []ulong {
	strs := readStrings()
	arr := make([]ulong, len(strs))
	for i, s := range strs {
		arr[i] = readULong(s)
	}
	return arr
}

/* ~~~~~~~~~~ */

func write(arg ...interface{})                 { fmt.Print(arg...) }
func writeLine(arg ...interface{})             { fmt.Println(arg...) }
func writeFormat(f string, arg ...interface{}) { fmt.Printf(f, arg...) }

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		t--
		var n int
		var max, smax, x int64
		var a []int64
		fmt.Fscan(in, &n)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &x)
			if x > max {
				smax = max
				max = x
			} else if x > smax {
				smax = x
			}
			a = append(a, x)
		}
		//fmt.Println("=> ", max, smax)
		for i := 0; i < n; i++ {
			if a[i] == max {
				fmt.Printf("%d ", a[i]-smax)
			} else {
				fmt.Printf("%d ", a[i]-max)
			}
		}
		fmt.Printf("\n")
	}
}

package main

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

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

func main() {
	var t, n int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &n)
		a := make([]int, n)
		s := make([]int, n)
		for j := 0; j < n; j++ {
			fmt.Fscan(in, &a[j])
		}
		copy(s, a)
		sort.Ints(a)
		for j := 0; j < n; j++ {
			if s[j] == a[n-1] {
				s[j] -= a[n-2]
			} else {
				s[j] -= a[n-1]
			}
		}
		for j := 0; j < n; j++ {
			fmt.Print(s[j], " ")
		}
		fmt.Println()
	}
}

package main

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

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

// source: _
func solve() {
	_, arr := _readArr()
	fm, sm := 0, 0

	for _, i := range arr {
		if i > fm {
			sm = fm
			fm = i
		} else if i > sm {
			sm = i
		}
	}

	for _, i := range arr {
		if i == fm {
			fmt.Fprint(out, i-sm, " ")
		} else {
			fmt.Fprint(out, i-fm, " ")
		}
	}
	_print()
}

func main() {
	defer out.Flush()
	var t int
	for fmt.Fscanln(in, &t); t > 0; t-- {
		solve()
	}
}

// ====
func _readInt() int {
	var x int
	fmt.Fscan(in, &x)
	return x
}
func _readStr() string {
	var x string
	fmt.Fscan(in, &x)
	return x
}
func _readArr(x ...int) (int, []int) {
	var n int
	if len(x) == 0 {
		fmt.Fscan(in, &n)
	} else {
		n = x[0]
	}
	var v = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &v[i])
	}
	return n, v
}
func _print(x ...any) {
	fmt.Fprintln(out, x...)
}
func _max(x ...int) int {
	mi := 0
	for i := 1; i < len(x); i++ {
		if x[i] > x[mi] {
			mi = i
		}
	}
	return x[mi]
}
func _min(x ...int) int {
	mi := 0
	for i := 1; i < len(x); i++ {
		if x[i] < x[mi] {
			mi = i
		}
	}
	return x[mi]
}
func _sum(x ...int) int {
	res := 0
	for _, i := range x {
		res += i
	}
	return res
}
func _abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}
func _sortStr(x string) string {
	r := []rune(x)
	sort.Slice(r, func(i, j int) bool {
		return r[i] < r[j]
	})
	return string(r)
}
func _reverseInts(x []int) {
	n := len(x)
	for i := 0; i < n/2; i++ {
		x[i], x[n-1-i] = x[n-1-i], x[i]
	}
}
func _reverseStr(s string) string {
	x := []rune(s)
	n := len(x)
	for i := 0; i < n/2; i++ {
		x[i], x[n-1-i] = x[n-1-i], x[i]
	}
	return string(x)
}
func _makeMatrix(n, m int) [][]int {
	x := make([][]int, n)
	for i := range x {
		x[i] = make([]int, m)
	}
	return x
}

package main

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

const cf = true

func solve() {
	var n int
	fmt.Fscan(in, &n)
	arr := make([]int, n)
	for i := range arr {
		fmt.Fscan(in, &arr[i])
	}
	mx := arr[0]
	for i := range arr {
		mx = max(mx, arr[i])
	}
	cnt := 0
	for i := range arr {
		if arr[i] == mx {
			cnt++
		}
	}
	for i := range arr {
		if arr[i] == mx {
			if cnt > 1 {
				fmt.Fprint(out, 0, " ")
			} else {
				mxx := 0
				for j := range arr {
					if arr[j] == mx {
						continue
					}
					mxx = max(mxx, arr[j])
				}
				fmt.Fprint(out, arr[i]-mxx, " ")
			}
		} else {
			fmt.Fprint(out, arr[i]-mx, " ")
		}
	}
	fmt.Fprintln(out)
}

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

func LCM(a, b int) int {
	return a * b / GCD(a, b)
}

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

	return a
}

type SqrtInt interface {
	SignedSqrt | UnsignedSqrt
}

type SignedSqrt interface {
	~int | ~int32 | ~int64
}

type UnsignedSqrt interface {
	~uint | ~uint32 | ~uint64 | ~uintptr
}

func sqrt[T SqrtInt](x T) T {
	l, r := T(0), T(2000000123)
	for l < r {
		mid := (l + r) / 2
		if mid*mid > x {
			r = mid
		} else {
			l = mid + 1
		}
	}
	return l - 1
}

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
}

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

func reverseStr(s string) string {
	r := []byte(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"
	"strings"
)

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

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

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

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

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

/**
Run solve the problem CF1760C
Date: 11/21/2022
User: wotan
URL: https://codeforces.com/problemset/problem/1760/C
Problem: CF1760C
**/
func (in *CF1760C) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()

		arr := make([]int, n)
		arr2 := make([]int, n)
		for i := 0; i < n; i++ {
			arr[i] = in.NextInt()
			arr2[i] = arr[i]
		}
		sort.Ints(arr2)
		for i := 0; i < n; i++ {
			if arr[i] == arr2[n-1] {
				fmt.Print(arr[i]-arr2[n-2], " ")
			} else {
				fmt.Print(arr[i]-arr2[n-1], " ")
			}
		}
		fmt.Println()
	}
}

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

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

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"index/suffixarray"
	"log"
	"math"
	"net"
	"os"
	"path"
	"sort"
	"strconv"
	"strings"
	"time"
)

// For Codeforces
func main() {
	io := newStdIO()
	defer io.Flush()
	for T := io.ScanUInt16(); T > 0; T-- {
		solve(&io)
	}
}
func solve(io *IO) {
	n := io.ScanInt32()
	s := make([]int, n)
	for i := int32(0); i < n; i++ {
		s[i] = int(io.ScanInt32())
	}
	sCopy := make([]int, len(s))
	copy(sCopy, s)

	sort.Ints(s)
	for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
		s[i], s[j] = s[j], s[i]
	}

	for i := int32(0); i < n; i++ {
		if sCopy[i] == s[0] {
			io.Print(sCopy[i]-s[1], " ")
		} else {

			io.Print(sCopy[i]-s[0], " ")
		}
	}
	io.PrintLn()
}

// #region INTERFACES

// From https://pkg.go.dev/golang.org/x/exp/constraints
type Signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}
type Unsigned interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}
type Integer interface {
	Signed | Unsigned
}
type Float interface {
	~float32 | ~float64
}
type Complex interface {
	~complex64 | ~complex128
}
type Ordered interface {
	Integer | Float | ~string
}

type Prioritizable[T any] interface {
	PriorTo(x T) bool // If you take this as a relation: if (a,b) in R => (b,a) not in R
}

// #endregion
// #region TYPES WITH METHODS
// #region SingleLinkedList
type singleLinkedListNode[T comparable] struct {
	Value T
	Next  *singleLinkedListNode[T]
}

type SingleLinkedList[T comparable, IndexType Unsigned] struct {
	first  *singleLinkedListNode[T]
	last   *singleLinkedListNode[T]
	length IndexType
}

func NewSingleLinkedList[T comparable, IndexType Unsigned]() *SingleLinkedList[T, IndexType] {
	return &SingleLinkedList[T, IndexType]{
		first:  nil,
		last:   nil,
		length: 0,
	}
}
func (l *SingleLinkedList[T, I]) Len() I { return l.length }

// length > 0
func (l *SingleLinkedList[T, I]) First() T { return l.first.Value }

// length > 0
func (l *SingleLinkedList[T, I]) Last() T { return l.last.Value }

func (l *SingleLinkedList[T, I]) InsertFirst(value T) {
	if l.length == 0 {
		nodeToInsert := &singleLinkedListNode[T]{
			Value: value,
			Next:  l.first,
		}
		l.first = nodeToInsert
		l.last = nodeToInsert
	} else {
		l.first = &singleLinkedListNode[T]{
			Value: value,
			Next:  l.first,
		}
	}
	l.length++
}

func (l *SingleLinkedList[T, I]) InsertLast(value T) {
	if l.length == 0 {
		nodeToInsert := &singleLinkedListNode[T]{
			Value: value,
			Next:  l.first,
		}
		l.first = nodeToInsert
		l.last = nodeToInsert
	} else {
		l.last.Next = &singleLinkedListNode[T]{
			Value: value,
			Next:  nil,
		}
		l.last = l.last.Next
	}
	l.length++
}

// index <= length
func (l *SingleLinkedList[T, I]) InsertAt(index I, value T) {
	if index == 0 {
		l.InsertFirst(value)
		return
	}
	if index == l.length {
		l.InsertLast(value)
		return
	}

	n := l.first
	for index > 1 {
		n = n.Next
		index--
	}
	n.Next = &singleLinkedListNode[T]{
		Value: value,
		Next:  n.Next,
	}
	l.length++
}

func (l *SingleLinkedList[T, I]) Contains(value T) bool {
	tmp := l.first
	for i := I(0); i < l.length; i++ {
		if tmp.Value == value {
			return true
		}
		tmp = tmp.Next
	}
	return false
}
func (l *SingleLinkedList[T, I]) Clear() {
	l.first = nil
	l.last = nil
	l.length = 0
}

// index < length
func (l *SingleLinkedList[T, I]) GetElementAt(index I) T {
	n := l.first
	for index > 0 {
		n = n.Next
		index--
	}
	return n.Value
}

// index < length
func (l *SingleLinkedList[T, I]) SetElementAt(index I, value T) {
	n := l.first
	for index > 0 {
		n = n.Next
		index--
	}
	n.Value = value
}

func (l *SingleLinkedList[T, I]) RemoveFirst() T {
	tmp := l.first
	l.first = l.first.Next
	l.length--
	if l.length == 0 {
		l.last = nil
	}
	return tmp.Value
}
func (l *SingleLinkedList[T, I]) RemoveLast() (value T) {
	value = l.last.Value
	if l.length == 1 {
		l.first = nil
		l.last = nil
		l.length = 0
		return
	}

	tmp := l.first
	for i := I(2); i < l.length; i++ {
		tmp = tmp.Next
	}
	l.last = tmp
	return
}

func (l *SingleLinkedList[T, I]) RemoveAt(index I) T {
	if index == 0 {
		return l.RemoveFirst()
	}
	if index == l.length-1 {
		return l.RemoveLast()
	}

	tmp := l.first
	for i := I(1); i < index; i++ {
		tmp = tmp.Next
	}
	res := tmp.Next.Value
	tmp.Next = tmp.Next.Next
	return res
}

func (l *SingleLinkedList[T, I]) ToSlice() (res []T) {
	res = make([]T, 0, l.length)
	tmp := l.first
	for i := I(0); i < l.length; i++ {
		res = append(res, tmp.Value)
		tmp = tmp.Next
	}
	return
}
func (it *SingleLinkedList[T, I]) String() string {
	return "Qua:: " + fmt.Sprint(it.ToSlice())
}

// #endregion
// #region Queue

type Queue[T comparable, I Unsigned] struct {
	l SingleLinkedList[T, I]
}

func NewQueue[T comparable, I Unsigned]() *Queue[T, I] {
	return &Queue[T, I]{
		l: SingleLinkedList[T, I]{
			first:  nil,
			last:   nil,
			length: 0,
		},
	}
}
func (q *Queue[T, I]) Len() I          { return q.l.length }
func (q *Queue[T, I]) Enqueue(value T) { q.l.InsertLast(value) }
func (q *Queue[T, I]) Dequeue(T) T     { return q.l.RemoveFirst() }
func (q *Queue[T, I]) Preview() T      { return q.l.First() }
func (q *Queue[T, I]) String() string  { return q.l.String() }

// #endregion
// #region Stack

type Stack[T comparable, I Unsigned] struct {
	l SingleLinkedList[T, I]
}

func NewStack[T comparable, I Unsigned]() *Stack[T, I] {
	return &Stack[T, I]{
		l: SingleLinkedList[T, I]{
			first:  nil,
			last:   nil,
			length: 0,
		},
	}
}
func (s *Stack[T, I]) Len() I         { return s.l.length }
func (s *Stack[T, I]) Push(value T)   { s.l.InsertFirst(value) }
func (s *Stack[T, I]) Pop(T) T        { return s.l.RemoveFirst() }
func (s *Stack[T, I]) Preview() T     { return s.l.First() }
func (s *Stack[T, I]) String() string { return s.l.String() }

// #endregion
// #region Heap
type BinaryHeap[T Prioritizable[T], I Signed] struct {
	s []T
}

func NewBinaryHeap[T Prioritizable[T], I Signed](s []T) (h *BinaryHeap[T, I]) {
	h = &BinaryHeap[T, I]{
		s: s,
	}

	for i := (h.Len() - 2) / 2; i >= 0; i-- {
		h.heapifyDown(i)
	}
	return
}
func (h *BinaryHeap[T, I]) Len() I {
	return I(len(h.s))
}
func (h *BinaryHeap[T, I]) Push(value T) {
	h.s = append(h.s, value)
	h.heapifyUp(h.Len() - 1)
}
func (h *BinaryHeap[T, I]) Pop() (res T) {
	res = h.s[0]
	h.s[0] = h.s[h.Len()-1]
	h.s = h.s[:h.Len()-1]
	h.heapifyDown(0)
	return
}

func (h *BinaryHeap[T, I]) heapifyDown(index I) bool {
	origin := index
	for {
		j := index*2 + 2
		if j < h.Len() {
			if h.s[j-1].PriorTo(h.s[j]) {
				j--
			}
		} else {
			if j <= h.Len() && !h.s[j].PriorTo(h.s[index]) {
				h.s[j], h.s[index] = h.s[index], h.s[j]
			}
			break
		}
		if h.s[j].PriorTo(h.s[index]) {
			h.s[j], h.s[index] = h.s[index], h.s[j]
			index = j
		} else {
			break
		}
	}
	return origin != index
}
func (h *BinaryHeap[T, I]) heapifyUp(index I) {
	for {
		parent := (index - 1) / 2
		if parent == index || h.s[parent].PriorTo(h.s[index]) {
			break
		}
		h.s[index], h.s[parent] = h.s[parent], h.s[index]
		index = parent
	}
}

// #endregion

// #endregion

// #region FUNCTIONS
func Max[T Ordered](a, b T) T {
	if a >= b {
		return a
	}
	return b
}
func Min[T Ordered](a, b T) T {
	if a <= b {
		return a
	}
	return b
}
func Abs[T Integer | Float](a T) T {
	if a < 0 {
		return -a
	}
	return a
}
func Swap[T any](a, b *T) {
	*a, *b = *b, *a
}

// At least one != 0
func GCD[T Unsigned](a, b T) T {
	if b < a {
		Swap(&a, &b)
	}
	for {
		if a == 0 {
			return b
		}
		r := (b % a)
		b = a
		a = r
	}
}

// At least one != 0
func LCM[T Unsigned](a, b T) T {
	return (a * b) / GCD(a, b)
}

func First[T any](a T, _ any) T { return a }

// #endregion

// #region IO STUFF
type IO struct {
	r *bufio.Reader
	w *bufio.Writer
}

func newStdIO() IO {
	return IO{
		r: bufio.NewReader(os.Stdin),
		w: bufio.NewWriter(os.Stdout),
	}
}

// Is assumed that input.txt file exists
func newFileIO() IO {
	return IO{
		r: bufio.NewReader(First(os.Open("input.txt"))),
		w: bufio.NewWriter(First(os.OpenFile("output.txt", os.O_CREATE|os.O_RDWR|os.O_TRUNC, os.ModePerm))),
	}
}

func (io *IO) ScanInt8() (x int8)   { fmt.Fscan(io.r, &x); return }
func (io *IO) ScanInt16() (x int16) { fmt.Fscan(io.r, &x); return }
func (io *IO) ScanInt32() (x int32) { fmt.Fscan(io.r, &x); return }
func (io *IO) ScanInt64() (x int64) { fmt.Fscan(io.r, &x); return }

func (io *IO) ScanUInt8() (x uint8)   { fmt.Fscan(io.r, &x); return }
func (io *IO) ScanUInt16() (x uint16) { fmt.Fscan(io.r, &x); return }
func (io *IO) ScanUInt32() (x uint32) { fmt.Fscan(io.r, &x); return }
func (io *IO) ScanUInt64() (x uint64) { fmt.Fscan(io.r, &x); return }

func (io *IO) ScanFloat32() (x float32) { fmt.Fscan(io.r, &x); return }
func (io *IO) ScanFloat64() (x float64) { fmt.Fscan(io.r, &x); return }

func (io *IO) ScanString() (x string) { fmt.Fscan(io.r, &x); return }

func (io *IO) Print(x ...any)   { fmt.Fprint(io.w, x...) }
func (io *IO) PrintLn(x ...any) { fmt.Fprintln(io.w, x...) }

func (io *IO) Flush() { io.w.Flush() }

// #endregion

// #region KEEP IMPORTS
func D() {
	_ = bufio.Reader{}
	_ = bytes.Buffer{}
	_ = suffixarray.Index{}
	_ = log.Default()
	_ = math.Abs(0)
	_ = net.Dialer{}
	_ = path.ErrBadPattern
	_ = sort.Float64sAreSorted(nil)
	_ = strconv.ErrRange
	_ = strings.Builder{}
	_ = time.ANSIC
	_ = newStdIO()
	_ = newFileIO()
}

// #endregion

package main

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

func solve(reader *bufio.Reader, writer *bufio.Writer) {
	n := readInt(reader)
	a := readArrayInt(reader)

	var max1, max2, id int
	for i := 0; i < n; i++ {
		if max1 < a[i] {
			max1 = a[i]
			id = i
		}
	}
	for i := 0; i < n; i++ {
		if i != id {
			max2 = max(a[i], max2)
		}
	}
	for i := 0; i < n; i++ {
		if i == id {
			fmt.Fprint(writer, a[i]-max2, " ")
		} else {
			fmt.Fprint(writer, a[i]-max1, " ")
		}
	}
	fmt.Fprintln(writer)
}

func main() {
	reader := bReader(os.Stdin)
	writer := bWriter(os.Stdout)

	t := readInt(reader)

	for t > 0 {
		solve(reader, writer)
		t--
	}

	writer.Flush()
}

func min[T int | int64](a, b T) T {
	if a < b {
		return a
	}

	return b
}

func max[T int | int64](a, b T) T {
	if a > b {
		return a
	}

	return b
}

func abs[T int | int64](a T) T {
	if a < 0 {
		return a * -1
	} else {
		return a
	}
}

func gcd[T int | int64](x, y T) T {
	for y > 0 {
		x, y = y, x%y
	}

	return x
}

func lcm[T int | int64](x, y T) T {
	return x * y / gcd(x, y)
}

func bReader(stdin *os.File) *bufio.Reader {
	return bufio.NewReaderSize(stdin, 16*1024*1024)
}

func bWriter(stdout *os.File) *bufio.Writer {
	return bufio.NewWriterSize(stdout, 16*1024*1024)
}

func readLine(reader *bufio.Reader) string {
	str, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}

	return strings.TrimRight(string(str), "\r\n")
}

func checkError(err error) {
	if err != nil {
		panic(err)
	}
}

func readInt(reader *bufio.Reader) int {
	return int(readInt64(reader))
}

func readInt64(reader *bufio.Reader) int64 {
	value, err := strconv.ParseInt(readLine(reader), 10, 64)
	checkError(err)

	return value
}

func readString(reader *bufio.Reader) string {
	return readLine(reader)
}

func readArrayString(reader *bufio.Reader) []string {
	return strings.Split(strings.TrimSpace(readLine(reader)), " ")
}

func readArrayInt(reader *bufio.Reader) []int {
	arTemp := strings.Split(strings.TrimSpace(readLine(reader)), " ")
	n := len(arTemp)

	var ar []int

	for i := 0; i < n; i++ {
		arItemTemp, err := strconv.ParseInt(arTemp[i], 10, 64)
		checkError(err)
		arItem := int(arItemTemp)
		ar = append(ar, arItem)
	}

	return ar
}

func readArrayInt64(reader *bufio.Reader) []int64 {
	arTemp := strings.Split(strings.TrimSpace(readLine(reader)), " ")
	n := len(arTemp)

	var ar []int64

	for i := 0; i < n; i++ {
		arItemTemp, err := strconv.ParseInt(arTemp[i], 10, 64)
		checkError(err)
		arItem := arItemTemp
		ar = append(ar, arItem)
	}

	return ar
}

func readTwoInt(reader *bufio.Reader) (int, int) {
	ar := readArrayInt(reader)
	return ar[0], ar[1]
}

func readTwoInt64(reader *bufio.Reader) (int64, int64) {
	ar := readArrayInt64(reader)
	return ar[0], ar[1]
}

func readThreeInt(reader *bufio.Reader) (int, int, int) {
	ar := readArrayInt(reader)
	return ar[0], ar[1], ar[2]
}

func readThreeInt64(reader *bufio.Reader) (int64, int64, int64) {
	ar := readArrayInt64(reader)
	return ar[0], ar[1], ar[2]
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	//输入t
	var t, n int
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &n)
		nums := make([]int, n)
		temps := make([]int, n)
		for j := 0; j < n; j++ {
			fmt.Fscan(in, &nums[j])
			temps[j] = nums[j]
		}
		sort.Ints(temps)
		ans := make([]int, 0)

		for j := 0; j < len(nums); j++ {
			if nums[j] == temps[len(temps)-1] {
				ans = append(ans, nums[j]-temps[len(temps)-2])
			} else {
				ans = append(ans, nums[j]-temps[len(temps)-1])
			}
		}
		//fmt.Fprintln(out, nums, temps)
		// 输出res
		for j := 0; j < n; j++ {
			fmt.Fprint(out, ans[j])
			if j != n-1 {
				fmt.Fprint(out, " ")
			} else {
				fmt.Fprint(out, "\n")
			}
		}
	}
}

package main

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

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

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

		var n, res int
		fmt.Fscan(r, &n)

		a := make([]int, n)
		b := make([][]int, n)

		for i := range a {
			fmt.Fscan(r, &a[i])
			b[i] = []int{a[i], i}
		}

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

		for i := range a {
			res = a[i] - b[n-1][0]
			if i == b[n-1][1] {
				res = a[i] - b[n-2][0]
			}
			fmt.Fprintf(w, "%d ", res)
		}
		fmt.Fprintln(w, "")
	}

}

package main

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

var sc = bufio.NewScanner(os.Stdin)

const mod int = 998244353
const N int = 5e5 + 5

func main() {
	sc.Buffer(make([]byte, 500000*1+1), 500000)
	sc.Split(bufio.ScanWords)

	T := nextInt()
	for T > 0 {
		T--
		n := nextInt()
		a := make([]int, n)
		b := make([]int, n)
		for i := 0; i < n; i++ {
			a[i] = nextInt()
			b[i] = a[i]
		}
		sort.Ints(a)
		for _, x := range b {
			if x != a[n-1] {
				fmt.Printf("%d ", x-a[n-1])
			} else {
				fmt.Printf("%d ", x-a[n-2])
			}
		}
		fmt.Println()
	}
}

func max(args ...int) int {
	res := args[0]
	for _, v := range args {
		if v > res {
			res = v
		}
	}
	return res
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

package main

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

// https://space.bilibili.com/206214
func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	solve := func(curCase int) {
		var n int
		Fscan(in, &n)
		a := make([]int, n)
		for i := range a {
			Fscan(in, &a[i])
		}
		b := append([]int{}, a...)
		sort.Sort(sort.Reverse(sort.IntSlice(b)))
		mx := int(-1e9)
		for _, v := range a {
			if v > mx {
				mx = v
			}
		}
		for _, v := range a {
			if v == mx {
				Fprint(out, v-b[1]," ")
			} else {
				Fprint(out, v-b[0]," ")
			}
		}
		Fprintln(out)
	}

	cases := 1
	Fscan(in, &cases)
	for curCase := 1; curCase <= cases; curCase++ {
		solve(curCase)
	}

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

}

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

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscanf(in, "%d\r\n", &t)
	for o := 0; o < t; o++ {
		var n int
		fmt.Fscanf(in, "%d\r\n", &n)
		values := make([]int, n)
		for i := 0; i < n-1; i++ {
			fmt.Fscanf(in, "%d", &values[i])
		}
		fmt.Fscanf(in, "%d\r\n", &values[n-1])

		values2 := make([]int, n)
		for i := 0; i < n; i++ {
			values2[i] = values[i]
		}
		sort.Ints(values2)

		for i:=0; i < n; i++ {
			if values[i] == values2[n-1] {
				fmt.Printf("%d ",values[i] - values2[n-2])
			} else {
				fmt.Printf("%d ",values[i] - values2[n-1])
			}
		}

		fmt.Printf("\n")
	}
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var t int
	fmt.Scanf("%d\r\n", &t)
	for o := 0; o < t; o++ {
		var n int
		fmt.Scanf("%d\r\n", &n)
		values := make([]int, n)
		for i := 0; i < n-1; i++ {
			fmt.Scanf("%d", &values[i])
		}
		fmt.Scanf("%d\r\n", &values[n-1])

		values2 := make([]int, n)
		for i := 0; i < n-1; i++ {
			values2[i] = values[i]
		}
		sort.Ints(values2)

		for i:=0; i < n; i++ {
			if values[i] == values2[n-1] {
				fmt.Printf("%d ",values[i] - values2[n-2])
			} else {
				fmt.Printf("%d ",values[i] - values2[n-1])
			}
		}
		fmt.Printf("\n")
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	fmt.Scan("%d", &t)
	for o := 0; o < t; o++ {
		var n int
		fmt.Scan("%d", &n)
		values := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Scan("%d", &values[i])
		}

		mx2 := -1
		mx := -1
		mx_pos := -1

		for i := 0; i < n; i++ {
			if int(values[i]) > mx {
				mx = int(values[i])
				mx_pos = i
			}
		}

		for i := 0; i < n; i++ {
			if int(values[i]) == mx && mx_pos != i {
				mx2 = mx
			}
		}
		if mx2 == -1 {
			for i := 0; i < n; i++ {
				if int(values[i]) > mx2 && int(values[i]) != mx {
					mx2 = int(values[i])
				}
			}
		}

		for i := 0; i < n; i++ {
			if int(values[i]) == mx {
				fmt.Printf("%d", int(values[i])-mx2)
			} else {
				fmt.Printf("%d", int(values[i])-mx)
			}
			fmt.Printf(" ")
		}
		fmt.Printf("\n")
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	fmt.Scanf("%d", &t)
	for o := 0; o < t; o++ {
		var n int
		fmt.Scanf("%d", &n)
		values := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Scanf("%d", &values[i])
		}

		mx2 := -1
		mx := -1
		mx_pos := -1

		for i := 0; i < n; i++ {
			if int(values[i]) > mx {
				mx = int(values[i])
				mx_pos = i
			}
		}

		for i := 0; i < n; i++ {
			if int(values[i]) == mx && mx_pos != i {
				mx2 = mx
			}
		}
		if mx2 == -1 {
			for i := 0; i < n; i++ {
				if int(values[i]) > mx2 && int(values[i]) != mx {
					mx2 = int(values[i])
				}
			}
		}

		for i := 0; i < n; i++ {
			if int(values[i]) == mx {
				fmt.Printf("%d", int(values[i])-mx2)
			} else {
				fmt.Printf("%d", int(values[i])-mx)
			}
			fmt.Printf(" ")
		}
		fmt.Printf("\n")
	}
}

package main

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

func main() {
	var t int
	fmt.Scanf("%d", &t)

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	for o := 0; o < t; o++ {
		var n int
		fmt.Scanf("%d", &n)
		values := make([]byte, n)
		buf := make([]interface{}, n)
		for i := 0; i < n; i++ {
			buf[i] = &values[i]
		}
		fmt.Scanln(buf...)

		mx2 := -1
		mx := -1
		mx_pos := -1

		for i := 0; i < n; i++ {
			if int(values[i]) > mx {
				mx = int(values[i])
				mx_pos = i
			}
		}

		for i := 0; i < n; i++ {
			if int(values[i]) == mx && mx_pos != i {
				mx2 = mx
			}
		}
		if mx2 == -1 {
			for i := 0; i < n; i++ {
				if int(values[i]) > mx2 && int(values[i]) != mx {
					mx2 = int(values[i])
				}
			}
		}

		for i := 0; i < n; i++ {
			if int(values[i]) == mx {
				fmt.Printf("%d", int(values[i])-mx2)
			} else {
				fmt.Printf("%d", int(values[i])-mx)
			}
			fmt.Printf(" ")
		}
		fmt.Printf("\n")
	}
}

package main
// github.com/jamesgrimard/codeforces
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		a:= make([]int,n)
		for j:=0;j<n;j++{
			fmt.Fscan(in,&a[j])
		}
		var b1,b2 int
		for j:=0;j<n;j++{
			if a[j] >= a[b1] {
				b1 = j
			}
		}
		for j:=0;j<n;j++{
			if a[j] >= a[b2] && j != b1 {
				b2 = j
			}
		}
		for j:=0;j<n;j++{
			if j == b1 {
				fmt.Fprintf(out,"%v ",a[j]-a[b2])
				continue
			}
			fmt.Fprintf(out,"%v ",a[j]-a[b1])
		}
		fmt.Fprintln(out)
	}
}

package main
// github.com/jamesgrimard/codeforces
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		a:= make([]int,n)
		for j:=0;j<n;j++{
			fmt.Fscan(in,&a[j])
		}
		var b1,b2 int = 0,0
		for j:=0;j<n;j++{
			if a[j] > a[b1] {
				b2 = b1
				b1 = j
			} else if a[j] > a[b2] {
				b2 = j
			}
		}
		for j:=0;j<n;j++{
			if j == b1 {
				fmt.Fprintf(out,"%v ",a[j]-a[b2])
				continue
			}
			fmt.Fprintf(out,"%v ",a[j]-a[b1])
		}
		fmt.Fprintln(out)
	}
}

/*
	A template for Go on codeforces.com
	Author: Yakov, frvr.ru
*/

package main

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

// to sort a string
type sortRunes []rune

func (s sortRunes) Less(i, j int) bool {
	return s[i] < s[j]
}

func (s sortRunes) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

func (s sortRunes) Len() int {
	return len(s)
}

func SortString(s string) string {
	r := []rune(s)
	sort.Sort(sortRunes(r))
	return string(r)
}

func main() {
	n := readInt()
	for i := 0; i < n; i++ {
		l := readInt()
		arr := readInts()
		cp := make([]int, len(arr))
		copy(cp, arr)
		sort.Ints(arr)
		//writeLine(cp)
		//writeLine(arr)
		for i := 0; i < l; i++ {
			var d int
			if cp[i] == arr[len(arr)-1] {
				d = cp[i] - arr[len(arr)-2]
			} else {
				d = cp[i] - arr[len(arr)-1]
			}
			//fmt.Printf("d====>%v\n", d)
			write(d)
		}
		writeLine()
	}
}

/* ~~~~~~~~~~ */
/* ~~~~~~~~~~ */
/* ~~~~~~~~~~ */

var in = bufio.NewReader(os.Stdin)

type float = float32
type double = float64
type long = int64
type ulong = uint64

func typeOf(arg interface{}) string {
	switch reflect.TypeOf(arg).Kind() {
	case reflect.Int:
		return "int"
	case reflect.Int8:
		return "int8"
	case reflect.Int16:
		return "int16"
	case reflect.Int32:
		return "int32"
	case reflect.Int64:
		return "int64"
	case reflect.Uint:
		return "uint"
	case reflect.Uint8:
		return "uint8"
	case reflect.Uint16:
		return "uint16"
	case reflect.Uint32:
		return "uint32"
	case reflect.Uint64:
		return "uint64"
	case reflect.Float32:
		return "float32"
	case reflect.Float64:
		return "float64"
	case reflect.Complex64:
		return "complex64"
	case reflect.Complex128:
		return "complex128"
	case reflect.Bool:
		return "bool"
	case reflect.String:
		return "string"
	case reflect.Chan:
		return "chan"
	case reflect.Ptr:
		return "ptr"
	case reflect.Uintptr:
		return "uintptr"
	case reflect.UnsafePointer:
		return "unsafeptr"
	case reflect.Interface:
		return "interface"
	case reflect.Array:
		return "array"
	case reflect.Slice:
		return "slice"
	case reflect.Map:
		return "map"
	case reflect.Struct:
		return "struct"
	case reflect.Func:
		return "func"
	case reflect.Invalid:
		return "invalid"
	default:
		return "nil"
	}
}

/* ~~~~~~~~~~ */

func _scln() string {
	ln, _ := in.ReadString('\n')
	return strings.Trim(ln, " \r\n")
}
func _sc(s []string) string {
	if len(s) == 0 {
		return _scln()
	}
	return s[0]
}

func readLine() string              { return _scln() }
func readString() string            { return _scln() }
func readStrings() []string         { return strings.Split(_scln(), " ") }
func readBool(s ...string) bool     { t, _ := strconv.ParseBool(_sc(s)); return t }
func readByte(s ...string) byte     { t, _ := strconv.ParseUint(_sc(s), 10, 8); return byte(t) }
func readDouble(s ...string) double { t, _ := strconv.ParseFloat(_sc(s), 64); return t }
func readFloat(s ...string) float   { t, _ := strconv.ParseFloat(_sc(s), 32); return float32(t) }
func readInt(s ...string) int       { t, _ := strconv.Atoi(_sc(s)); return t }
func readLong(s ...string) long     { t, _ := strconv.ParseInt(_sc(s), 10, 64); return t }
func readULong(s ...string) ulong   { t, _ := strconv.ParseUint(_sc(s), 10, 64); return t }

/* ~~~~~~~~~~ */

// Too much overhead with universal method using interface{}, wait for the generics,
// but for now — just don't look at the redundancy of the code after that commentary :)

func readBools() []bool {
	strs := readStrings()
	arr := make([]bool, len(strs))
	for i, s := range strs {
		arr[i] = readBool(s)
	}
	return arr
}
func readBytes() []byte {
	strs := readStrings()
	arr := make([]byte, len(strs))
	for i, s := range strs {
		arr[i] = readByte(s)
	}
	return arr
}
func readDoubles() []double {
	strs := readStrings()
	arr := make([]double, len(strs))
	for i, s := range strs {
		arr[i] = readDouble(s)
	}
	return arr
}
func readFloats() []float {
	strs := readStrings()
	arr := make([]float, len(strs))
	for i, s := range strs {
		arr[i] = readFloat(s)
	}
	return arr
}
func readInts() []int {
	strs := readStrings()
	arr := make([]int, len(strs))
	for i, s := range strs {
		arr[i] = readInt(s)
	}
	return arr
}
func readLongs() []long {
	strs := readStrings()
	arr := make([]long, len(strs))
	for i, s := range strs {
		arr[i] = readLong(s)
	}
	return arr
}
func readULongs() []ulong {
	strs := readStrings()
	arr := make([]ulong, len(strs))
	for i, s := range strs {
		arr[i] = readULong(s)
	}
	return arr
}

/* ~~~~~~~~~~ */

func write(arg ...interface{})                 { fmt.Print(arg...) }
func writeLine(arg ...interface{})             { fmt.Println(arg...) }
func writeFormat(f string, arg ...interface{}) { fmt.Printf(f, arg...) }

/*
	A template for Go on codeforces.com
	Author: Yakov, frvr.ru
*/

package main

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

// to sort a string
type sortRunes []rune

func (s sortRunes) Less(i, j int) bool {
	return s[i] < s[j]
}

func (s sortRunes) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

func (s sortRunes) Len() int {
	return len(s)
}

func SortString(s string) string {
	r := []rune(s)
	sort.Sort(sortRunes(r))
	return string(r)
}

func main() {
	n := readInt()
	for i := 0; i < n; i++ {
		l := readInt()
		arr := readInts()
		cp := make([]int, len(arr))
		copy(cp, arr)
		sort.Ints(arr)
		var ans []int
		//writeLine(cp)
		//writeLine(arr)
		for i := 0; i < l; i++ {
			var d int
			if cp[i] == arr[len(arr)-1] {
				d = cp[i] - arr[len(arr)-2]
			} else {
				d = cp[i] - arr[len(arr)-1]
			}
			//fmt.Printf("d====>%v\n", d)
			ans = append(ans, d)
		}
		writeLine(ans)
	}
}

/* ~~~~~~~~~~ */
/* ~~~~~~~~~~ */
/* ~~~~~~~~~~ */

var in = bufio.NewReader(os.Stdin)

type float = float32
type double = float64
type long = int64
type ulong = uint64

func typeOf(arg interface{}) string {
	switch reflect.TypeOf(arg).Kind() {
	case reflect.Int:
		return "int"
	case reflect.Int8:
		return "int8"
	case reflect.Int16:
		return "int16"
	case reflect.Int32:
		return "int32"
	case reflect.Int64:
		return "int64"
	case reflect.Uint:
		return "uint"
	case reflect.Uint8:
		return "uint8"
	case reflect.Uint16:
		return "uint16"
	case reflect.Uint32:
		return "uint32"
	case reflect.Uint64:
		return "uint64"
	case reflect.Float32:
		return "float32"
	case reflect.Float64:
		return "float64"
	case reflect.Complex64:
		return "complex64"
	case reflect.Complex128:
		return "complex128"
	case reflect.Bool:
		return "bool"
	case reflect.String:
		return "string"
	case reflect.Chan:
		return "chan"
	case reflect.Ptr:
		return "ptr"
	case reflect.Uintptr:
		return "uintptr"
	case reflect.UnsafePointer:
		return "unsafeptr"
	case reflect.Interface:
		return "interface"
	case reflect.Array:
		return "array"
	case reflect.Slice:
		return "slice"
	case reflect.Map:
		return "map"
	case reflect.Struct:
		return "struct"
	case reflect.Func:
		return "func"
	case reflect.Invalid:
		return "invalid"
	default:
		return "nil"
	}
}

/* ~~~~~~~~~~ */

func _scln() string {
	ln, _ := in.ReadString('\n')
	return strings.Trim(ln, " \r\n")
}
func _sc(s []string) string {
	if len(s) == 0 {
		return _scln()
	}
	return s[0]
}

func readLine() string              { return _scln() }
func readString() string            { return _scln() }
func readStrings() []string         { return strings.Split(_scln(), " ") }
func readBool(s ...string) bool     { t, _ := strconv.ParseBool(_sc(s)); return t }
func readByte(s ...string) byte     { t, _ := strconv.ParseUint(_sc(s), 10, 8); return byte(t) }
func readDouble(s ...string) double { t, _ := strconv.ParseFloat(_sc(s), 64); return t }
func readFloat(s ...string) float   { t, _ := strconv.ParseFloat(_sc(s), 32); return float32(t) }
func readInt(s ...string) int       { t, _ := strconv.Atoi(_sc(s)); return t }
func readLong(s ...string) long     { t, _ := strconv.ParseInt(_sc(s), 10, 64); return t }
func readULong(s ...string) ulong   { t, _ := strconv.ParseUint(_sc(s), 10, 64); return t }

/* ~~~~~~~~~~ */

// Too much overhead with universal method using interface{}, wait for the generics,
// but for now — just don't look at the redundancy of the code after that commentary :)

func readBools() []bool {
	strs := readStrings()
	arr := make([]bool, len(strs))
	for i, s := range strs {
		arr[i] = readBool(s)
	}
	return arr
}
func readBytes() []byte {
	strs := readStrings()
	arr := make([]byte, len(strs))
	for i, s := range strs {
		arr[i] = readByte(s)
	}
	return arr
}
func readDoubles() []double {
	strs := readStrings()
	arr := make([]double, len(strs))
	for i, s := range strs {
		arr[i] = readDouble(s)
	}
	return arr
}
func readFloats() []float {
	strs := readStrings()
	arr := make([]float, len(strs))
	for i, s := range strs {
		arr[i] = readFloat(s)
	}
	return arr
}
func readInts() []int {
	strs := readStrings()
	arr := make([]int, len(strs))
	for i, s := range strs {
		arr[i] = readInt(s)
	}
	return arr
}
func readLongs() []long {
	strs := readStrings()
	arr := make([]long, len(strs))
	for i, s := range strs {
		arr[i] = readLong(s)
	}
	return arr
}
func readULongs() []ulong {
	strs := readStrings()
	arr := make([]ulong, len(strs))
	for i, s := range strs {
		arr[i] = readULong(s)
	}
	return arr
}

/* ~~~~~~~~~~ */

func write(arg ...interface{})                 { fmt.Print(arg...) }
func writeLine(arg ...interface{})             { fmt.Println(arg...) }
func writeFormat(f string, arg ...interface{}) { fmt.Printf(f, arg...) }

package main

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

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

func main() {
	var t, n int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &n)
		a := make([]int, n)
		s := make([]int, n)
		for j := 0; j < n; j++ {
			fmt.Fscan(in, &a[j])
		}
		copy(s, a)
		sort.Ints(a)
		for j := 0; j < n; j++ {
			if s[j] == a[n-1] {
				s[j] -= a[n-2]
			} else {
				s[j] -= a[n-1]
			}
		}
		fmt.Println(s)
	}
}

package main

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

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

// source: _
func solve() {
	n, arr := _readArr()
	fm, sm := 0, 0

	for _, i := range arr {
		if i > fm {
			sm = fm
			fm = i
		} else if i > sm {
			sm = i
		}
	}

	res := make([]int, 0, n)
	for _, i := range arr {
		if i == fm {
			res = append(res, i-sm)
		} else {
			res = append(res, i-fm)
		}
	}
	_print(res)
}

func main() {
	defer out.Flush()
	var t int
	for fmt.Fscanln(in, &t); t > 0; t-- {
		solve()
	}
}

// ====
func _readInt() int {
	var x int
	fmt.Fscan(in, &x)
	return x
}
func _readStr() string {
	var x string
	fmt.Fscan(in, &x)
	return x
}
func _readArr(x ...int) (int, []int) {
	var n int
	if len(x) == 0 {
		fmt.Fscan(in, &n)
	} else {
		n = x[0]
	}
	var v = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &v[i])
	}
	return n, v
}
func _print(x ...any) {
	fmt.Fprintln(out, x...)
}
func _max(x ...int) int {
	mi := 0
	for i := 1; i < len(x); i++ {
		if x[i] > x[mi] {
			mi = i
		}
	}
	return x[mi]
}
func _min(x ...int) int {
	mi := 0
	for i := 1; i < len(x); i++ {
		if x[i] < x[mi] {
			mi = i
		}
	}
	return x[mi]
}
func _sum(x ...int) int {
	res := 0
	for _, i := range x {
		res += i
	}
	return res
}
func _abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}
func _sortStr(x string) string {
	r := []rune(x)
	sort.Slice(r, func(i, j int) bool {
		return r[i] < r[j]
	})
	return string(r)
}
func _reverseInts(x []int) {
	n := len(x)
	for i := 0; i < n/2; i++ {
		x[i], x[n-1-i] = x[n-1-i], x[i]
	}
}
func _reverseStr(s string) string {
	x := []rune(s)
	n := len(x)
	for i := 0; i < n/2; i++ {
		x[i], x[n-1-i] = x[n-1-i], x[i]
	}
	return string(x)
}
func _makeMatrix(n, m int) [][]int {
	x := make([][]int, n)
	for i := range x {
		x[i] = make([]int, m)
	}
	return x
}


package main

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

func main() {
	fsc := NewFastScanner()

	N := fsc.NextInt()
	K := fsc.NextInt()
	A := make([]int, N)
	for i := 0; i < N; i++ {
		A[i] = fsc.NextInt()
	}
	if K == 1 {
		fmt.Println(A[0])
		return
	}
	for i := 1; i <= N; i++ {
		var res1, res2 int64
		res1 = int64(i) * (int64(i) + 1) / 2
		res2 = int64(i+1) * (int64(i) + 2) / 2
		if res1 < int64(K) && int64(K) <= res2 {
			K -= int(res1)
			fmt.Println(A[K-1])
			break
		}
	}

}

//template

type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 2028)
	return &FastScanner{r: rdr}
}

func (s *FastScanner) Next() string {
	s.Pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *FastScanner) NextInt() int {
	val, err := strconv.Atoi(s.Next())
	if err != nil {
		panic(err)
	}
	return val
}

func (s *FastScanner) Pre() {
	if s.p >= len(s.buf) {
		s.ReadLine()
		s.p = 0
	}
}

func (s *FastScanner) ReadLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, err := s.r.ReadLine()
		if err != nil {
			panic(err.Error())
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

package main

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

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

	id := make([]int, n)
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	for i := 0; scanner.Scan() && i < n; i++ {
		a, err := strconv.Atoi(scanner.Text())
		if err != nil {
			fmt.Println("Error!")
			return
		}
		id[i] = a
	}

	i := 1
	for i <= n {
		if int64(i)*int64(i+1)/2 >= int64(k) {
			break
		}
		i++
	}
	fmt.Println(id[int(int64(k)-int64(i)*int64(i-1)/2-1)])
}

package main

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

var a [100005]int
var sum [100005]int

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

	var n, k int

	fmt.Fscanf(cin, "%d %d\n", &n, &k)

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

	for i := 1; i <= n; i++ {
		sum[i] = sum[i - 1] + i
		if sum[i] >= k {
			fmt.Println(a[k - sum[i - 1] - 1])
			break
		}
	}
}

package main

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

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

	id := make([]int, n)
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	for i := 0; scanner.Scan() && i < n; i++ {
		a, err := strconv.Atoi(scanner.Text())
		if err != nil {
			fmt.Println("Error!")
			return
		}
		id[i] = a
	}

	for i := 0; i <= n; i++ {
		if int64(i)*int64(i+1)/2 >= int64(k) {
			fmt.Println(id[int(int64(k)-int64(i)*int64(i-1)/2-1)])
			break
		}
	}
}

package main

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

func main() {
	cin := bufio.NewReader(os.Stdin)
	var n, k int32
	var id [100010]int32
	var sum [100010]int32
	var i int32
	fmt.Scanf("%d %d\n", &n, &k)
	sum[0] = 0

	for i = 1; i <= n; i++ {
		fmt.Fscanf(cin, "%d", &id[i])
	}
	for i = 1; i <= n; i++ {
		sum[i] += sum[i-1] + i
	}
	ret := 0
	for ret = 1; sum[ret] < k; {
		ret++
	}
	fmt.Printf("%d\n", id[k-sum[ret-1]])
}

package main

import (
	"fmt"
)

func main() {
	var n, k int
	var id [100010]int
	fmt.Scanf("%d %d", &n, &k)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &id[i])
	}

	fmt.Println(id[n%k])
}

/*
10
10 4
10 4 18
10 4 18 3

5 / 4 = 1 ... 1
*/

package main

import (
	"fmt"
)

func main() {
	var n, k int
	var id [100010]int
	var sum [100010]int
	fmt.Scanf("%d %d", &n, &k)
	sum[0] = 0
	for i := 1; i <= n; i++ {
		fmt.Scanf("%d", &id[i])
	}
	for i := 1; i <= n; i++ {
		sum[i] += sum[i-1] + i
	}
	ret := 0
	for ret = 1; sum[ret] < k; {
		ret++
	}
	fmt.Println(id[k-sum[ret-1]])
}

/*
1
3
6
10

10
10 4
10 4 18
10 4 18 3
*/

package main

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

func main() {
	cin := bufio.NewReader(os.Stdin)
	var n, k int32
	var id [100010]int32
	var sum [100010]int32
	var i int32
	fmt.Fscanf(cin, "%d %d\n", &n, &k)
	sum[0] = 0
	ret := 0
	for i = 1; i <= n; i++ {
		fmt.Fscanf(cin, "%d", &id[i])
		sum[i] += sum[i-1] + i
		if sum[ret] <= k {
			ret++
		}
	}
	fmt.Fprintf(os.Stdout, "%d\n", id[k-sum[ret-1]])
}

package main

import (
	"fmt"
	"os"
)

func main() {
	var n, k int
	var id [100010]int
	var sum [100010]int
	fmt.Scanf("%d %d", &n, &k)
	sum[0] = 0
	for i := 1; i <= n; i++ {
		fmt.Scanf("%d", &id[i])
	}
	for i := 1; i <= n; i++ {
		sum[i] += sum[i-1] + i
	}
	ret := 0
	for ret = 1; sum[ret] < k; {
		ret++
	}
	fmt.Fprintf(os.Stdout, "%d\n", id[k-sum[ret-1]])
}

package main

import (
	"fmt"
)

func main() {
	var n, k int
	var id [100010]int
	fmt.Scanf("%d %d", &n, &k)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &id[i])
	}

	fmt.Println(id[k%n])
}

/*
10
10 4
10 4 18
10 4 18 3

9 :
5 / 4 = 1 ... 1
*/

package main

import (
	"fmt"
	"os"
)

func main() {
	var n, k int32
	var id [100010]int32
	var sum [100010]int32
	var i int32
	fmt.Scanf("%d %d\n", &n, &k)
	sum[0] = 0
	ret := 0

	for i = 1; i <= n; i++ {
		fmt.Scanf("%d", &id[i])
		sum[i] += sum[i-1] + i
		if sum[ret] <= k {
			ret++
		}
	}
	fmt.Fprintf(os.Stdout, "%d\n", id[k-sum[ret-1]])
}

package main

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

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

	id := make([]int, n)
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	for i := 0; scanner.Scan() && i < n; i++ {
		a, err := strconv.Atoi(scanner.Text())
		if err != nil {
			fmt.Fprintf(os.Stderr, "Error\n")
			return
		}
		id[i] = a
	}

	for i := 1; i <= n; i++ {
		if i*(i+1)/2 >= k {
			fmt.Println(id[k-i*(i-1)/2-1])
			break
		}
	}
}

package main

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

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

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

	for i := 1; i <= n; i++ {
		if i*(i+1)/2 > k {
			fmt.Println(id[k-i*(i-1)/2-1])
			break
		}
	}
}

package main

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

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

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

	for i := 1; i <= n; i++ {
		if i*(i+1)/2 >= k {
			fmt.Println(id[k-i*(i-1)/2-1])
			break
		}
	}
}

package main

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

func main() {
	fsc := NewFastScanner()

	N := fsc.NextInt()
	K := fsc.NextInt()

	A := make([]int, N)
	for i := 0; i < N; i++ {
		A[i] = fsc.NextInt()
	}

	for i := 1; i <= N; i++ {
		var res1, res2 int64
		res1 = int64(i) * (int64(i) + 1) / 2
		res2 = int64(i+1) * (int64(i) + 2) / 2
		if res1 < int64(K) && int64(K) <= res2 {
			K -= int(res1)
			fmt.Println(A[K-1])
			break
		}
	}

}

//template

type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 2028)
	return &FastScanner{r: rdr}
}

func (s *FastScanner) Next() string {
	s.Pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *FastScanner) NextInt() int {
	val, err := strconv.Atoi(s.Next())
	if err != nil {
		panic(err)
	}
	return val
}

func (s *FastScanner) Pre() {
	if s.p >= len(s.buf) {
		s.ReadLine()
		s.p = 0
	}
}

func (s *FastScanner) ReadLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, err := s.r.ReadLine()
		if err != nil {
			panic(err.Error())
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

package main

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

var a [100005]int
var sum [100005]int

func main() {
	cin := bufio.NewReader(os.Stdin)
	cout := bufio.NewWriter(os.Stderr)
	defer cout.Flush()

	var n, k int

	fmt.Fscanf(cin, "%d %d\n", &n, &k)

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

	for i := 1; i <= n; i++ {
		sum[i] = sum[i - 1] + i
		if sum[i] >= k {
			fmt.Fprintln(cout, a[k - sum[i - 1] - 1])
			break
		}
	}
}

package main

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

var a [100005]int
var sum [100005]int

func main() {
	cin := bufio.NewReader(os.Stdin)
	cout := bufio.NewWriter(os.Stdout)

	var n, k int

	fmt.Fscanf(cin, "%d %d\n", &n, &k)

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

	for i := 1; i <= n; i++ {
		sum[i] = sum[i - 1] + i
		if sum[i] >= k {
			fmt.Fprintln(cout, a[k - sum[i - 1] - 1])
			break
		}
	}
}

package main

import (
	"fmt"
	"math"
)

var a [100005]int

func main() {
	var n, k int
	fmt.Scanf("%d %d\n", &n, &k)

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

	c := int(math.Sqrt(float64(k) * 2))
	r := k - (c-1) * (c) / 2

	fmt.Println(a[r - 1])
}

package main

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

var a [100005]int
var sum [100005]int

func main() {
	cin := bufio.NewReader(os.Stdin)
	cout := bufio.NewWriter(os.Stderr)

	var n, k int

	fmt.Fscanf(cin, "%d %d\n", &n, &k)

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

	for i := 1; i <= n; i++ {
		sum[i] = sum[i - 1] + i
		if sum[i] >= k {
			fmt.Fprintln(cout, a[k - sum[i - 1] - 1])
			break
		}
	}
	cout.Flush()
}