from sys import stdin, stdout

class SOLVE:
    def solve(self):
        R = stdin.readline
        W = stdout.write

        ans = []
        for i in range(int(input())):
            n = R()
            a = [int(x) for x in R().split()]
            
            if len(a) == 1:
                print(*a)
                continue
            
            a.sort()
            a = a[-1:] + a[:-1]
            
            print(*a)

        #W('\n'.join(ans))
    
def main():
    s = SOLVE()
    s.solve()
main()