#include<bits/stdc++.h>
using namespace std;
#define ll         long long int
#define vi         vector<int>
#define vl         vector<ll>
#define vpi         vector<pair<int,int>>
#define vpl         vector<pair<ll,ll>>
#define f(i,n)     for(int i=0;i<n;i++)
#define fs(i,j,n)     for(int i=j;i<n;i++)
#define fr(i,n)     for(int i=n-1;i>=0;i--)
#define yes        cout<<"Yes"<<"\n"
#define no         cout<<"No"<<"\n"
#define check         cout<<"Check!"<<"\n"


 
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("D:/VS code/input.txt","r",stdin);
    freopen("D:/VS code/output.txt","w",stdout);
    #endif
 
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
 
    int cases=1,n,k,m;
    string s;
    cin>>cases;
    while(cases--)
    {
        cin>>n>>m;
        vector<vector<int>> v(m, vector<int> (26,0));
        string B="";
        n+=n-1;
        f(i,n)
        {
            cin>>s;
            f(j,m) v[j][s[j]-'a']++;
        }
        f(j,m)
        {
            f(i,26)
            {
                if(v[j][i] & 1)
                {
                    B.push_back(i+'a');
                    break;
                }
            }
        }
        cout<<B<<endl;
    }
    
    return 0;
}