#include "iostream"
#include "string"
using namespace std;
string str[25];
int main()
{
int testcase, i, j, k, time;
cin >> testcase;
while (testcase--)
{
cin >> time;
for (i = 0; i < time; i++)
cin >> str[i];
for (i = 1; i < time; i++)
for (j = 0; j < 12; j++)
{
for (k = 0; k < 12; k++)
if (str[0][j] == str[i][k])
break;
if (k == 12)
str[0][j] = '#';
else
str[i][k] = '#';
}
for (i = 65; i <91; i++)//output
the remaining letters in alphabet order after the process described
above
for (j = 0; j < 12;
j++)//怪不得WA,得按字母表顺序输出,也难怪写这么难看的二重for
{
if (str[0][j] == i)
cout << str[0][j];
}
cout << endl;
}
}