#include <iostream>
using namespace std;

int my_compare(int a, int b, int i, int j)
{
    char num1[200];
    char num2[200];
    
    sprintf(num2, "%d%d", b, a);
    sprintf(num1, "%d%d", a, b);
    
    int n1;
    sscanf(num1, "%d", &n1);
    int n2;
    sscanf(num2, "%d", &n2);
    if(n1 >= n2)
    {
        return 1;
    }
    else
    {
        return 2;
    }
}

void Merge(int arr[], int low, int mid, int high)
{
    int N1 = mid - low + 1;
    int N2 = high - mid;
    
    int L[N1];
    int R[N2];
    
    for(int i = 0; i < N1; i++)
    {
        L[i] = arr[low + i];
    }
    
    for(int j = 0; j < N2; j++)
    {
        R[j] = arr[mid+1 + j];
    }
    
    int i = 0;
    int j = 0;
    int k = low;
    
    while(i < N1 && j < N2)
    {
        int num = 0;
        num = my_compare(L[i], R[j], i, j);
        if(num == 1)
        {
            arr[k] = L[i];
            i++;
        }
        else
        {
            arr[k] = R[j];
            j++;
        }
        k++;
    }
    
    while( i < N1)
    {
        arr[k] = L[i];
        i++;
        k++;
    }
    while( j < N2)
    {
        arr[k] = R[j];
        j++;
        k++;
    }
}

void Largest_Num_Formed(int arr[], int low, int high)
{
    if(low < high)
    {
        int mid = (low+high)/2;
        Largest_Num_Formed(arr, low, mid);
        Largest_Num_Formed(arr, mid+1, high);
        Merge(arr, low, mid, high);
    }
}

int main() {
	//code
    int T, N, sum = 0;
	cin >> T;
	
	for(int i = 0; i < T; i++)
	{
	    
	    cin >> N;
		int arr[N];
	    for(int j = 0; j < N; j++)
	    {
	        cin >> arr[j];
	    }
	    
	    Largest_Num_Formed(arr, 0, N-1);
	    
	    for(int i = 0; i < N; i++)
	    {
	        cout<< arr[i];
	    }
	    cout<<endl;
	    
	}
	return 0;
}