int t = 0;
Scanner sc = new Scanner(System.in);
if (sc.hasNext()) {
t = sc.nextInt();
}
while (t-- != 0) {
int n = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
String s = "";
for (int i = 0; i < n; i++) {
if (s.compareTo(""+a[i]) > 0) {
s += a[i];
} else {
s = a[i] + s;
}
}
for(int i =0;i<s.length();i++) {
System.out.print((int)(s.charAt(i)-48));
}
}