import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class GFG {

	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int t = Integer.parseInt(reader.readLine());
		while (t-- > 0) {
			int n = Integer.parseInt(reader.readLine());
			Integer[] a = stringArrayToIntegerList(reader.readLine().split(" "), n);
			Arrays.sort(a, (int1, int2) -> Integer.parseInt(int2 + "" + int1) - Integer.parseInt(int1 + "" + int2));
			for (int i : a) {
				System.out.print(i);
			}
			System.out.println();
		}
	}

	private static Integer[] stringArrayToIntegerList(String[] temp, int size) {
		Integer[] a = new Integer[size];
		for (int i = 0; i < size; i++) {
			a[i] = Integer.parseInt(temp[i]);
		}
		return a;
	}

}