AquaMoon had n strings of length m each. n is an odd number.

When AquaMoon was gone, Cirno tried to pair these n strings together. After making (n-1)/(2) pairs, she found out that there was exactly one string without the pair!

In her rage, she disrupted each pair of strings. For each pair, she selected some positions (at least 1 and at most m) and swapped the letters in the two strings of this pair at the selected positions.

For example, if m = 6 and two strings "abcdef" and "xyzklm" are in one pair and Cirno selected positions 2, 3 and 6 she will swap 'b' with 'y', 'c' with 'z' and 'f' with 'm'. The resulting strings will be "ayzdem" and "xbcklf".

Cirno then stole away the string without pair and shuffled all remaining strings in arbitrary order.

AquaMoon found the remaining n-1 strings in complete disarray. Also, she remembers the initial n strings. She wants to know which string was stolen, but she is not good at programming. Can you help her?

Input

This problem is made as interactive. It means, that your solution will read the input, given by the interactor. But the interactor will give you the full input at the beginning and after that, you should print the answer. So you should solve the problem, like as you solve the usual, non-interactive problem because you won't have any interaction process. The only thing you should not forget is to flush the output buffer, after printing the answer. Otherwise, you can get an "Idleness limit exceeded" verdict. Refer to the [interactive problems guide](https://codeforces.com/blog/entry/45307) for the detailed information about flushing the output buffer.

The input consists of multiple test cases. The first line contains a single integer t (1 ≤ t ≤ 100) — the number of test cases.

The first line of each test case contains two integers n, m (1 ≤ n ≤ 10^5, 1 ≤ m ≤ 10^5) — the number of strings and the length of each string, respectively.

The next n lines each contain a string with length m, describing the original n strings. All string consists of lowercase Latin letters.

The next n-1 lines each contain a string with length m, describing the strings after Cirno exchanged and reordered them.

It is guaranteed that n is odd and that the sum of n ⋅ m over all test cases does not exceed 10^5.

Hack format:

The first line should contain a single integer t. After that t test cases should follow in the following format:

The first line should contain two integers n and m.

The following n lines should contain n strings of length m, describing the original strings.

The following (n-1)/(2) lines should describe the pairs. They should contain, in the following order: the index of the first string i (1 ≤ i ≤ n), the index of the second string j (1 ≤ j ≤ n, i ≠ j), the number of exchanged positions k (1 ≤ k ≤ m), and the list of k positions that are exchanged (k distinct indices from 1 to m in any order).

The final line should contain a permutation of integers from 1 to n, describing the way the strings should be reordered. The strings will be placed in the order indices placed in this permutation, the stolen string index will be ignored.

Output

For each test case print a single line with the stolen string.

Example

Input


3
3 5
aaaaa
bbbbb
ccccc
aaaaa
bbbbb
3 4
aaaa
bbbb
cccc
aabb
bbaa
5 6
abcdef
uuuuuu
kekeke
ekekek
xyzklm
xbcklf
eueueu
ayzdem
ukukuk


Output


ccccc
cccc
kekeke

Note

In the first test case, "aaaaa" and "bbbbb" exchanged all positions, and "ccccc" is the stolen string.

In the second test case, "aaaa" and "bbbb" exchanged two first positions, and "cccc" is the stolen string.

This is the first test in the hack format: 
    
    
      
    3  
    3 5  
    aaaaa  
    bbbbb  
    ccccc  
    1 2 5 1 2 3 4 5  
    2 1 3  
    3 4  
    aaaa  
    bbbb  
    cccc  
    1 2 2 1 2  
    2 1 3  
    5 6  
    abcdef  
    uuuuuu  
    kekeke  
    ekekek  
    xyzklm  
    1 5 3 2 3 6  
    2 4 3 2 4 6  
    5 4 1 2 3

Source: codeforces | Difficulty: EASY
Tags: Mathematics


Solutions:
import sys
input = sys.stdin.readline

def solve():
	(n, m) = map(int, input().split())
	original = [input() for _ in range(n)]
	modified = [input() for _ in range(n - 1)]
	stolen_chars = []
	for j in range(m):
		chars_available = 0
		for i in range(n):
			chars_available += ord(original[i][j])
		for i in range(n - 1):
			chars_available -= ord(modified[i][j])
		stolen_chars.append(chr(chars_available))
	return ''.join(stolen_chars)
t = int(input())
output = []
for _ in range(t):
	print(solve())
sys.stdout.flush()


import sys
from copy import deepcopy
input = sys.stdin.readline
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	total = [0 for _ in range(m)]
	for i in range(n):
		tmp = list(input().rstrip())
		for j in range(len(tmp)):
			total[j] += ord(tmp[j])
	for i in range(n - 1):
		tmp = list(input().rstrip())
		for j in range(len(tmp)):
			total[j] -= ord(tmp[j])
	for i in range(m):
		print(chr(total[i]), end='', flush=True)
	print()


import os.path
from math import gcd, floor, ceil
from collections import *
import sys
mod = 1000000007
INF = float('inf')

def st():
	return list(sys.stdin.readline().strip())

def li():
	return list(map(int, sys.stdin.readline().split()))

def mp():
	return map(int, sys.stdin.readline().split())

def inp():
	return int(sys.stdin.readline())

def pr(n):
	return sys.stdout.write(str(n) + '\n')

def prl(n):
	return sys.stdout.write(str(n) + ' ')
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def solve():
	(n, m) = mp()
	l = [st() for i in range(n)]
	x = [st() for i in range(n - 1)]
	ans = []
	for i in range(m):
		d = defaultdict(int)
		for j in range(n):
			d[l[j][i]] += 1
		for j in range(n - 1):
			d[x[j][i]] -= 1
			if d[x[j][i]] == 0:
				del d[x[j][i]]
		for j in d:
			ans.append(j)
	print(*ans, sep='', flush=True)
for _ in range(inp()):
	solve()


import sys
import math
import heapq
import bisect
from collections import Counter
from collections import defaultdict
from io import BytesIO, IOBase
import string

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None
		self.BUFSIZE = 8192

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def get_int():
	return int(input())

def get_ints():
	return list(map(int, input().split(' ')))

def get_int_grid(n):
	return [get_ints() for _ in range(n)]

def get_str():
	return input().strip()

def get_strs():
	return get_str().split(' ')

def flat_list(arr):
	return [item for subarr in arr for item in subarr]

def yes_no(b):
	if b:
		return 'YES'
	else:
		return 'NO'

def binary_search(good, left, right, delta=1, right_true=False):
	limits = [left, right]
	while limits[1] - limits[0] > delta:
		if delta == 1:
			mid = sum(limits) // 2
		else:
			mid = sum(limits) / 2
		if good(mid):
			limits[int(right_true)] = mid
		else:
			limits[int(~right_true)] = mid
	if good(limits[int(right_true)]):
		return limits[int(right_true)]
	else:
		return False

def prefix_sums(a):
	p = [0]
	for x in a:
		p.append(p[-1] + x)
	return p

def solve_a():
	n = get_int()
	a = get_ints()
	b = get_ints()
	if sum(a) != sum(b):
		print(-1)
		return
	else:
		less = []
		more = []
		for (i, x) in enumerate(a):
			if x > b[i]:
				more.extend([i] * (x - b[i]))
			elif x < b[i]:
				less.extend([i] * (b[i] - x))
	print(len(more))
	while less:
		print(more.pop() + 1, less.pop() + 1)
	return

def solve_b():
	(n, m) = get_ints()
	letters = string.ascii_lowercase
	alpha = {x: i for (i, x) in enumerate(letters)}
	G = [[0] * 26 for _ in range(m)]
	H = [[0] * 26 for _ in range(m)]
	for _ in range(n):
		s = list(get_str())
		for j in range(m):
			G[j][alpha[s[j]]] += 1
	for _ in range(n - 1):
		s = list(get_str())
		for j in range(m):
			H[j][alpha[s[j]]] += 1
	ans = []
	for j in range(m):
		for c in range(26):
			if G[j][c] > H[j][c]:
				ans.append(letters[c])
				break
	print(''.join(ans), flush=True)
	return
t = get_int()
for _ in range(t):
	solve_b()


alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

def stringsum(a):
	ans = 0
	for x in a:
		ans += alpha.index(x)
	return ans
t = int(input())
for i in range(t):
	(n, m) = list(map(int, input().strip().split()))
	ostrings = []
	rstrings = []
	bsum1 = []
	bsum2 = []
	bsum3 = []
	for i in range(n):
		ostrings.append(input())
	for i in range(n - 1):
		rstrings.append(input())
	for i in range(m):
		s = 0
		for j in range(n):
			s += alpha.index(ostrings[j][i])
		bsum1.append(s)
	for i in range(m):
		s = 0
		for j in range(n - 1):
			s += alpha.index(rstrings[j][i])
		bsum2.append(s)
	for i in range(m):
		bsum3.append(bsum1[i] - bsum2[i])
	ans = ''
	for x in bsum3:
		ans = ans + alpha[x]
	print(ans)


from sys import *
from bisect import *
from math import *
from collections import *
from heapq import *
from itertools import *
inf = 10 ** 18
mod = 10 ** 9 + 7
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	temp = []
	for _ in range(n):
		s = input()
		temp.append(s)
	ans = ''
	for _ in range(n - 1):
		s = input()
		temp.append(s)
	for i in range(m):
		cnt = [0] * 26
		for j in range(len(temp)):
			if cnt[ord(temp[j][i]) - 97]:
				cnt[ord(temp[j][i]) - 97] -= 1
			else:
				cnt[ord(temp[j][i]) - 97] += 1
		for k in range(26):
			if cnt[k]:
				ans += chr(97 + k)
				break
	print(ans)
	stdout.flush()


import os
import sys
from io import BytesIO, IOBase
from collections import Counter

def main():
	for _ in range(int(input())):
		(n, m) = map(int, input().split())
		(a, ans) = ([[0] * 26 for _ in range(m)], [])
		for i in range(n):
			for (k, j) in enumerate(input().rstrip()):
				a[k][ord(j) - 97] += 1
		for i in range(n - 1):
			for (k, j) in enumerate(input().rstrip()):
				a[k][ord(j) - 97] -= 1
		for i in range(m):
			ans.append(a[i].index(1) + 97)
		print(''.join(map(chr, ans)))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


I = input
for _ in [0] * int(I()):
	r = ''
	for x in zip(*(I() for _ in [0] * (2 * int(I().split()[0]) - 1))):
		c = 0
		for y in x:
			c ^= ord(y)
		r += chr(c)
	print(r, flush=1)


def solve(arr, res, n, m):
	ans = []
	for i in range(m):
		temp = 0
		for j in range(n):
			temp += ord(arr[j][i])
		for j in range(n - 1):
			temp -= ord(res[j][i])
		ans += chr(temp)
	temp = ''
	for x in ans:
		temp += x
	return temp
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	arr = []
	for _ in range(n):
		arr.append(input())
	res = []
	for _ in range(n - 1):
		res.append(input())
	print(solve(arr, res, n, m))


import random
import collections
import string
import math
import copy
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
mo = int(1000000000.0 + 7)

def exgcd(a, b):
	if not b:
		return (1, 0)
	(y, x) = exgcd(b, a % b)
	y -= a // b * x
	return (x, y)

def getinv(a, m):
	(x, y) = exgcd(a, m)
	return -1 if x == 1 else x % m

def comb(n, b):
	res = 1
	b = min(b, n - b)
	for i in range(b):
		res = res * (n - i) * getinv(i + 1, mo) % mo
	return res % mo

def quickpower(a, n):
	res = 1
	while n:
		if n & 1:
			res = res * a % mo
		n >>= 1
		a = a * a % mo
	return res

def dis(a, b):
	return abs(a[0] - b[0]) + abs(a[1] - b[1])

def getpref(x):
	if x > 1:
		return x * (x - 1) >> 1
	else:
		return 0

def orafli(upp):
	primes = []
	marked = [False for i in range(upp + 3)]
	prvs = [i for i in range(upp + 3)]
	for i in range(2, upp):
		if not marked[i]:
			primes.append(i)
		for j in primes:
			if i * j >= upp:
				break
			marked[i * j] = True
			prvs[i * j] = j
			if i % j == 0:
				break
	return (primes, prvs)

def lower_ord(c: str) -> int:
	return ord(c) - 97

def upper_ord(c: str) -> int:
	return ord(c) - 65

def read_list():
	return [int(i) for i in input().split()]

def read_int():
	s = input().split()
	if len(s) == 1:
		return int(s[0])
	else:
		return map(int, s)

def ask(s):
	print(f'? {s}', flush=True)

def answer(s):
	print(f'{s}', flush=True)
import functools
import itertools
from fractions import Fraction

def lowbit(x):
	return -x & x

def solve():
	(n, m) = read_int()
	mat = [{} for ii in range(m)]
	for i in range(n):
		ss = input()
		for (p, j) in enumerate(ss):
			mat[p][j] = mat[p].get(j, 0) + 1
	for i in range(n - 1):
		ss = input()
		for (p, j) in enumerate(ss):
			mat[p][j] = mat[p].get(j, 0) - 1
			if mat[p][j] == 0:
				mat[p].pop(j)
	for kk in mat:
		print(kk.popitem()[0], end='')
	print()
T = int(input())
for ti in range(T):
	solve()


from collections import defaultdict
import math

def column(matrix, i):
	return [row[i] for row in matrix]
for cases in range(int(input())):
	(n, m) = map(int, input().split())
	d = defaultdict(list)
	og = []
	for i in range(0, n):
		s = list(input(''))
		og.append(s)
	rm = []
	for i in range(0, n - 1):
		s = list(input(''))
		rm.append(s)
	ans = ''
	num = []
	for i in range(0, m):
		s1 = column(og, i)
		s2 = column(rm, i)
		s1 = [ord(i) for i in s1]
		s2 = [ord(i) for i in s2]
		num.append(sum(s1) - sum(s2))
	ans = ''
	for i in num:
		ans += chr(i)
	print(ans)


import sys
import math
from collections import deque, Counter
int1 = lambda x: int(x) - 1
inp = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
mi1 = lambda : map(int1, input().split())
li1 = lambda : list(mi1())
mis = lambda : map(str, input().split())
lis = lambda : list(mis())
from collections import defaultdict
mod = 10 ** 9 + 7
Mod = 998244353
INF = 10 ** 18
ans = 0
t = inp()
for _ in range(t):
	ans = []
	(n, m) = mi()
	cnt = [[0] * 26 for i in range(m)]
	for i in range(2 * n - 1):
		s = input()
		for j in range(m):
			cnt[j][ord(s[j]) - 97] += 1
	for i in range(m):
		for j in range(26):
			if cnt[i][j] % 2 == 1:
				ans.append(chr(j + 97))
	print(*ans, sep='')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	gd = [[0 for _ in range(26)] for j in range(m)]
	wd = [[0 for _ in range(26)] for j in range(m)]
	arr1 = [input() for i in range(n)]
	arr2 = [input() for i in range(n - 1)]
	for i in arr1:
		for j in range(m):
			gd[j][ord(i[j]) - 97] += 1
	for i in arr2:
		for j in range(m):
			wd[j][ord(i[j]) - 97] += 1
	ans = ''
	for i in arr1:
		cp = [[j for j in i] for i in gd]
		for j in range(m):
			cp[j][ord(i[j]) - 97] -= 1
		if cp == wd:
			ans = i
			break
	sys.stdout.write(ans)
	sys.stdout.flush()


import random
import math
from collections import defaultdict
import itertools
from sys import stdin, stdout
import sys
import operator
from decimal import Decimal
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.buffer.readline())

def MI():
	return map(int, sys.stdin.buffer.readline().split())

def LI():
	return list(map(int, sys.stdin.buffer.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def BI():
	return sys.stdin.buffer.readline().rstrip()

def SI():
	return sys.stdin.buffer.readline().rstrip().decode()

def main():
	mod = 10 ** 9 + 7
	for _ in range(II()):
		(n, m) = MI()
		c = []
		d = []
		d1 = defaultdict(int)
		d2 = defaultdict(int)
		for _ in range(n):
			c.append(SI())
		for _ in range(n - 1):
			d.append(SI())
		ans = ''
		for j in range(m):
			for i in range(n):
				d1[c[i][j]] += 1
			for i in range(n - 1):
				d1[d[i][j]] -= 1
			for key in d1:
				if d1[key] == 1:
					ans += key
					d1[key] = 0
		print(ans)
		sys.stdout.flush()
main()


from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)
t = int(stdin.readline())
for _ in range(t):
	(n, m) = list(map(int, stdin.readline().rstrip().split()))
	i_arr = []
	f_arr = []
	for i in range(n):
		i_arr.append(stdin.readline().strip('\n'))
	for j in range(n - 1):
		f_arr.append(stdin.readline().strip('\n'))
	if n == 1:
		print(i_arr[0])
		continue
	answer = ''
	found = False
	for i in range(m):
		dictionary = {}
		for j in range(n - 1):
			if f_arr[j][i] not in dictionary:
				dictionary[f_arr[j][i]] = 0
			dictionary[f_arr[j][i]] += 1
		nd = {}
		for j in range(n):
			if i_arr[j][i] not in nd:
				nd[i_arr[j][i]] = 0
			nd[i_arr[j][i]] += 1
		for i in nd:
			if i not in dictionary:
				answer += i
				break
			elif nd[i] != dictionary[i]:
				answer += i
				break
	print(answer)
	stdout.flush()


import sys
from string import ascii_lowercase as alph
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	cnt = [0] * m
	for i in range(n):
		ind = 0
		for x in input():
			cnt[ind] += alph.index(x) + 1
			ind += 1
	for i in range(n - 1):
		ind = 0
		for x in input():
			cnt[ind] -= alph.index(x) + 1
			ind += 1
	for i in range(m):
		ind = cnt[i]
		if ind != 0:
			print(alph[ind - 1], end='')
	print()
	sys.stdout.flush()


from collections import defaultdict
from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	d = [0] * m
	for i in range(n):
		s = input()
		for j in range(m):
			d[j] += ord(s[j])
	ans = ''
	for i in range(n - 1):
		s = input()
		for j in range(m):
			d[j] -= ord(s[j])
	for i in range(m):
		ans += chr(d[i])
	print(ans, flush=True)


from sys import *
from collections import defaultdict as dd
from math import *
from bisect import *

def sinp():
	return stdin.readline()

def inp():
	return int(stdin.readline())

def minp():
	return map(int, stdin.readline().split())

def linp():
	return list(map(int, stdin.readline().split()))

def strl():
	return list(sinp())

def pr(x):
	print(x)
mod = int(1000000000.0 + 7)
for _ in range(inp()):
	(n, m) = minp()
	s = []
	for i in range(n):
		s.append(sinp())
	t = []
	for i in range(n - 1):
		t.append(sinp())
	res = []
	for i in range(m):
		d = dd(int)
		for string in s:
			d[string[i]] += 1
		for string in t:
			d[string[i]] -= 1
			if d[string[i]] == 0:
				del d[string[i]]
		for j in d:
			res.append(j)
	print(''.join(res), flush=True)


import os
import sys
from collections import Counter
from io import BytesIO, IOBase

def main():
	for _ in range(int(input())):
		(n, m) = map(int, input().split())
		(s, a) = ([], [])
		for i in range(2 * n - 1):
			if i < n:
				s.append(input())
			else:
				a.append(input())
		aa = [dict(Counter([i[j] for i in a])) for j in range(m)]
		ss = [dict(Counter([i[j] for i in s])) for j in range(m)]
		for i in range(m):
			if len(ss[i]) != len(aa[i]):
				print((set(ss[i]) - set(aa[i])).pop(), end='')
			else:
				for j in ss[i]:
					if ss[i][j] - aa[i][j] != 0:
						print(j, end='')
						break
		sys.stdout.flush()
		print()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, **kwargs):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	a = []
	for i in range(n * 2 - 1):
		a.append(input())
	ans = ''
	now = [0 for i in range(26)]
	for i in range(m):
		now = [0 for i in range(26)]
		for j in range(n * 2 - 1):
			now[ord(a[j][i]) - 97] += 1
		for k in range(26):
			if now[k] % 2 == 1:
				ans += chr(97 + k)
	print(ans, flush=True)


from collections import Counter
from sys import stdin, stdout
input = stdin.readline
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = [input().strip() for _ in range(n)]
	b = [input().strip() for _ in range(n - 1)]
	ans = [0] * m
	for i in a + b:
		for j in range(m):
			ans[j] ^= ord(i[j])
	print(''.join([chr(i) for i in ans]))
	stdout.flush()


from sys import stdout
for _ in range(int(input())):
	(n, m) = list(map(int, input().split()))
	a = []
	for i in range(2 * n - 1):
		a.append(input())

	def f():
		if n == 1:
			return a[0]
		ans = ['' for i in range(m)]
		for i in range(m):
			x = 0
			for j in range(2 * n - 1):
				x ^= ord(a[j][i])
			ans[i] = chr(x)
		return ''.join(ans)
	print(f())
	stdout.flush()


from sys import stdin, stdout
from heapq import heapify, heappush, heappop
import sys
from collections import Counter
from copy import deepcopy
import math
from itertools import permutations
sys.setrecursionlimit(10 ** 5)
mod = 10 ** 9 + 7

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	ans = []
	for p in range(n + 1):
		if prime[p]:
			ans.append(p)
	return ans

def f(a):
	t = a
	a = t // 10
	while a > 0:
		t *= 10
		t += a % 10
		a //= 10
	return t

def mapinput():
	return map(int, stdin.readline().split())

def strinput():
	return stdin.readline().strip()

def listinput():
	return list(map(int, stdin.readline().split()))

def intinput():
	return int(stdin.readline().strip())
for test in range(intinput()):

	def solve():
		(n, m) = mapinput()
		ans = [0] * m
		for i in range(2 * n - 1):
			s = strinput()
			for j in range(m):
				ans[j] ^= ord(s[j])
		return ''.join([chr(i) for i in ans])
	print(solve())


t = int(input())
for tests in range(t):
	(n, m) = [int(i) for i in input().split(' ')]
	strs = list()
	hashchar = [{} for i in range(m)]
	for i in range(n):
		inputt = input()
		strs.append(inputt)
		for j in range(m):
			if inputt[j] in hashchar[j].keys():
				hashchar[j][inputt[j]] = hashchar[j][inputt[j]] + 1
			else:
				hashchar[j][inputt[j]] = 1
	for i in range(n - 1):
		inputt = input()
		for j in range(m):
			hashchar[j][inputt[j]] = hashchar[j][inputt[j]] - 1
	ans = ''
	for i in range(m):
		for k in hashchar[i].keys():
			if hashchar[i][k] > 0:
				ans += k
	print(ans)


import sys
from sys import stdout
input = lambda : sys.stdin.readline().strip()
P = lambda : list(map(int, input().split()))
from math import factorial as f, gcd
from collections import deque, defaultdict as dd, Counter as C
from heapq import heapify, heappop, heappush, heappushpop, heapreplace, merge
from random import randint, choice, sample
import time
mod = 10 ** 9 + 7
a = ord('a')
start = time.time()

def fast_exp(x, exp):
	ans = 1
	base = x
	while exp:
		if exp & 1:
			ans *= base
		base *= base
		base %= mod
		ans %= mod
		exp >>= 1
	return ans

def countBits(n):
	count = 0
	while n:
		count += n & 1
		n >>= 1
	return count

def submasks(n):
	org = n
	while n:
		yield n
		n = n - 1 & org

def solve():
	(n, m) = P()
	before = [input() for _ in range(n)]
	after = [input() for _ in range(n - 1)]
	if n == 1:
		ans = before[0]
	else:
		ans = ''
		for (a, b) in zip(zip(*before), zip(*after)):
			ans += list((C(a) - C(b)).keys())[0]
	print(ans)
	stdout.flush()
tc = int(input())
for t in range(1, tc + 1):
	solve()


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	o = [0] * m
	l = [0] * m
	for i in range(n):
		a = list(input())
		for j in range(m):
			o[j] += ord(a[j])
	for i in range(n - 1):
		a = list(input())
		for j in range(m):
			l[j] += ord(a[j])
	ans = ''
	for i in range(m):
		ans += chr(o[i] - l[i])
	print(ans)


from sys import stdout, stdin
input = stdin.readline
print = stdout.write

class Node:

	def __init__(self, char):
		self.char = char
		self.children = {}

class Trie:

	def __init__(self):
		self.root = Node('')

	def insert(self, word):
		node = self.root
		for s in word:
			if s in node.children:
				node = node.children[s]
			else:
				node.children[s] = Node(s)
a = ord('a')
t = int(input())
for _ in range(t):
	(n, m) = (int(x) for x in input().split())
	letters = [[0 for _ in range(m)] for _ in range(26)]
	for _ in range(n):
		_str = input()
		for i in range(m):
			letters[ord(_str[i]) - a][i] += 1
	for _ in range(n - 1):
		_str = input()
		for i in range(m):
			letters[ord(_str[i]) - a][i] -= 1
	missing = []
	for i in range(m):
		for j in range(26):
			if letters[j][i]:
				missing.append(chr(j + a))
				break
	print(f"{''.join((s for s in missing))}\n")


from sys import stdin, stdout
ip = lambda : stdin.readline().rstrip('\r\n')
ips = lambda : ip().split()
out = lambda x, end='\n': stdout.write(str(x) + end)
for _ in range(int(ip())):
	(n, m) = map(int, ips())
	a = list(map(ord, list(ip())))
	for _ in range(2 * n - 2):
		b = list(map(ord, list(ip())))
		a = list(map(lambda x, y: x ^ y, a, b))
	a = map(chr, a)
	print(*a, sep='')


import sys
input = sys.stdin.buffer.readline
t = int(input())
for i in range(t):
	(n, m) = [int(x) for x in input().split()]
	A = []
	B = []
	d = {I: {} for I in range(m + 10)}
	for j in range(n):
		S = input()
		for (I, c) in enumerate(S):
			if c not in d[I]:
				d[I][c] = 0
			d[I][c] += 1
	for j in range(n - 1):
		S = input()
		for (I, c) in enumerate(S):
			d[I][c] -= 1
			if d[I][c] == 0:
				d[I].pop(c)
	answer = [chr(list(d[I])[0]) for I in range(m)]
	answer = ''.join(answer)
	print(answer)
	sys.stdout.flush()


import sys
import collections
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		(N, M) = [int(x) for x in input().split()]
		S = [input().strip() for _ in range(N)]
		S2 = [input().strip() for _ in range(N - 1)]
		org_c = [collections.Counter() for j in range(M)]
		result_c = [collections.Counter() for j in range(M)]
		for s in S:
			for (i, ss) in enumerate(s):
				org_c[i][ss] += 1
		for s in S2:
			for (i, ss) in enumerate(s):
				result_c[i][ss] += 1
		ans = []
		for i in range(M):
			for j in range(26):
				cc = chr(ord('a') + j)
				if result_c[i][cc] != org_c[i][cc]:
					ans.append(cc)
					break
		print(''.join(ans), flush=True)
main()


import bisect
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = int(input())
for _ in range(t):
	q = list(map(int, sys.stdin.readline().split()))
	n = q[0]
	m = q[1]
	n = 2 * n - 1
	strings = ['' for x in range(n)]
	letters = [0 for x in range(m)]
	for i in range(n):
		strings[i] = sys.stdin.readline()
	for j in range(m):
		for i in range(n):
			letters[j] ^= ord(strings[i][j])
		print(chr(letters[j]), end='')
		sys.stdout.flush()
	print()
	sys.stdout.flush()


import sys

def ints():
	return list(map(int, sys.stdin.readline().strip().split()))
tc = int(input())
while tc:
	tc -= 1
	(n, m) = map(int, input().split())
	(s, t) = ([], [])
	for _ in range(n):
		s.append(input())
	for _ in range(n - 1):
		t.append(input())
	for i in range(m):
		a = 0
		for item in s:
			a += ord(item[i])
		for item in t:
			a -= ord(item[i])
		print(chr(a), end='')
	print()
	sys.stdout.flush()


t = int(input())
for T in range(t):
	(n, m) = map(int, input().split(' '))
	map_list = []
	for i in range(m):
		map_list.append({})
	for i in range(n):
		s = input()
		for j in range(m):
			if s[j] in map_list[j]:
				map_list[j][s[j]] += 1
			else:
				map_list[j][s[j]] = 1
	for i in range(n - 1):
		s = input()
		for j in range(m):
			map_list[j][s[j]] -= 1
	res = ''
	for i in range(m):
		for c in map_list[i].keys():
			if map_list[i][c] == 1:
				res = res + c
	print(res)


from sys import stdin
from collections import Counter
input = stdin.readline

def solution():
	(n, m) = map(int, input().split())
	originals = [input().rstrip() for _ in range(n)]
	reordereds = [input().rstrip() for _ in range(n - 1)]
	answer = []
	for i in range(m):
		S1 = Counter([originals[j][i] for j in range(n)])
		S2 = Counter([reordereds[j][i] for j in range(n - 1)])
		for k in (S1 - S2).keys():
			answer.append(k)
	print(''.join(answer))
T = int(input())
for _ in range(T):
	solution()


import collections
import sys
res = []
t = int(sys.stdin.readline())
for _ in range(t):
	(n, m) = map(int, sys.stdin.readline().split())
	c = [collections.Counter() for _ in range(m)]
	for _ in range(n):
		s = sys.stdin.readline().strip()
		for (i, ch) in enumerate(s):
			c[i][ch] += 1
	for _ in range(n - 1):
		s = sys.stdin.readline().strip()
		for (i, ch) in enumerate(s):
			c[i][ch] -= 1
	for i in range(m):
		for (k, v) in c[i].items():
			if v != 0:
				res.append(k)
	res.append('\n')
print(''.join(res))
sys.stdout.flush()


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	arr = list()
	for _ in range(n):
		arr.append(input())
	grr = list()
	for _ in range(n - 1):
		grr.append(input())
	a = list()
	for i in range(m):
		temp = 0
		for j in range(n):
			temp += ord(arr[j][i])
		a.append(temp)
	b = list()
	for i in range(m):
		temp = 0
		for j in range(n - 1):
			temp += ord(grr[j][i])
		b.append(temp)
	c = list()
	for i in range(m):
		c.append(a[i] - b[i])
	s = ''
	for i in range(m):
		s += chr(c[i])
	print(s)


t = int(input())

def Convert(string):
	list1 = []
	list1[:0] = string
	for i in range(len(list1)):
		list1[i] = ord(list1[i])
	return list1
for randdd in range(t):
	x = input()
	x = x.split()
	(n, m) = (int(x[0]), int(x[1]))
	if n == 1:
		x = input()
		print(x)
		continue
	x = input()
	val = Convert(x)
	for i in range(2 * n - 2):
		x = input()
		list1 = Convert(x)
		for j in range(m):
			val[j] = val[j] ^ list1[j]
	a_list = [chr(a) for a in val]
	print(''.join(a_list))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = int(input())
ans = [{chr(a): 0 for a in range(97, 123)} for x in range(10 ** 5 + 2)]
while t:
	t -= 1
	(n, m) = [int(x) for x in input().split()]
	for _ in range(n):
		s = input()
		for i in range(m):
			ans[i][s[i]] += 1
	for _ in range(n - 1):
		s = input()
		for i in range(m):
			ans[i][s[i]] -= 1
	o = ''
	for i in range(m):
		for key in ans[i]:
			if ans[i][key] == 1:
				o += key
				ans[i][key] -= 1
				break
	print(o, flush=True)


t = int(input())
while t > 0:
	t -= 1
	s = input().split()
	n = int(s[0])
	m = int(s[1])
	a = []
	for i in range(n):
		s = input()
		if i == 0:
			for x in s:
				ai = dict()
				ai[x] = 1
				a.append(ai)
		else:
			for j in range(m):
				ai = a[j]
				if ai.get(s[j]) == None:
					ai[s[j]] = 1
				else:
					ai[s[j]] += 1
				a[j] = ai
	for i in range(n - 1):
		s = input()
		for j in range(m):
			ai = a[j]
			if ai[s[j]] == 1:
				del ai[s[j]]
			else:
				ai[s[j]] -= 1
	ans = ''
	for j in range(m):
		ai = a[j]
		key = list(ai.keys())[0]
		ans += key
	print(ans)


from collections import Counter
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	w = ''
	d = ''
	f = []
	l = []
	f1 = {}
	l1 = {}
	for i in range(n):
		f += [input()]
	for j in range(n - 1):
		l += [input()]
	for i in range(m):
		s = ''
		t = ''
		for j in range(n):
			s += f[j][i]
			if j < len(l):
				t += l[j][i]
		f1[i] = list(s)
		l1[i] = list(t)
	res = []
	for i in range(m):
		w = list(f1[i])
		t = list(l1[i])
		w.sort()
		t.sort()
		res += list((Counter(w) - Counter(t)).elements())
	print(''.join(res))


import sys
input = sys.stdin.readline
T = int(input())
from collections import Counter
for _ in range(T):
	(N, M) = map(int, input().split())
	S = [input().rstrip() for i in range(N)]
	if N == 1:
		print(S[0])
		continue
	T = [input().rstrip() for i in range(N - 1)]
	sc = []
	for col in zip(*S):
		sc.append(Counter(col))
	tc = []
	for col in zip(*T):
		tc.append(Counter(col))
	ans = ''
	for (s, t) in zip(sc, tc):
		c = (s - t).most_common()[0][0]
		ans += c
	print(ans)


import atexit, io, sys, collections, math, heapq, fractions, copy, os, functools
import sys
import random
import collections
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for u in range(int(input())):
	(n, m) = map(int, input().split())
	t = [0 for _ in range(m)]
	for _ in range(n + n - 1):
		for (i, e) in enumerate(input()):
			t[i] ^= ord(e) + 1
	print(''.join(map(lambda x: chr(x - 1), t)))


import math
import sys
input = sys.stdin.readline

def solve():
	(n, m) = [int(_) for _ in input().split()]
	ans = [0] * m
	for i in range(2 * n - 1):
		s = input().strip()
		for j in range(m):
			ans[j] ^= ord(s[j])
	ans = ''.join((chr(x) for x in ans))
	print(ans)
	sys.stdout.flush()
tt = int(input())
for test in range(tt):
	solve()


import sys
ans = []
for i in range(int(input())):
	(n, m) = map(int, input().split(' '))
	arr = []
	for i in range(n):
		arr.append(input())
	res = []
	for i in range(n - 1):
		res.append(input())
	if n == 1:
		ans.append(arr[0])
	else:
		temp1 = []
		temp2 = []
		for line in zip(*arr):
			mat = [0] * 26
			for i in line:
				mat[ord(i) - 97] += 1
			temp1.append(mat)
		for line in zip(*res):
			mat = [0] * 26
			for i in line:
				mat[ord(i) - 97] += 1
			temp2.append(mat)
		word = []
		for (mat1, mat2) in zip(temp1, temp2):
			idx = 0
			for (i, j) in zip(mat1, mat2):
				if i != j:
					word.append(chr(idx + 97))
				idx += 1
		ans.append(''.join(word))
for i in ans[:-1]:
	print(i)
	sys.stdout.flush()
print(ans[-1], end='')
sys.stdout.flush()


import os
import sys
from collections import Counter
for t in range(int(input())):
	(n, m) = map(int, input().split())
	(s, a) = ([], [])
	for i in range(2 * n - 1):
		if i < n:
			s.append(input())
		else:
			a.append(input())
	aa = [dict(Counter([i[j] for i in a])) for j in range(m)]
	ss = [dict(Counter([i[j] for i in s])) for j in range(m)]
	for i in range(m):
		if len(ss[i]) != len(aa[i]):
			print((set(ss[i]) - set(aa[i])).pop(), end='')
		else:
			for j in ss[i]:
				if ss[i][j] - aa[i][j] != 0:
					print(j, end='')
					break
	sys.stdout.flush()
	print()


import sys
t = int(input())
alphabets = 'abcdefghijklmnopqrstuvwxyz'

def create_dict():
	dict1 = {}
	for i in alphabets:
		dict1[i] = 0
	return dict1
for _ in range(t):
	(n, m) = map(int, input().split())
	first = []
	second = []
	dict_first_pos = []
	dict_second_pos = []
	for i in range(m):
		dict_first_pos.append(create_dict())
	for i in range(m):
		dict_second_pos.append(create_dict())
	for i in range(n):
		x = input()
		first.append(x)
		for j in range(m):
			dict_first_pos[j][x[j]] += 1
	for i in range(n - 1):
		x = input()
		second.append(x)
		for j in range(m):
			dict_second_pos[j][x[j]] += 1
	ans = ''
	for i in range(m):
		for j in alphabets:
			if dict_first_pos[i][j] != dict_second_pos[i][j]:
				ans += j
				break
	print(ans)
	sys.stdout.flush()


t = int(input())
for tests in range(t):
	(n, m) = [int(i) for i in input().split(' ')]
	hash_chrs = [{} for i in range(m)]
	for i in range(n):
		inp = input()
		for j in range(m):
			if inp[j] in hash_chrs[j].keys():
				hash_chrs[j][inp[j]] = hash_chrs[j][inp[j]] + 1
			else:
				hash_chrs[j][inp[j]] = 1
	for i in range(n - 1):
		inp = input()
		for j in range(m):
			hash_chrs[j][inp[j]] = hash_chrs[j][inp[j]] - 1
	sol = ''
	for i in range(m):
		for key in hash_chrs[i].keys():
			if hash_chrs[i][key] > 0:
				sol += key
	print(sol)


import os
import sys
import math
from io import BytesIO, IOBase
import io
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
from collections import Counter
import threading
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: max(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree1:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
MOD = 10 ** 9 + 7

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
mod = 10 ** 9 + 7
omod = 998244353
prime = [True for i in range(10001)]
prime[0] = prime[1] = False

def SieveOfEratosthenes(n=10000):
	p = 2
	c = 0
	while p <= n:
		if prime[p] == True:
			c += 1
			for i in range(p, n + 1, p):
				prime[i] = False
		p += 1

class DSU:

	def __init__(self, R, C):
		self.par = range(R * C + 1)
		self.rnk = [0] * (R * C + 1)
		self.sz = [1] * (R * C + 1)

	def find(self, x):
		if self.par[x] != x:
			self.par[x] = self.find(self.par[x])
		return self.par[x]

	def union(self, x, y):
		(xr, yr) = (self.find(x), self.find(y))
		if xr == yr:
			return
		if self.rnk[xr] < self.rnk[yr]:
			(xr, yr) = (yr, xr)
		if self.rnk[xr] == self.rnk[yr]:
			self.rnk[xr] += 1
		self.par[yr] = xr
		self.sz[xr] += self.sz[yr]

	def size(self, x):
		return self.sz[self.find(x)]

	def top(self):
		return self.size(len(self.sz) - 1) - 1

class LazySegTree:

	def __init__(self, _op, _e, _mapping, _composition, _id, v):

		def set(p, x):
			assert 0 <= p < _n
			p += _size
			for i in range(_log, 0, -1):
				_push(p >> i)
			_d[p] = x
			for i in range(1, _log + 1):
				_update(p >> i)

		def get(p):
			assert 0 <= p < _n
			p += _size
			for i in range(_log, 0, -1):
				_push(p >> i)
			return _d[p]

		def prod(l, r):
			assert 0 <= l <= r <= _n
			if l == r:
				return _e
			l += _size
			r += _size
			for i in range(_log, 0, -1):
				if l >> i << i != l:
					_push(l >> i)
				if r >> i << i != r:
					_push(r >> i)
			sml = _e
			smr = _e
			while l < r:
				if l & 1:
					sml = _op(sml, _d[l])
					l += 1
				if r & 1:
					r -= 1
					smr = _op(_d[r], smr)
				l >>= 1
				r >>= 1
			return _op(sml, smr)

		def apply(l, r, f):
			assert 0 <= l <= r <= _n
			if l == r:
				return
			l += _size
			r += _size
			for i in range(_log, 0, -1):
				if l >> i << i != l:
					_push(l >> i)
				if r >> i << i != r:
					_push(r - 1 >> i)
			l2 = l
			r2 = r
			while l < r:
				if l & 1:
					_all_apply(l, f)
					l += 1
				if r & 1:
					r -= 1
					_all_apply(r, f)
				l >>= 1
				r >>= 1
			l = l2
			r = r2
			for i in range(1, _log + 1):
				if l >> i << i != l:
					_update(l >> i)
				if r >> i << i != r:
					_update(r - 1 >> i)

		def _update(k):
			_d[k] = _op(_d[2 * k], _d[2 * k + 1])

		def _all_apply(k, f):
			_d[k] = _mapping(f, _d[k])
			if k < _size:
				_lz[k] = _composition(f, _lz[k])

		def _push(k):
			_all_apply(2 * k, _lz[k])
			_all_apply(2 * k + 1, _lz[k])
			_lz[k] = _id
		_n = len(v)
		_log = _n.bit_length()
		_size = 1 << _log
		_d = [_e] * (2 * _size)
		_lz = [_id] * _size
		for i in range(_n):
			_d[_size + i] = v[i]
		for i in range(_size - 1, 0, -1):
			_update(i)
		self.set = set
		self.get = get
		self.prod = prod
		self.apply = apply
MIL = 1 << 20

def makeNode(total, count):
	return total * MIL + count

def getTotal(node):
	return math.floor(node / MIL)

def getCount(node):
	return node - getTotal(node) * MIL
nodeIdentity = makeNode(0.0, 0.0)

def nodeOp(node1, node2):
	return node1 + node2
	return makeNode(getTotal(node1) + getTotal(node2), getCount(node1) + getCount(node2))
identityMapping = -1

def mapping(tag, node):
	if tag == identityMapping:
		return node
	count = getCount(node)
	return makeNode(tag * count, count)

def composition(mapping1, mapping2):
	return mapping1 if mapping1 != identityMapping else mapping2

def memodict(f):

	class memodict(dict):

		def __missing__(self, key):
			ret = self[key] = f(key)
			return ret
	return memodict().__getitem__

def pollard_rho(n):
	if n & 1 == 0:
		return 2
	if n % 3 == 0:
		return 3
	s = (n - 1 & 1 - n).bit_length() - 1
	d = n >> s
	for a in [2, 325, 9375, 28178, 450775, 9780504, 1795265022]:
		p = pow(a, d, n)
		if p == 1 or p == n - 1 or a % n == 0:
			continue
		for _ in range(s):
			prev = p
			p = p * p % n
			if p == 1:
				return math.gcd(prev - 1, n)
			if p == n - 1:
				break
		else:
			for i in range(2, n):
				(x, y) = (i, (i * i + 1) % n)
				f = math.gcd(abs(x - y), n)
				while f == 1:
					(x, y) = ((x * x + 1) % n, (y * y + 1) % n)
					y = (y * y + 1) % n
					f = math.gcd(abs(x - y), n)
				if f != n:
					return f
	return n

@memodict
def prime_factors(n):
	if n <= 1:
		return Counter()
	f = pollard_rho(n)
	return Counter([n]) if f == n else prime_factors(f) + prime_factors(n // f)

def distinct_factors(n):
	factors = [1]
	for (p, exp) in prime_factors(n).items():
		factors += [p ** i * factor for factor in factors for i in range(1, exp + 1)]
	return factors

def all_factors(n):
	(small, large) = ([], [])
	for i in range(1, int(n ** 0.5) + 1, 2 if n & 1 else 1):
		if not n % i:
			small.append(i)
			large.append(n // i)
	if small[-1] == large[-1]:
		large.pop()
	large.reverse()
	small.extend(large)
	return small

def binarySearch(arr, n, i, key):
	left = 0
	right = n - 1
	mid = 0
	res = n
	while left <= right:
		mid = (right + left) // 2
		if arr[mid][i] > key:
			res = mid
			right = mid - 1
		else:
			left = mid + 1
	return res

def binarySearch1(arr, n, i, key):
	left = 0
	right = n - 1
	mid = 0
	res = -1
	while left <= right:
		mid = (right + left) // 2
		if arr[mid][i] > key:
			right = mid - 1
		else:
			res = mid
			left = mid + 1
	return res
t = 1
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	a = []
	prev = [[0 for i in range(26)] for j in range(m)]
	for i in range(n):
		s = input()
		a.append(s)
		for j in range(m):
			prev[j][ord(s[j]) - 97] += 1
	curr = [[0 for i in range(26)] for j in range(m)]
	for i in range(n - 1):
		s = input()
		for j in range(m):
			curr[j][ord(s[j]) - 97] += 1
	for i in range(n):
		s = a[i]
		for j in range(m):
			prev[j][ord(s[j]) - 97] -= 1
		if prev == curr:
			print(s)
			break
		for j in range(m):
			prev[j][ord(s[j]) - 97] += 1


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		(n, m) = map(int, input().split())
		strs = []
		strs2 = []
		top = []
		for _ in range(n):
			chars = []
			for x in input():
				char = ord(x) - ord('a')
				chars.append(char)
			strs.append(chars)
		for _ in range(n - 1):
			chars = []
			for x in input():
				char = ord(x) - ord('a')
				chars.append(char)
			strs2.append(chars)
		for i in range(m):
			d = [0] * 26
			for x in strs:
				d[x[i]] += 1
			for y in strs2:
				d[y[i]] -= 1
			top.append(chr(d.index(1) + ord('a')))
		print(''.join(top), flush=True)
main()


from collections import Counter
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	strings = []
	for i in range(n):
		strings.append(input())
	n_strings = []
	for i in range(n - 1):
		n_strings.append(input())
	s = []
	s1 = []
	for i in range(m):
		k = ''
		for j in range(n):
			k += strings[j][i]
		s.append(k)
	for i in range(m):
		k = ''
		for j in range(n - 1):
			k += n_strings[j][i]
		s1.append(k)
	res = []
	for i in range(m):
		z = (Counter(s[i]) - Counter(s1[i])).elements()
		res.append(str(*z))
	print(''.join(res))


def main():
	alpha = 'abcdefghijklmnopqrstuvwxyz'
	ALPHA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
	inf = 1e+17
	mod = 10 ** 9 + 7

	def factorial(n):
		f = 1
		for i in range(1, n + 1):
			f = f * i % mod
		return f

	def ncr(n, r):
		num = den = 1
		for i in range(r):
			num = num * (n - i) % mod
			den = den * (i + 1) % mod
		return num * pow(den, mod - 2, mod) % mod

	def solve(n, m, grid, rem):
		cnts_org = []
		for i in range(m):
			cnt = dict()
			cnts_org.append(cnt)
			for j in range(n):
				if grid[j][i] in cnt:
					cnt[grid[j][i]] += 1
				else:
					cnt[grid[j][i]] = 1
				if j < n - 1:
					if rem[j][i] in cnts_org[i]:
						cnts_org[i][rem[j][i]] -= 1
					else:
						cnts_org[i][rem[j][i]] = -1
		answer = ''
		for i in range(m):
			for ele in cnts_org[i]:
				if cnts_org[i][ele]:
					answer += ele
		print(answer)
		stdout.flush()
		pass
	t = int(input())
	ans = []
	for _ in range(t):
		(n, m) = map(int, input().split())
		grid = []
		for i in range(n):
			grid.append(input()[:-1])
		rem = []
		for i in range(n - 1):
			rem.append(input()[:-1])
		ans.append(solve(n, m, grid, rem))
import sys, threading
import bisect
import math
import itertools
from sys import stdout
import heapq
from queue import PriorityQueue
input = sys.stdin.readline
thread = threading.Thread(target=main)
thread.start()
thread.join()


import sys
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	res = [0] * m
	for i in range(n + n - 1):
		s = input()
		for (index, c) in enumerate(s):
			res[index] ^= ord(c)
	print(''.join((chr(c) for c in res)))
	sys.stdout.flush()


from math import *
from collections import defaultdict as dt
from sys import stdin
inp = lambda : stdin.readline().strip()
I = lambda : int(inp())
M = lambda : map(int, inp().split())
L = lambda : list(M())
mod = 1000000007
inf = 100000000000000000000
ss = 'abcdefghijklmnopqrstuvwxyz'

def solve():
	(n, m) = M()
	c = [[] for i in range(m)]
	d = [[] for i in range(m)]
	for i in range(n):
		a = inp()
		for j in range(m):
			c[j].append(a[j])
	for i in range(n - 1):
		a = inp()
		for j in range(m):
			d[j].append(a[j])
	f = ''
	for i in range(m):
		e = dt(int)
		for j in c[i]:
			e[j] = e[j] + 1
		for j in d[i]:
			e[j] = e[j] - 1
		for j in e:
			if e[j] != 0:
				f = f + j
	print(f)
tt = 1
tt = I()
for _ in range(tt):
	solve()


from __future__ import print_function
from collections import *
from sys import stdin
import sys
from heapq import *
from math import log2, ceil, sqrt, gcd, log
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
rr = lambda x: reversed(range(x))
mod = int(1000000000.0) + 7
inf = float('inf')
(t,) = gil()
for _ in range(t):
	(n, m) = gil()
	b = [[0 for _ in range(26)] for _ in range(m)]
	a = [[0 for _ in range(26)] for _ in range(m)]
	for _ in range(n):
		s = g()
		for j in range(m):
			b[j][ord(s[j]) - 97] += 1
	for _ in range(n - 1):
		s = g()
		for j in range(m):
			a[j][ord(s[j]) - 97] += 1
	ans = []
	for j in range(m):
		for k in range(26):
			if a[j][k] != b[j][k]:
				ans.append(chr(97 + k))
				break
	print(''.join(ans))


from collections import Counter
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	cm = [Counter() for _ in range(m)]
	for _ in range(n):
		s = input()
		for i in range(m):
			cm[i][s[i]] += 1
	for _ in range(n - 1):
		s = input()
		for i in range(m):
			cm[i][s[i]] -= 1
	print(''.join((list(i.elements())[0] for i in cm)), flush=True)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	x = [0 for j in range(m)]
	for i in range(n):
		tmp = input()
		for j in range(m):
			x[j] ^= ord(tmp[j])
	for i in range(n - 1):
		tmp = input()
		for j in range(m):
			x[j] ^= ord(tmp[j])
	f = lambda a: ''.join((chr(i) for i in a))
	print(f(x))


from collections import defaultdict
import math
for cases in range(int(input())):
	(n, m) = map(int, input().split())
	d = defaultdict(list)
	ans = [0] * m
	for i in range(0, n + n - 1):
		s = list(input(''))
		for j in range(0, m):
			ans[j] = ans[j] ^ ord(s[j])
	res = ''
	for i in ans:
		res = res + chr(i)
	print(res)


import sys, string
tc = int(sys.stdin.readline())
for _ in range(tc):
	(n, m) = map(int, sys.stdin.readline().split())
	arr = []
	pos = [[0] * m for _ in range(26)]
	for _ in range(n):
		arr.append(sys.stdin.readline().rstrip())
	for i in arr:
		for j in range(m):
			pos[ord(i[j]) - ord('a')][j] += 1
	for _ in range(n - 1):
		now = sys.stdin.readline().rstrip()
		for i in range(m):
			pos[ord(now[i]) - ord('a')][i] -= 1
	for i in arr:
		cnt = 0
		for j in range(m):
			if pos[ord(i[j]) - ord('a')][j] != 0:
				cnt += 1
		if cnt == m:
			print(i)
			sys.stdout.flush()
			break


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	sums = [0 for _ in range(m)]
	for _ in range(n):
		line = input()
		for (pos, letter) in enumerate(line):
			sums[pos] += ord(letter)
	part_sums = [0 for _ in range(m)]
	for _ in range(n - 1):
		line = input()
		for (pos, letter) in enumerate(line):
			part_sums[pos] += ord(letter)
	print(''.join((chr(sums[i] - part_sums[i]) for i in range(m))), flush=True)


import sys
input = sys.stdin.readline

def I():
	return input().strip()

def II():
	return int(input().strip())

def LI():
	return [*map(int, input().strip().split())]
import copy
import re
import string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter, OrderedDict
from itertools import permutations, combinations, groupby, count, filterfalse
from operator import itemgetter
for _ in range(II()):
	(n, m) = LI()
	s1 = ''
	l = []
	l1 = []
	lst = []
	for i in range(n):
		s = I()
		l.append(list(s))
	for i in range(n - 1):
		z = I()
		l.append(list(z))
	for i in range(m):
		d = defaultdict(lambda : 0)
		for j in range(2 * n - 1):
			d[l[j][i]] += 1
		for (k, v) in d.items():
			if v % 2 == 1:
				s1 = s1 + k
	print(s1)
	sys.stdout.flush()


t = int(input())
for k in range(t):
	(n, m) = [int(i) for i in input().split()]
	list = []
	list3 = []
	for i in range(n * 2 - 1):
		list.append(input())
	for x in range(m):
		list2 = []
		for y in range(n * 2 - 1):
			list1 = []
			list1.append(list[y])
			string = str(list1[0])
			list2.append(string[x])
		list2.sort()
		list2.append(0)
		i = 0
		while True:
			if list2[i] == list2[i + 1]:
				i = i + 2
			else:
				list3.append(list2[i])
				break
	for i in range(len(list3)):
		print(list3[i], end='')
	print('')


from math import ceil
from sys import stdin
getLine = lambda : stdin.readline().strip()
getIntmap = lambda : map(int, stdin.readline().split())
for i in range(int(input())):
	(n, m) = getIntmap()
	mem = [0] * m
	for i in range(n):
		for (ind, j) in zip(range(m), map(ord, getLine())):
			mem[ind] += j
	for i in range(n - 1):
		for (ind, j) in zip(range(m), map(ord, getLine())):
			mem[ind] -= j
	print(''.join((chr(j) for j in mem)), flush=True)


import sys

def input():
	return sys.stdin.readline().strip()

def ints():
	return map(int, input().split())

def pos(c):
	return ord(c) - ord('a')

def toc(i):
	return chr(ord('a') + i)
T = int(input())
for _ in range(T):
	(n, m) = ints()
	f1 = [[0] * 26 for _ in range(m)]
	for i in range(n):
		s = input()
		for j in range(m):
			f1[j][pos(s[j])] += 1
	f2 = [[0] * 26 for _ in range(m)]
	for i in range(n - 1):
		s = input()
		for j in range(m):
			f2[j][pos(s[j])] += 1
	res = []
	for i in range(m):
		for j in range(26):
			if f1[i][j] != f2[i][j]:
				res.append(toc(j))
				break
	print(''.join(res), flush=True)


import sys
input = sys.stdin.readline
print = sys.stdout.write
for _ in range(int(input())):
	ans = []
	(a, b) = map(int, input().split())
	strings = [0 for i in range(b)]
	strstr = [[] for i in range(b)]
	for i in range(a):
		st = list(input().strip())
		for q in range(b):
			strings[q] += ord(st[q])
	for i in range(a - 1):
		st = list(input().strip())
		for q in range(b):
			strings[q] -= ord(st[q])
	for i in strings:
		ans.append(chr(i))
	print(''.join(ans) + '\n')


t = int(input())
full = 'abcdefghijklmnopqrstuvwxyz'
di = {}
stolen = ''
for i in range(26):
	di[full[i]] = i
for i in range(t):
	suminp = 0
	sumout = 0
	nm = list(map(int, input().split()))
	n = nm[0]
	m = nm[1]
	strlist = []
	for i in range(2 * n - 1):
		strlist.append(str(input()))
	for i in range(m):
		for j in range(n):
			suminp += di[strlist[j][i]]
		for j in range(n, 2 * n - 1, 1):
			sumout += di[strlist[j][i]]
		k = suminp - sumout
		stolen += full[k]
		suminp = 0
		sumout = 0
	print(stolen)
	stolen = ''


from sys import stdout
t = int(input())
for task in range(t):
	(n, m) = list(map(int, input().split()))
	res = [0] * m
	for i in range(n):
		s = input()
		for j in range(m):
			res[j] += ord(s[j])
	for i in range(n - 1):
		s = input()
		for j in range(m):
			res[j] -= ord(s[j])
	for i in res:
		print(chr(i), end='')
	print()
	stdout.flush()


import heapq
import sys
from math import *
import threading
from heapq import *
from itertools import count
from pprint import pprint
from collections import defaultdict
from heapq import heapify, heappop, heappush
sys.setrecursionlimit(300000)
mod = 10 ** 9 + 7
inf = 10 ** 15
decision = ['NO', 'YES']
yes = 'YES'
no = 'NO'
import os
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def npr(n, r):
	return factorial(n) % mod // (factorial(n - r) % mod) if n >= r else 0

def ncr(n, r):
	return factorial(n) % mod // (factorial(r) % mod * (factorial(n - r) % mod)) if n >= r else 0

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val):
	ans = -1
	lb = 0
	ub = len(li) - 1
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = mid
			break
	return ans

def kadane(x):
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = max(sum_so_far, current_sum)
	return sum_so_far

def pref(li):
	pref_sum = [0]
	for i in li:
		pref_sum.append(pref_sum[-1] + i)
	return pref_sum

def SieveOfEratosthenes(n):
	prime = [{1, i} for i in range(n + 1)]
	p = 2
	while p <= n:
		for i in range(p * 2, n + 1, p):
			prime[i].add(p)
		p += 1
	return prime

def primefactors(n):
	factors = []
	while n % 2 == 0:
		factors.append(2)
		n //= 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			factors.append(i)
			n //= i
	if n > 2:
		factors.append(n)
	return factors

def prod(li):
	ans = 1
	for i in li:
		ans *= i
	return ans

def sumk(a, b):
	print('called for', a, b)
	ans = a * (a + 1) // 2
	ans -= b * (b + 1) // 2
	return ans

def sumi(n):
	ans = 0
	if len(n) > 1:
		for x in n:
			ans += int(x)
		return ans
	else:
		return int(n)

def checkwin(x, a):
	if a[0][0] == a[1][1] == a[2][2] == x:
		return 1
	if a[0][2] == a[1][1] == a[2][0] == x:
		return 1
	if len(set(a[0])) == 1 and a[0][0] == x or (len(set(a[1])) == 1 and a[1][0] == x) or (len(set(a[2])) == 1 and a[2][0] == x):
		return 1
	if len(set(a[0][:])) == 1 and a[0][0] == x or (len(set(a[1][:])) == 1 and a[0][1] == x) or (len(set(a[2][:])) == 1 and a[0][0] == x):
		return 1
	return 0
karmanya = int(input())
while karmanya != 0:
	karmanya -= 1
	(n, m) = map(int, input().split())
	(a, b) = ([], [])
	ans = []
	(sa, sb) = ([0 for i in range(m)], [0 for i in range(m)])
	for i in range(n):
		s = input()
		for j in range(m):
			sa[j] += ord(s[j])
	for i in range(n - 1):
		s = input()
		for j in range(m):
			sb[j] += ord(s[j])
	for j in range(m):
		ans += chr(sa[j] - sb[j])
	print(''.join(ans))
	sys.stdout.flush()


import sys
input = sys.stdin.readline
T = int(input())
t = 1
while t <= T:
	(m, n) = map(int, input().split())
	string = []
	after = []
	for i in range(m):
		s = input()
		string.append(s)
	for i in range(m - 1):
		s = input()
		after.append(s)
	ans = ''
	for j in range(n):
		fre = {}
		for i in range(m):
			if string[i][j] not in fre:
				fre[string[i][j]] = 0
			fre[string[i][j]] += 1
		for i in range(m - 1):
			fre[after[i][j]] -= 1
			if fre[after[i][j]] == 0:
				del fre[after[i][j]]
		for missing in fre:
			ans += missing
	print(ans)
	t += 1
exit()


import sys
import io, os
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	S = []
	for i in range(n):
		s = str(input().rstrip())
		S.append(s)
	T = []
	for i in range(n - 1):
		s = str(input().rstrip())
		T.append(s)
	C = [[0] * m for i in range(26)]
	for i in range(n):
		s = S[i]
		for j in range(m):
			c = ord(s[j]) - ord('a')
			C[c][j] += 1
	D = [[0] * m for i in range(26)]
	for i in range(n - 1):
		s = T[i]
		for j in range(m):
			c = ord(s[j]) - ord('a')
			D[c][j] += 1
	ans = []
	for i in range(m):
		for c in range(26):
			if C[c][i] != D[c][i]:
				ans.append(chr(c + ord('a')))
				break
	print(''.join(ans), flush=True)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	h_c = [{} for i in range(m)]
	for i in range(n):
		ip = input()
		for j in range(m):
			if ip[j] in h_c[j].keys():
				h_c[j][ip[j]] += 1
			else:
				h_c[j][ip[j]] = 1
	for i in range(n - 1):
		ip = input()
		for j in range(m):
			h_c[j][ip[j]] -= 1
	final = ''
	for j in range(m):
		for k in h_c[j].keys():
			if h_c[j][k] > 0:
				final += k
	print(final)


import math
import os
import sys
from math import ceil, floor, sqrt, gcd, factorial
from io import BytesIO, IOBase
from collections import Counter
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def prog_name():
	(n, m) = map(int, input().split())
	fin = []
	h = []
	for aa in range(m):
		h.append({})
	for x in range(n):
		ans = input()
		fin.append(ans)
		for y in range(m):
			if ans[y] not in h[y].keys():
				h[y][ans[y]] = 1
			else:
				h[y][ans[y]] += 1
	for i in range(n - 1):
		ans = input()
		for j in range(m):
			h[j][ans[j]] -= 1
	final = ''
	for a in range(m):
		for kk in h[a].keys():
			if h[a][kk] <= 0:
				continue
			else:
				final += kk
	print(final)

def main():
	T = int(input())
	for unique in range(T):
		prog_name()
main()


import sys
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	arr = [[0] * 26 for i in range(m)]
	for i in range(n):
		s = input()
		for j in range(m):
			idx = ord(s[j]) - 97
			arr[j][idx] += 1
	arr1 = [[0] * 26 for i in range(m)]
	for i in range(n - 1):
		s = input()
		for j in range(m):
			idx = ord(s[j]) - 97
			arr[j][idx] -= 1
	ans = ['#'] * m
	for i in range(m):
		for j in range(26):
			if arr[i][j]:
				ans[i] = chr(j + 97)
				break
	print(''.join(ans))
	sys.stdout.flush()


import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
import threading
from collections import defaultdict
threading.stack_size(10 ** 8)
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
sys.setrecursionlimit(300000)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default=2 ** 51, func=lambda a, b: a & b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] < key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater

class TrieNode:

	def __init__(self):
		self.children = [None] * 26
		self.isEndOfWord = False

class Trie:

	def __init__(self):
		self.root = self.getNode()

	def getNode(self):
		return TrieNode()

	def _charToIndex(self, ch):
		return ord(ch) - ord('a')

	def insert(self, key):
		pCrawl = self.root
		length = len(key)
		for level in range(length):
			index = self._charToIndex(key[level])
			if not pCrawl.children[index]:
				pCrawl.children[index] = self.getNode()
			pCrawl = pCrawl.children[index]
		pCrawl.isEndOfWord = True

	def search(self, key):
		pCrawl = self.root
		length = len(key)
		for level in range(length):
			index = self._charToIndex(key[level])
			if not pCrawl.children[index]:
				return False
			pCrawl = pCrawl.children[index]
		return pCrawl != None and pCrawl.isEndOfWord

class Node:

	def __init__(self, data):
		self.data = data
		self.count = 0
		self.left = None
		self.right = None

class BinaryTrie:

	def __init__(self):
		self.root = Node(0)

	def insert(self, pre_xor):
		self.temp = self.root
		for i in range(31, -1, -1):
			val = pre_xor & 1 << i
			if val:
				if not self.temp.right:
					self.temp.right = Node(0)
				self.temp = self.temp.right
				self.temp.count += 1
			if not val:
				if not self.temp.left:
					self.temp.left = Node(0)
				self.temp = self.temp.left
				self.temp.count += 1
		self.temp.data = pre_xor

	def query(self, xor):
		self.temp = self.root
		for i in range(31, -1, -1):
			val = xor & 1 << i
			if not val:
				if self.temp.left and self.temp.left.count > 0:
					self.temp = self.temp.left
				elif self.temp.right:
					self.temp = self.temp.right
			elif self.temp.right and self.temp.right.count > 0:
				self.temp = self.temp.right
			elif self.temp.left:
				self.temp = self.temp.left
			self.temp.count -= 1
		return xor ^ self.temp.data
for ik in range(int(input())):
	(n, m) = map(int, input().split())
	l = []
	for i in range(n):
		st = input()
		l.append(st)
	l1 = []
	for j in range(n - 1):
		st = input()
		l1.append(st)
	tot = set([i for i in range(n)])
	for i in range(m):
		ans = defaultdict(int)
		for j in range(n):
			ans[l[j][i]] += 1
		for j in range(n - 1):
			ans[l1[j][i]] -= 1
		t = ''
		for j in ans:
			if ans[j] == 1:
				t = j
				break
		s = set()
		for j in range(n):
			if l[j][i] == t:
				s.add(j)
		tot = tot & s
	print(l[max(tot)])


def solve(s, n):
	res = [0] * len(s[0])
	for i in range(2 * n - 1):
		for (index, c) in enumerate(s[i]):
			res[index] ^= ord(c)
	return ''.join((chr(c) for c in res))

def main():
	tc = int(input())
	while tc:
		(n, m) = [int(x) for x in input().split(' ')]
		i = 0
		s = []
		while i < n * 2 - 1:
			s.append(input().strip())
			i += 1
		print(solve(s, n), flush=True)
		tc -= 1
main()


import sys
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = n
	b = n - 1
	c = n - 1
	arr = []
	for i in range(n):
		arr.append(input())
	for i in range(c):
		arr.append(input())
	ans = ''
	for i in range(m):
		k = 0
		for j in range(a + b):
			h = arr[j]
			k = k ^ ord(h[i])
		ans += chr(k)
	print(ans)
	sys.stdout.flush()


def solve():
	(n, m) = map(int, input().split())
	count = [{} for _ in range(m)]
	for _ in range(n):
		s = input()
		for j in range(m):
			if s[j] not in count[j]:
				count[j][s[j]] = 1
			else:
				count[j][s[j]] += 1
	for _ in range(n - 1):
		s = input()
		for j in range(m):
			count[j][s[j]] -= 1
	ans = ''
	for i in range(m):
		for num in count[i]:
			if count[i][num] > 0:
				ans += num
	print(ans)
for _ in range(int(input())):
	solve()


import math
import sys
inp = int(input())
for _ in range(inp):
	(n, m) = map(int, input().split(' '))
	res = [0] * m
	for _ in range(n + n - 1):
		s = input()
		for i in range(m):
			res[i] = res[i] ^ ord(s[i])
	print(''.join(map(chr, res)))
	sys.stdout.flush()


import sys
for i in range(int(input())):
	(n, m) = map(int, input().split())
	ans = [0] * m
	for j in range(n + n - 1):
		s = input()
		for k in range(len(s)):
			ans[k] ^= ord(s[k])
	ans = [chr(i) for i in ans]
	x = ''.join(ans)
	print(x)
	sys.stdout.flush()


from collections import Counter as C
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	l = []
	for i in range(n):
		l.append(input())
	p = []
	for i in range(n - 1):
		p.append(input())
	s = ''
	for i in range(m):
		o = []
		u = []
		for j in range(n - 1):
			o.append(l[j][i])
			u.append(p[j][i])
		o.append(l[-1][i])
		c = C(o) - C(u)
		for i in c:
			s += i
	print(s)


import sys

def missing(a, b):
	(i, j) = (0, 0)
	arr = []
	while i < len(a) and j < len(b):
		if a[i] != b[j]:
			arr.append(a[i])
			i += 1
		else:
			i += 1
			j += 1
	while i < len(a):
		arr.append(a[i])
		i += 1
	return arr

def ans(a, b, n, m):
	alphabet = 'abcdefghijklmnopqrstuvwxyz'
	d1 = {}
	d2 = {}
	for i in alphabet:
		d1[i] = []
		d2[i] = []
	for i in a:
		for j in range(len(i)):
			d1[i[j]].append(j)
	for i in b:
		for j in range(len(i)):
			d2[i[j]].append(j)
	keys = list(d1.keys())
	for key in keys:
		d1[key].sort()
		d2[key].sort()
	d = {}
	for i in keys:
		z1 = d1[i]
		z2 = d2[i]
		arr = missing(z1, z2)
		d[i] = arr
	count = 0
	for i in d:
		count += len(d[i])
	arr = ['' for i in range(count)]
	for i in d:
		for j in d[i]:
			arr[j] = i
	z = ''.join(arr)
	return z
m = int(input())
for i in range(m):
	v = input().split()
	n = int(v[0])
	s = int(v[1])
	a = []
	for i in range(n):
		x = input()
		a.append(x)
	b = []
	for i in range(n - 1):
		x = input()
		b.append(x)
	print(ans(a, b, n, s))
	sys.stdout.flush()


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		(n, m) = map(int, input().split())
		strs = []
		strs2 = []
		ans = [0] * m
		for _ in range(n):
			strs.append(input())
		for _ in range(n - 1):
			strs2.append(input())
		for i in range(m):
			for x in strs:
				ans[i] += ord(x[i])
			for y in strs2:
				ans[i] -= ord(y[i])
		print(''.join(list(map(chr, ans))))
		sys.stdout.flush()
main()


T = int(input())
for TT in range(T):
	(n, m) = map(int, input().split())
	s = []
	for i in range(2 * n - 1):
		s.append(input())
	ans = []
	for i in range(len(s[0])):
		c = [0] * 26
		for j in range(len(s)):
			c[ord(s[j][i]) - ord('a')] += 1
		for j in range(26):
			if c[j] % 2 == 1:
				ans.append(chr(j + ord('a')))
	print(''.join(ans))


t = int(input())
while t > 0:
	t -= 1
	a = input().split()
	n = int(a[0])
	m = int(a[1])
	ma = []
	for i in range(0, n):
		ui = input()
		for j in range(0, len(ui)):
			if i == 0:
				ci = {ui[j]: 1}
				ma.append(ci)
			elif ui[j] in ma[j]:
				ma[j][ui[j]] += 1
			else:
				ma[j][ui[j]] = 1
	for i in range(0, n - 1):
		ui = input()
		for j in range(0, len(ui)):
			if ma[j][ui[j]] > 1:
				ma[j][ui[j]] -= 1
			else:
				del ma[j][ui[j]]
	ans = ''
	for i in range(0, m):
		key = list(ma[i].keys())
		ans += key[0]
	print(ans)


import sys
import math
from collections import deque
from bisect import bisect_left, bisect_right
I = sys.stdin.readline
II = lambda : int(I())
IN = lambda x: map(int, x.split())
FN = lambda x: map(float, x.split())
L = lambda x: list(IN(x))
M = 1000000007
P = print
T = True
F = False
for _ in range(II()):
	(n, m) = IN(I())
	s = []
	for i in range(n):
		s.append(input())
	s2 = []
	for i in range(n - 1):
		s2.append(input())
	res = []
	for i in range(m):
		t = 0
		for j in range(n - 1):
			t ^= ord(s[j][i]) ^ ord(s2[j][i])
		t ^= ord(s[n - 1][i])
		res.append(chr(t))
	P(*res, sep='')
	sys.stdout.flush()


from sys import path_hooks, stdin, stdout
from collections import Counter, deque
import math
from copy import deepcopy
import random
import heapq
from itertools import permutations, product, repeat
from time import time
from bisect import bisect_left
from bisect import bisect_right
from re import A, findall
from fractions import Fraction
from typing import DefaultDict

def mapinput():
	return map(int, stdin.readline().split())

def strinput():
	return stdin.readline().strip()

def listinput():
	return list(map(int, stdin.readline().split()))

def intinput():
	return int(stdin.readline().strip())

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	ans = []
	for p in range(n + 1):
		if prime[p]:
			ans.append(p)
	return ans
coprime1 = {6: 100003, 5: 10007, 4: 1009, 3: 101, 2: 11, 1: 2, 7: 1000003, 8: 10000019, 9: 100000007}
coprime2 = {8: 10000169, 9: 100000049, 7: 1000033, 6: 100019, 5: 10009, 4: 1013, 3: 103, 2: 13, 1: 3}

def writ(ss):
	stdout.write(str(ss) + '\n')
mod = 10 ** 9 + 7

def binaryr(arr, point, target):
	low = 0
	high = point
	while low <= high:
		mid = (low + high) // 2
		if arr[mid] == target:
			return mid
		elif arr[mid] < target:
			low = mid + 1
		else:
			high = mid - 1
	return low

def binaryl(arr, point, target):
	low = 0
	high = point
	while low <= high:
		mid = (low + high) // 2
		if arr[mid] == target:
			return mid
		elif arr[mid] < target:
			low = mid + 1
		else:
			high = mid - 1
	return high

def sump(n):
	return n * (n + 1) // 2
for test in range(intinput()):

	def solve():
		(n, m) = mapinput()
		s1 = []
		for i in range(n):
			s1.append(strinput())
		s2 = []
		for i in range(n - 1):
			s2.append(strinput())
		dp = [[0] * 26 for i in range(m)]
		for i in range(n):
			for j in range(m):
				dp[j][ord(s1[i][j]) - 97] += 1
		for i in range(n - 1):
			for j in range(m):
				dp[j][ord(s2[i][j]) - 97] -= 1
		for i in range(m):
			for j in range(26):
				if dp[i][j] > 0:
					stdout.write(chr(97 + j))
					break
	solve()
	print()


from collections import deque, defaultdict, Counter
from itertools import product, groupby, permutations, combinations, accumulate
from math import gcd, floor, inf, log2, sqrt, log10
from bisect import bisect_right, bisect_left
from statistics import mode
cases = int(input())
for _ in range(cases):
	(n, m) = map(int, input().split())
	before = []
	after = []
	for i in range(n):
		before.append(input())
	for i in range(n - 1):
		after.append(input())
	ans = []
	for i in range(m):
		cnt = defaultdict(int)
		for j in range(n):
			c = before[j][i]
			cnt[c] += +1
		for j in range(n - 1):
			c = after[j][i]
			cnt[c] -= 1
		for j in cnt:
			if cnt[j] > 0:
				ans.append(j)
	print(''.join(ans), flush=True)


import sys
import math
from typing import DefaultDict
mod = 10 ** 9 + 7
LI = lambda : [int(k) for k in input().split()]
input = lambda : sys.stdin.readline().rstrip()
IN = lambda : int(input())
S = lambda : input()
r = range
alp = 'abcdefghijklmnopqrstuvwxyz'
for t in r(IN()):
	(n, m) = LI()
	dp = [DefaultDict(int) for i in range(m)]
	for i in range(n):
		s = S()
		for i in range(m):
			dp[i][s[i]] += 1
	if n == 1:
		print(s, flush=True)
		continue
	for i in range(n - 1):
		s = S()
		for i in range(m):
			dp[i][s[i]] -= 1
	ans = ''
	for i in range(m):
		for ele in alp:
			if dp[i][ele] == 1:
				ans += ele
	print(ans, flush=True)


import sys

def solve():
	(n, m) = map(int, input().split())
	a = []
	b = []
	for i in range(2 * n - 1):
		s = input()
		a.append(s)
	ans = ''
	for i in range(m):
		k = [0] * 26
		for j in range(n):
			k[ord(a[j][i]) - 97] += 1
		for j in range(n, 2 * n - 1):
			k[ord(a[j][i]) - 97] -= 1
		for i in range(26):
			if k[i] != 0:
				ans += chr(i + 97)
	print(ans)
	sys.stdout.flush()
t = int(input())
for _ in range(t):
	solve()


from collections import Counter
numCases = int(input())
allTestCase = []
for i in range(numCases):
	(n, m) = [int(i) for i in input().split(' ')]
	testCase = {'len': m, 'initial': [], 'final': []}
	for _ in range(n):
		testCase['initial'].append(input())
	for _ in range(n - 1):
		testCase['final'].append(input())
	allTestCase.append(testCase)
for test in allTestCase:
	out = []
	for index in range(test['len']):
		count = Counter([string[index] for string in test['initial']])
		remove = Counter([string[index] for string in test['final']])
		diff = count - remove
		out += diff
	print(''.join(out))


from itertools import combinations_with_replacement
import sys
from sys import stdin
import math
import bisect

def BinarySearch(a, x):
	i = bisect.bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	else:
		return -1

def iinput():
	return int(input())

def minput():
	return map(int, input().split())

def linput():
	return list(map(int, input().split()))

def fiinput():
	return int(stdin.readline())

def fminput():
	return map(int, stdin.readline().strip().split())

def flinput():
	return list(map(int, stdin.readline().strip().split()))
for _ in range(fiinput()):
	(n, m) = fminput()
	list1 = []
	list2 = []
	mlist = [[0 for j in range(26)] for i in range(m)]
	for i in range(n):
		list1.append(stdin.readline().strip())
	for i in range(n - 1):
		list2.append(stdin.readline().strip())
	for i in range(n - 1):
		flist = list2[i]
		for j in range(m):
			mlist[j][ord(flist[j]) - 97] += 1
	for i in range(n):
		flist = list1[i]
		for j in range(m):
			mlist[j][ord(flist[j]) - 97] += 1
	for i in range(n):
		flist = list1[i]
		f = 0
		for j in range(m):
			if mlist[j][ord(flist[j]) - 97] % 2 != 0:
				f += 1
		if f == m:
			print(list1[i])
			break


import sys
t = int(input())
for x in range(t):
	(n, m) = [int(i) for i in input().split()]
	strs = []
	for i in range(n):
		strs.append(input())
	strs2 = []
	for i in range(n - 1):
		strs2.append(input())
	temp = []
	for i in range(m):
		temp.append(dict())
		for j in range(n):
			if strs[j][i] in temp[i].keys():
				temp[i][strs[j][i]] += 1
			else:
				temp[i][strs[j][i]] = 1
	answer = []
	for i in range(m):
		for j in range(n - 1):
			temp[i][strs2[j][i]] -= 1
		for j in temp[i].keys():
			if temp[i][j] == 1:
				answer.append(j)
	for i in answer:
		print(i, end='')
	print()
	sys.stdout.flush()


for t in range(int(input())):
	(n, m) = map(int, input().split())
	(original, mixed) = ([], [])
	for i in range(n):
		original.append(input())
	for i in range(n - 1):
		mixed.append(input())
	(a, b) = ([], [])
	for i in range(m):
		ans = 0
		for j in range(n):
			ans += ord(original[j][i])
		a.append(ans)
	for i in range(m):
		ans = 0
		for j in range(n - 1):
			ans += ord(mixed[j][i])
		b.append(ans)
	for i in range(len(a)):
		print(chr(a[i] - b[i]), end='', flush=True)
	print(flush=True)


import sys, os
from io import BytesIO, IOBase
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(stdin, stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
for _ in range(iinp()):
	(n, m) = mp()
	ml = [inp() for i in range(n)]
	quer = [inp() for i in range(n - 1)]
	cnt = l2d(m, 26)
	for s in ml:
		for i in range(m):
			cnt[i][ord(s[i]) - 97] += 1
	cntq = l2d(m, 26)
	for s in quer:
		for i in range(m):
			cntq[i][ord(s[i]) - 97] += 1
	ans = ''
	for s in ml:
		tmp = [i.copy() for i in cnt]
		for i in range(m):
			tmp[i][ord(s[i]) - 97] -= 1
		if tmp == cntq:
			ans = s
			break
	print(ans)
	stdout.flush()


import os, sys, math
from io import BytesIO, IOBase
it = lambda : int(input())
ma = lambda : map(int, input().split(' '))
li = lambda : list(map(int, input().split(' ')))
mod = 10 ** 9 + 7

def main():
	t = int(input())
	for _ in range(t):
		(n, m) = map(int, input().split(' '))
		a = [0] * m
		for i in range(n):
			s = input()
			for j in range(m):
				a[j] += ord(s[j])
		for i in range(n - 1):
			s = input()
			for j in range(m):
				a[j] -= ord(s[j])
		ans = ''
		for i in range(m):
			print(chr(a[i]), end='')
		print()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi, inf
from collections import deque, defaultdict
from bisect import bisect, bisect_left
from time import time
from itertools import permutations as per
from heapq import heapify, heappush, heappop, heappushpop
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\r\n')
L = lambda : list(R())
P = lambda x: stdout.write(str(x) + '\n')
lcm = lambda x, y: x * y // gcd(x, y)
nCr = lambda x, y: f[x] * inv(f[y] * f[x - y] % N) % N
inv = lambda x: pow(x, N - 2, N)
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
for _ in range(I()):
	(n, m) = R()
	a = [[0] * 26 for i in range(m)]
	for i in range(n):
		for (j, f) in enumerate([ord(k) - 97 for k in S()]):
			a[j][f] += 1
	for i in range(n - 1):
		for (j, f) in enumerate([ord(k) - 97 for k in S()]):
			a[j][f] -= 1
	for i in range(m):
		print(chr(a[i].index(1) + 97), end='', flush=True)
	print(flush=True)


for _ in range(int(input())):
	(n, m) = [int(_num) for _num in input().split(' ')]
	counters = [[0.0] * 26 for _ in range(m)]
	ord_a = ord('a')
	for _ in range(n):
		for (i, letter) in enumerate(input()):
			counters[i][ord(letter) - ord_a] += 1
	for _ in range(n - 1):
		for (i, letter) in enumerate(input()):
			counters[i][ord(letter) - ord_a] -= 1
	result = ''
	for counter in counters:
		for (i, c) in enumerate(counter):
			if c > 0:
				result += chr(i + ord_a)
				break
	print(result, flush=True)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = []
	s1 = []
	mp1 = {}
	l = []
	for i in range(m):
		l.append(dict())
	for i in range(n):
		s = input()
		s1.append(s)
		for i in range(m):
			if s[i] not in l[i]:
				l[i][s[i]] = 1
			else:
				l[i][s[i]] += 1
		for j in s:
			if j not in mp1:
				mp1[j] = 1
			else:
				mp1[j] += 1
	for i in range(n - 1):
		s = input()
		for i in range(m):
			l[i][s[i]] -= 1
		for j in s:
			mp1[j] -= 1
	ans = []
	a = ''
	for mpf in l:
		for i in mpf:
			if mpf[i] > 0:
				a += str(i)
				break
	for i in mp1:
		if mp1[i] > 0:
			ans += [i] * mp1[i]
	for i in range(n):
		pp = list(s1[i])
		if sorted(pp) == sorted(ans) and s1[i] == a:
			print(s1[i])
			break


import sys
input = sys.stdin.readline
for test in range(int(input().strip())):
	(n, m) = map(int, input().strip().split())
	orign = []
	ans = []
	for i in range(n * 2 - 1):
		orign.append(input().strip())
	for i in range(m):
		dic = {}
		for j in range(2 * n - 1):
			if dic.get(orign[j][i], 0) == 0:
				dic[orign[j][i]] = 1
			else:
				dic[orign[j][i]] += 1
		for it in dic:
			if dic[it] % 2 != 0:
				ans.append(it)
				break
	print(*ans, sep='')
	sys.stdout.flush()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	(a, b) = ([], [])
	for i in range(n):
		a.append(input().strip())
	for i in range(n - 1):
		b.append(input().strip())
	s = ''
	for i in range(m):
		cnt = [0] * 26
		for j in range(n):
			cnt[ord(a[j][i]) - 97] += 1
		for j in range(n - 1):
			cnt[ord(b[j][i]) - 97] -= 1
		x = cnt.index(1)
		s += chr(x + 97)
	print(s)


for _ in range(int(input())):
	(n, m) = map(int, input().split(' '))
	prev = []
	for _ in range(n):
		prev.append(input())
	after = []
	for _ in range(n - 1):
		after.append(input())
	from collections import defaultdict
	d1 = defaultdict(int)
	ans = ''
	for j in range(m):
		d1 = defaultdict(int)
		d2 = defaultdict(int)
		for i in range(n):
			d1[prev[i][j]] += 1
		for i in range(n - 1):
			d2[after[i][j]] += 1
		for (k, v) in d1.items():
			if d2[k] == v - 1:
				ans = ans + k
				break
	print(ans)


import os
import sys
from io import BytesIO, IOBase
import math
from collections import Counter

def func(n, m, originals, changed):
	result = []
	for i in range(len(originals[0])):
		before = Counter([val[i] for val in originals])
		after = Counter([val[i] for val in changed])
		result.append(list((before - after).keys())[0])
	return ''.join(map(str, result))

def main():
	num_test = int(parse_input())
	result = []
	for _ in range(num_test):
		(n, m) = [int(i) for i in parse_input().split()]
		originals = []
		for _ in range(n):
			originals.append(parse_input())
		changed = []
		for _ in range(n - 1):
			changed.append(parse_input())
		result.append(func(n, m, originals, changed))
	print('\n'.join(map(str, result)))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
parse_input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
inp = lambda : list(map(int, sys.stdin.readline().rstrip('\r\n').split()))
mod = 10 ** 9 + 7
Mod = 998244353
INF = float('inf')
import math
from bisect import *
from heapq import *
from collections import defaultdict as dd
from collections import OrderedDict as odict
from collections import Counter as cc
from collections import deque
from itertools import groupby
sys.setrecursionlimit(20 * 20 * 20 * 20 + 10)

def solve():
	(n, m) = takeivr()
	arr = []
	for i in range(2 * n - 1):
		string = takesr()
		arr.append(string)
	ans = ''
	for i in range(m):
		xor = 0
		for j in range(2 * n - 1):
			xor ^= ord(arr[j][i])
		ans += chr(xor)
	print(ans)

def main():
	global tt
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	t = takein()
	for tt in range(1, t + 1):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
		sys.stdout.close()

def takein():
	return int(sys.stdin.readline().rstrip('\r\n'))

def takesr():
	return sys.stdin.readline().rstrip('\r\n')

def takeiar():
	return list(map(int, sys.stdin.readline().rstrip('\r\n').split()))

def takesar():
	return list(map(str, sys.stdin.readline().rstrip('\r\n').split()))

def takeivr():
	return map(int, sys.stdin.readline().rstrip('\r\n').split())

def takesvr():
	return map(str, sys.stdin.readline().rstrip('\r\n').split())

def ispalindrome(s):
	return s == s[::-1]

def invert(bit_s):
	temp = int(bit_s, 2)
	inverse_s = temp ^ 2 ** (len(bit_s) + 1) - 1
	rslt = bin(inverse_s)[3:]
	return str(rslt)

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q

def counter_elements(a):
	q = dict()
	for i in range(len(a)):
		if a[i] not in q:
			q[a[i]] = 0
		q[a[i]] = q[a[i]] + 1
	return q

def string_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q

def factorial(n, m=1000000007):
	q = 1
	for i in range(n):
		q = q * (i + 1) % m
	return q

def factors(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
			q.append(n // i)
	return list(sorted(list(set(q))))

def prime_factors(n):
	q = []
	while n % 2 == 0:
		q.append(2)
		n = n // 2
	for i in range(3, int(n ** 0.5) + 1, 2):
		while n % i == 0:
			q.append(i)
			n = n // i
	if n > 2:
		q.append(n)
	return list(sorted(q))

def transpose(a):
	(n, m) = (len(a), len(a[0]))
	b = [[0] * n for i in range(m)]
	for i in range(m):
		for j in range(n):
			b[i][j] = a[j][i]
	return b

def power_two(x):
	return x and (not x & x - 1)

def ceil(a, b):
	return -(-a // b)

def seive(n):
	a = [1]
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p ** 2, n + 1, p):
				prime[i] = False
		p = p + 1
	for p in range(2, n + 1):
		if prime[p]:
			a.append(p)
	return a

def pref(li):
	pref_sum = [0]
	for i in li:
		pref_sum.append(pref_sum[-1] + i)
	return pref_sum

def kadane(x):
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = max(sum_so_far, current_sum)
	return sum_so_far

def binary_search(li, val):
	ans = -1
	lb = 0
	ub = len(li) - 1
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = mid
			break
	return ans

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


from bisect import insort, bisect_right, bisect_left
from sys import stdout, stdin, setrecursionlimit
from math import sqrt, ceil, floor, factorial, gcd, log2, log10
from io import BytesIO, IOBase
from collections import *
from itertools import *
from random import *
from string import *
from queue import *
from heapq import heappush, heappop, heapify
from re import *
from os import *

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))
(graph, mod, szzz) = ({}, 10 ** 9 + 7, lambda : sorted(zzz()))

def getStr():
	return input()

def getInt():
	return int(input())

def listStr():
	return list(input())

def getStrs():
	return input().split()

def isInt(s):
	return '0' <= s[0] <= '9'

def input():
	return stdin.readline().strip()

def zzz():
	return [int(i) for i in input().split()]

def output(answer, end='\n'):
	stdout.write(str(answer) + end)

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def getPrimes(N=10 ** 5):
	SN = int(sqrt(N))
	sieve = [i for i in range(N + 1)]
	sieve[1] = 0
	for i in sieve:
		if i > SN:
			break
		if i == 0:
			continue
		for j in range(2 * i, N + 1, i):
			sieve[j] = 0
	prime = [i for i in range(N + 1) if sieve[i] != 0]
	return prime

def primeFactor(n, prime=getPrimes()):
	lst = []
	mx = int(sqrt(n)) + 1
	for i in prime:
		if i > mx:
			break
		while n % i == 0:
			lst.append(i)
			n //= i
	if n > 1:
		lst.append(n)
	return lst
dx = [-1, 1, 0, 0, 1, -1, 1, -1]
dy = [0, 0, 1, -1, 1, -1, -1, 1]
daysInMounth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
num = getInt()
for _ in range(num):
	(n, m) = zzz()
	res = [0] * m
	for i in range(2 * n - 1):
		for (j, k) in enumerate(getStr()):
			res[j] ^= ord(k)
	for i in res:
		print(chr(i), end='')
	print(flush=True)


import sys

def solve(clean, noised):
	n = len(clean)
	m = len(clean[0])
	clean = [[ord(c) - ord('a') for c in w] for w in clean]
	noised = [[ord(c) - ord('a') for c in w] for w in noised]
	counts = [0] * (ord('z') - ord('a') + 1)
	answer = []
	for k in range(m):
		clean_counts = counts.copy()
		noised_counts = counts.copy()
		for w in clean:
			clean_counts[w[k]] += 1
		for w in noised:
			noised_counts[w[k]] += 1
		for i in range(len(clean_counts)):
			if clean_counts[i] != noised_counts[i]:
				answer.append(chr(i + ord('a')))
				break
	return ''.join(answer)

def main():
	outputs = []
	fin = sys.stdin
	N = int(fin.readline())
	for _ in range(N):
		(n, m) = map(int, fin.readline().split())
		clean = []
		for _ in range(n):
			clean.append(fin.readline().strip())
		noised = []
		for _ in range(n - 1):
			noised.append(fin.readline().strip())
		outputs.append(solve(clean, noised))
	print('\n'.join(map(str, outputs)))
	sys.stdout.flush()
main()


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
MOD = 10 ** 9 + 7
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	for _ in range(int(input())):
		(n, m) = map(int, input().split())
		a = [{} for i in range(m)]
		for i in range(n + n - 1):
			x = input()
			for j in range(m):
				a[j][x[j]] = a[j].get(x[j], 0) + 1
		for i in range(m):
			for j in a[i].keys():
				if a[i][j] % 2:
					print(j, end='')
					break
		print()
main()


import os
import sys
from io import BytesIO, IOBase
from collections import Counter
import math as mt
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)
mod = int(1000000000.0) + 7

def power(k, n):
	if n == 0:
		return 1
	if n % 2:
		return power(k, n - 1) * k % mod
	t = power(k, n // 2)
	return t * t % mod

def totalPrimeFactors(n):
	count = 0
	if n % 2 == 0:
		count += 1
		while n % 2 == 0:
			n //= 2
	i = 3
	while i * i <= n:
		if n % i == 0:
			count += 1
			while n % i == 0:
				n //= i
		i += 2
	if n > 2:
		count += 1
	return count

def main():
	for _ in range(int(input())):
		(n, m) = map(int, input().split())
		freq = [[0 for i in range(26)] for j in range(m)]
		nfreq = [[0 for i in range(26)] for j in range(m)]
		astring = []
		instring = []
		for i in range(n):
			s = input()
			k = []
			for j in range(m):
				freq[j][ord(s[j]) - ord('a')] += 1
				k.append(s[j])
			astring.append(k)
			instring.append(s)
		for i in range(n - 1):
			s = input()
			for j in range(m):
				nfreq[j][ord(s[j]) - ord('a')] += 1
		ans = []
		for i in range(m):
			for j in range(26):
				if freq[i][j] != nfreq[i][j]:
					ans.append(chr(ord('a') + j))
					break
		for i in range(n):
			if astring[i] == ans:
				print(instring[i])
				break
	return
main()


import math
from collections import Counter, defaultdict
import sys
mod = 10 ** 9 + 7
input = sys.stdin.readline
readInt = lambda : int(input().strip())
readfloat = lambda : float(input().strip())
readStr = lambda : input().strip()
intList = lambda : list(map(int, input().strip().split()))
intMap = lambda : map(int, input().strip().split())
floatList = lambda : list(map(float, input().strip().split()))
floatMap = lambda : map(float, input().strip().split())
strList = lambda : list(input().strip().split())

def solve():
	d = defaultdict(Counter)
	for i in arr:
		for j in range(m):
			d[j][i[j]] += 1
	for i in brr:
		for j in range(m):
			d[j][i[j]] += 1
	res = []
	for i in range(m):
		for j in d[i]:
			if d[i][j] & 1:
				res.append(j)
	return ''.join(res)
for _ in range(readInt()):
	(n, m) = intMap()
	arr = []
	for i in range(n):
		arr.append(list(input().strip()))
	brr = []
	for i in range(n - 1):
		brr.append(list(input().strip()))
	print(solve(), flush=True)
	sys.stdout.flush()


import sys
from bisect import bisect
from math import sqrt, ceil, floor

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
mod = int(1000000000.0) + 7
for _ in range(iinput()):
	(n, m) = rinput()
	l = [{} for _ in range(m)]
	ans = ''
	for _ in range(n):
		s = input()
		for i in range(m):
			l[i][s[i]] = l[i].get(s[i], 0) + 1
	for _ in range(n - 1):
		s = input()
		for i in range(m):
			l[i][s[i]] = l[i].get(s[i], 0) + 1
	for i in range(m):
		for key in l[i]:
			if l[i][key] % 2 == 1:
				ans += key
				break
	print(ans)


import sys
input = lambda : sys.stdin.readline()
int_arr = lambda : list(map(int, input().split()))
str_arr = lambda : list(map(str, input().split()))
get_str = lambda : map(str, input().split())
get_int = lambda : map(int, input().split())
get_flo = lambda : map(float, input().split())
mod = 1000000007

def solve():
	pass
for _ in range(int(input())):
	(n, m) = get_int()
	d = [{} for i in range(m)]
	for i in range(n):
		s = str(input())[:-1]
		for j in range(m):
			if s[j] not in d[j].keys():
				d[j][s[j]] = 1
			else:
				d[j][s[j]] += 1
	for k in range(n - 1):
		ss = str(input())[:-1]
		for l in range(m):
			d[l][ss[l]] -= 1
	out = ''
	for i in range(m):
		for j in d[i].keys():
			if d[i][j] > 0:
				out += j
	print(out)


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	freqs = [{chr(i): 0 for i in range(97, 123)} for j in range(m)]
	for __ in range(n):
		st = input()
		for (i, char) in enumerate(st):
			freqs[i][char] += 1
	for ___ in range(n - 1):
		st = input()
		for (i, char) in enumerate(st):
			freqs[i][char] -= 1
	ans = ''
	for dic in freqs:
		for letter in range(97, 123):
			if dic[chr(letter)] != 0:
				ans += chr(letter)
				break
	print(ans)


from collections import Counter
for t in range(int(input())):
	(n, m) = map(int, input().split())
	s = []
	ans = ''
	chr = [{} for i in range(m)]
	for i in range(n):
		ip = input()
		s.append(ip)
		for j in range(m):
			if ip[j] in chr[j].keys():
				chr[j][ip[j]] = chr[j][ip[j]] + 1
			else:
				chr[j][ip[j]] = 1
	for i in range(n - 1):
		ip = input()
		for j in range(m):
			chr[j][ip[j]] = chr[j][ip[j]] - 1
	for i in range(m):
		for key in chr[i].keys():
			if chr[i][key] > 0:
				ans = ans + key
	print(ans)


t = int(input())
mod = 10 ** 9 + 7
while t:
	t -= 1
	arr = list(map(int, input().split()))
	(n, m) = (arr[0], arr[1])
	dp = [0] * m
	q = n - 1
	while n:
		n -= 1
		inp = input()
		hh = 0
		for i in range(m):
			dp[i] += ord(inp[i])
	while q:
		q -= 1
		inp = input()
		for i in range(m):
			dp[i] -= ord(inp[i])
	stri = ''
	for i in dp:
		stri += chr(i)
	print(stri)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, m) = [int(c) for c in input().split()]
	ans = [0 for i in range(m)]
	for i in range(n):
		s = [ord(i) for i in input()]
		for j in range(m):
			ans[j] ^= s[j]
	for i in range(n - 1):
		s = [ord(i) for i in input()]
		for j in range(m):
			ans[j] ^= s[j]
	ans = [chr(i) for i in ans]
	print(''.join(ans))


from sys import stdin, stdout
input = stdin.readline
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	all = []
	for i in range(n):
		all.append(input()[:-1])
	changed = []
	for i in range(n - 1):
		changed.append(input()[:-1])
	all_s = [[0 for j in range(26)] for i in range(m)]
	for i in all:
		for j in range(m):
			all_s[j][ord(i[j]) - 97] += 1
	ans = []
	for i in changed:
		for j in range(m):
			all_s[j][ord(i[j]) - 97] -= 1
	for i in range(m):
		for j in range(26):
			if all_s[i][j]:
				ans.append(chr(j + 97))
	print(''.join(ans), flush=True)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	fn = [{} for i in range(k)]
	sn = fn + fn
	for i in range(n):
		s = input()
		x = 0
		for j in s:
			if j in fn[x]:
				fn[x][j] = fn[x][j] + 1
				x += 1
			else:
				fn[x][j] = 1
				x += 1
	for i in range(n - 1):
		x = 0
		s = input()
		for j in s:
			fn[x][j] = fn[x][j] - 1
			x += 1
	ans = ''
	for i in range(k):
		for j in fn[i]:
			if fn[i][j] > 0:
				ans += j
	print(ans)


from sys import stdout
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	arr = [input() for _ in range(n)]
	narr = [input() for _ in range(n - 1)]
	s = []
	cnt = [0] * 26
	for i in range(m):
		for word in arr:
			cnt[ord(word[i]) - ord('a')] += 1
		for word in narr:
			cnt[ord(word[i]) - ord('a')] -= 1
		for (i, c) in enumerate(cnt):
			if c:
				s.append(chr(ord('a') + i))
				cnt[i] = 0
				break
	print(''.join(s), flush=True)
	stdout.flush()


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = []
	b = []
	for i in range(n):
		a.append(input())
	for i in range(n - 1):
		b.append(input())
	ans = ''
	for i in range(m):
		x = [0 for k in range(26)]
		for j in range(n):
			x[ord(a[j][i]) - 97] += 1
		for j in range(n - 1):
			x[ord(b[j][i]) - 97] += 1
		for i in range(26):
			if x[i] % 2 == 1:
				ans += chr(97 + i)
	print(ans)


from collections import Counter
from collections import defaultdict
t = 0
for i in range(int(input())):
	(n, m) = map(int, input().split())
	l = []
	ll = []
	ans = ''
	for i in range(n):
		l.append(str(input()))
	for i in range(n - 1):
		ll.append(str(input()))
	t = 0
	tt = 0
	for i in range(m):
		d = defaultdict(int)
		dd = defaultdict(int)
		for j in range(n):
			d[l[j][i]] += 1
		for j in range(n - 1):
			dd[ll[j][i]] += 1
		for j in d:
			if d[j] - dd[j] > 0:
				ans += j
	print(ans)


import os, sys, time, collections, math, pprint, itertools as it, operator as op, bisect as bs, functools as fn
(maxx, localsys, mod) = (1 << 60, 0, int(1000000000.0 + 7))
nCr = lambda n, r: reduce(mul, range(n - r + 1, n + 1), 1) // factorial(r)
ceil = lambda n, x: (n + x - 1) // x
(osi, oso) = ('/home/priyanshu/Documents/cp/input.txt', '/home/priyanshu/Documents/cp/output.txt')
if os.path.exists(osi):
	sys.stdin = open(osi, 'r')
	sys.stdout = open(oso, 'w')
input = sys.stdin.readline

def maps():
	return map(int, input().split())
for _ in range(int(input())):
	(n, m) = maps()
	d = collections.defaultdict(lambda : [0] * 26)
	for _ in range(n):
		s = input().rstrip('\n')
		for i in range(m):
			d[i][ord(s[i]) - 97] += 1
	for _ in range(n - 1):
		s = input().rstrip()
		for i in range(m):
			d[i][ord(s[i]) - 97] -= 1
	sx = ''
	for i in range(m):
		for j in range(26):
			if d[i][j]:
				print(chr(j + 97), end='')
				break
	print()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import *
from collections import deque
from operator import itemgetter, attrgetter
from decimal import *
import bisect
import math
import heapq as hq
MOD = 10 ** 9 + 7

def is_prime(n):
	if n == 2 or n == 3:
		return True
	if n < 2 or n % 2 == 0:
		return False
	if n < 9:
		return True
	if n % 3 == 0:
		return False
	r = int(n ** 0.5)
	f = 5
	while f <= r:
		if n % f == 0:
			return False
		if n % (f + 2) == 0:
			return False
		f += 6
	return True

def pow(a, b, m):
	ans = 1
	while b:
		if b & 1:
			ans = ans * a % m
		b //= 2
		a = a * a % m
	return ans

def ispalindrome(s):
	if s[:] == s[::-1]:
		return 1
	return 0
dp = []
limit = []
v = []

def dpdfs(u, t=-1):
	dp[0][u] = 0
	dp[1][u] = 0
	for i in v[u]:
		if i == t:
			continue
		if dp[1][i] == -1:
			dpdfs(i, u)
		dp[0][u] += max(abs(limit[0][u] - limit[1][i]) + dp[1][i], abs(limit[0][u] - limit[0][i]) + dp[0][i])
		dp[1][u] += max(abs(limit[1][u] - limit[1][i]) + dp[1][i], abs(limit[1][u] - limit[0][i]) + dp[0][i])
vis = []
f = 0

def dfs(i):
	vis[i] = 1
	act[i] = 1
	for j in v[i]:
		if act[j]:
			f = 1
			return -1
		if vis[j] == 0:
			if dfs(j) == -1:
				return -1
	act[i] = 0
	ans.append(i)
	return 0
from queue import PriorityQueue

def z_algorithm(s):
	res = [0] * len(s)
	res[0] = len(s)
	(i, j) = (1, 0)
	while i < len(s):
		while i + j < len(s) and s[j] == s[i + j]:
			j += 1
		res[i] = j
		if j == 0:
			i += 1
			continue
		k = 1
		while i + k < len(s) and k + res[k] < j:
			res[i + k] = res[k]
			k += 1
		(i, j) = (i + k, j - k)
	return res

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a / gcd(a, b) * b
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	l = []
	for i in range(2 * n - 1):
		l.append(input())
	ma = {}
	ans = []
	for i in range(m):
		ma = {}
		for j in range(2 * n - 1):
			if l[j][i] in ma:
				ma.pop(l[j][i])
			else:
				ma[l[j][i]] = 1
		t = list(ma.keys())
		ans.append(t[0])
	print(''.join(ans))


from sys import *
input = lambda : stdin.readline()
int_arr = lambda : list(map(int, stdin.readline().strip().split()))
str_arr = lambda : list(map(str, stdin.readline().split()))
get_str = lambda : map(str, stdin.readline().strip().split())
get_int = lambda : map(int, stdin.readline().strip().split())
get_float = lambda : map(float, stdin.readline().strip().split())
mod = 1000000007
setrecursionlimit(1000)
for _ in range(int(input())):
	(n, m) = get_int()
	dic = [{} for i in range(m)]
	for i in range(n):
		s = str(input())[:-1]
		for j in range(m):
			if s[j] not in dic[j].keys():
				dic[j][s[j]] = 1
			else:
				dic[j][s[j]] += 1
	for k in range(n - 1):
		ss = str(input())[:-1]
		for l in range(m):
			dic[l][ss[l]] -= 1
	res = ''
	for i in range(m):
		for j in dic[i].keys():
			if dic[i][j] > 0:
				res += j
	print(res)


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	a = []
	for j in range(m):
		a.append([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
	for j in range(n):
		s = input()
		for k in range(m):
			a[k][ord(s[k]) - 97] += 1
	if n == 999999:
		pass
	else:
		for j in range(n - 1):
			s = input()
			for k in range(m):
				a[k][ord(s[k]) - 97] -= 1
		for j in range(len(a)):
			print(chr(a[j].index(1) + 97), end='')
		print('')
print('', flush=True)


import sys, os, io
input = sys.stdin.readline
for _ in range(int(input())):
	(n, m) = [int(i) for i in input().split()]
	cnt = [0] * m
	for i in range(n):
		curr = input().strip()
		for j in range(m):
			cnt[j] += ord(curr[j]) - 97
	cnt1 = [0] * m
	for i in range(n - 1):
		curr = input().strip()
		for j in range(m):
			cnt1[j] += ord(curr[j]) - 97
	fs = []
	for i in range(m):
		fs.append(chr(cnt[i] - cnt1[i] + 97))
	fs = ''.join(fs)
	print(fs)