#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
string a[200005];
int main(){
	int t;
	cin>>t;
	while(t--){
		int n,m;
		cin>>n>>m;
		for(int i=1;i<=n*2-1;i++) cin>>a[i];
		int x=0;
		for(int i=0;i<m;i++){
			x=0;
			for(int j=1;j<=n*2-1;j++){
				x^=a[j][i];
			}
			cout<<char(x);
		}
		cout<<endl;
	}
	return 0;
}

//luogu is the best!!!