import java.util.Arrays;
import java.io.*;
public class Main {
    public static void main (String[]args)throws Exception{
    BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
    
    int cases = Integer.parseInt(read.readLine());
    
    int words;
    String string="";
    String[] string2;
    String[] []A = new String [0][];
    
    for(int i=0;i<cases;i++){
        words = Integer.parseInt(read.readLine());
        for(int c=0;c<words;c++){
            string = read.readLine() + " " + string;
        }
        string2 = string.split(" ");
        Arrays.sort(string2);
        for(int c=0;c<words;c++){
            System.out.println(string2[c]);
        }
        string ="";

    }
    
    }
}