#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=998244353;

ll power(ll a, ll b)
{
	if(b==0) return 1;
	ll w=power(a,b/2);
	w=(w*w)%mod;
	
	return b%2==0 ? w:(w*a)%mod;
}

void solve()
{
	int n,m;
	cin>>n>>m;
	vector<int>v(m);
	for(int i=0;i<n;++i)
	{
		string s;
		cin>>s;
		for(int j=0;j<m;++j) v[j]+=(s[j]-'a');
	}
	
	for(int i=1;i<n;++i)
	{
		string s;
		cin>>s;
		for(int j=0;j<m;++j) v[j]-=(s[j]-'a');
	}
	
	for(int i=0;i<m;++i) cout<<(char)(v[i]+'a');
	cout<<endl;
	
}
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(nullptr);
	cout.tie(nullptr);
	srand(time(0));
	
	int T=1;
	cin>>T;
	while(T--) solve();
	
}