#include<bits/stdc++.h>
using namespace std;

#define int long long 
// #define endl '\n' 

int n, m;
int cnt[100005];

void solve() {
  cin >> n >> m;

  fill(cnt, cnt + m, 0);

  string str;
  for (int i = 0; i < n; i++) {
    cin >> str;
    for (int j = 0; j < m; j++) {
      cnt[j] += str[j] - 'a' + 1;
    }
  }

  for (int i = 0; i < n - 1; i++) {
    cin >> str;
    for (int j = 0; j < m; j++) {
      cnt[j] -= str[j] - 'a' + 1;
    }
  }

  for (int j = 0; j < m; j++) {
    cout << (char)(cnt[j] + 'a' - 1);
  }
  cout << endl;
}

signed main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  
  int tt = 1;
  cin >> tt;

  while (tt--) {
    solve();
  }

  return 0;
}