You are given three strings $a$, $b$ and $c$ of the same length $n$. The strings consist of lowercase English letters only. The $i$-th letter of $a$ is $a_i$, the $i$-th letter of $b$ is $b_i$, the $i$-th letter of $c$ is $c_i$.

For every $i$ ($1 \leq i \leq n$) you must swap (i.e. exchange) $c_i$ with either $a_i$ or $b_i$. So in total you'll perform exactly $n$ swap operations, each of them either $c_i \leftrightarrow a_i$ or $c_i \leftrightarrow b_i$ ($i$ iterates over all integers between $1$ and $n$, inclusive).

For example, if $a$ is "code", $b$ is "true", and $c$ is "help", you can make $c$ equal to "crue" taking the $1$-st and the $4$-th letters from $a$ and the others from $b$. In this way $a$ becomes "hodp" and $b$ becomes "tele".

Is it possible that after these swaps the string $a$ becomes exactly the same as the string $b$?


-----Input-----

The input consists of multiple test cases. The first line contains a single integer $t$ ($1 \leq t \leq 100$)  — the number of test cases. The description of the test cases follows.

The first line of each test case contains a string of lowercase English letters $a$.

The second line of each test case contains a string of lowercase English letters $b$.

The third line of each test case contains a string of lowercase English letters $c$.

It is guaranteed that in each test case these three strings are non-empty and have the same length, which is not exceeding $100$.


-----Output-----

Print $t$ lines with answers for all test cases. For each test case:

If it is possible to make string $a$ equal to string $b$ print "YES" (without quotes), otherwise print "NO" (without quotes).

You can print either lowercase or uppercase letters in the answers.


-----Example-----
Input
4
aaa
bbb
ccc
abc
bca
bca
aabb
bbaa
baba
imi
mii
iim

Output
NO
YES
YES
NO



-----Note-----

In the first test case, it is impossible to do the swaps so that string $a$ becomes exactly the same as string $b$.

In the second test case, you should swap $c_i$ with $a_i$ for all possible $i$. After the swaps $a$ becomes "bca", $b$ becomes "bca" and $c$ becomes "abc". Here the strings $a$ and $b$ are equal.

In the third test case, you should swap $c_1$ with $a_1$, $c_2$ with $b_2$, $c_3$ with $b_3$ and $c_4$ with $a_4$. Then string $a$ becomes "baba", string $b$ becomes "baba" and string $c$ becomes "abab". Here the strings $a$ and $b$ are equal.

In the fourth test case, it is impossible to do the swaps so that string $a$ becomes exactly the same as string $b$.

Source: codeforces | Difficulty: EASY
Tags: String algorithms

Implementation


Solutions:
import sys
import math
import time
c = int(input())
for _ in range(c):
	a = input()
	b = input()
	c = input()
	yea = True
	for n in range(len(a)):
		i = a[n]
		j = b[n]
		k = c[n]
		if i != k and j != k:
			yea = False
			break
	print('YES' if yea else 'NO')


Q = int(input())
for i in range(Q):
	a = input()
	b = input()
	c = input()
	n = len(a)
	flag = True
	for j in range(n):
		if a[j] != c[j] and b[j] != c[j]:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = list(input())
	b = list(input())
	c = list(input())
	n = len(a)
	f = 1
	for i in range(n):
		if c[i] in [a[i], b[i]]:
			pass
		else:
			f = 0
	if f == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	flag = 1
	for i in range(len(a)):
		if a[i] != b[i]:
			if a[i] == c[i]:
				continue
			elif b[i] == c[i]:
				continue
			else:
				flag = 0
		elif a[i] != c[i]:
			flag = 0
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	l = len(a)
	flag = 0
	for i in range(l):
		if c[i] == a[i] or c[i] == b[i]:
			continue
		else:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')


T = int(input())
for _ in range(0, T):
	sa = input()
	sb = input()
	sc = input()
	temp = 0
	for i in range(0, len(sc)):
		if sa[i] != sb[i]:
			if sa[i] != sc[i] and sb[i] != sc[i]:
				temp = 1
				break
		elif sa[i] != sc[i]:
			temp = 1
			break
	if temp == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	a = input()
	b = input()
	n = len(a)
	c = input()
	flag = 0
	t1 = 0
	for i in range(n):
		if a[i] != b[i]:
			if c[i] == a[i] or c[i] == b[i]:
				t1 += 1
			else:
				flag = 1
				break
		elif a[i] != c[i]:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


import math
t = int(input())
for g in range(0, t):
	a = input()
	b = input()
	c = input()
	k = 0
	for i in range(0, len(a)):
		if a[i] == b[i] == c[i]:
			continue
		elif a[i] != b[i] and a[i] == c[i]:
			continue
		elif a[i] != b[i] and b[i] == c[i]:
			continue
		else:
			print('NO')
			k = 1
			break
	if k == 0:
		print('YES')


def main():
	test_cases = int(input())
	outputs = []
	for each_case in range(test_cases):
		a = [x for x in input()]
		b = [x for x in input()]
		c = [x for x in input()]
		for i in range(len(c)):
			if a[i] == c[i] or b[i] == c[i]:
				if a[i] == c[i]:
					b[i] = c[i]
				else:
					a[i] = c[i]
			else:
				a[i] = c[i]
		if a == b:
			outputs.append('YES')
		else:
			outputs.append('NO')
	for each_output in outputs:
		print(each_output)
main()


for i in range(int(input())):
	a = list(input())
	b = list(input())
	c = list(input())
	flag = 0
	for i in range(len(c)):
		if c[i] == a[i]:
			b[i] = c[i]
		elif c[i] == b[i]:
			a[i] = c[i]
		else:
			flag = 1
			break
	if flag == 1:
		print('No')
	else:
		print('Yes')


n = int(input())
p = 0
for i in range(n):
	(a, b, c) = (input(), input(), input())
	for i in range(len(a)):
		if a[i] != c[i] and b[i] != c[i]:
			p = 1
			break
	if p == 1:
		print('NO')
		p = 0
	else:
		print('YES')


for _ in range(int(input())):
	if any((not c in {a, b} for (a, b, c) in zip(input(), input(), input()))):
		print('NO')
	else:
		print('YES')


import sys
Input = sys.stdin.readline
x = int(input())
for _ in range(x):
	a = input()
	b = input()
	c = input()
	z = 0
	for i in range(len(b)):
		if c[i] != a[i] and c[i] != b[i]:
			print('NO')
			z = 1
			break
	if z == 0:
		print('YES')


t = int(input())
for _ in range(t):
	a = list(input())
	b = list(input())
	c = list(input())
	ans = True
	for i in range(len(a)):
		if a[i] == b[i] and c[i] != a[i]:
			ans = False
			break
		elif c[i] == b[i]:
			a[i] = c[i]
		elif c[i] == a[i]:
			b[i] = c[i]
	if a == b and ans is True:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = str(input())
	b = str(input())
	c = str(input())
	n = len(a)
	flag = 0
	for i in range(n):
		if a[i] != b[i]:
			if a[i] != c[i] and b[i] != c[i]:
				flag = 1
				print('NO')
				break
		elif c[i] != a[i]:
			flag = 1
			print('NO')
			break
	if flag == 0:
		print('YES')


def solve(a, b, c):
	for i in range(len(a)):
		if a[i] == b[i] and a[i] == c[i]:
			continue
		if a[i] != b[i] and c[i] == b[i]:
			continue
		if a[i] != b[i] and c[i] == a[i]:
			continue
		return 'NO'
	return 'YES'
t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	print(solve(a, b, c))


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	ch = 1
	for i in range(len(a)):
		if c[i] != b[i] and b[i] != c[i] and (c[i] != a[i]):
			ch = 0
			break
		elif a[i] == b[i] and c[i] != a[i]:
			ch = 0
			break
	if ch == 0:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	f = 0
	x = 0
	for i in range(len(a)):
		if a[i] == b[i]:
			if a[i] == c[i]:
				x += 1
		elif a[i] == c[i] or b[i] == c[i]:
			x += 1
		else:
			f = 1
			break
	if f or x < len(a):
		print('NO')
	else:
		print('YES')


t = int(input())
output = []
for j in range(t):
	a = str(input())
	b = str(input())
	c = str(input())
	n = len(a)
	ans = 'YES'
	for i in range(n):
		if a[i] != c[i] and b[i] != c[i]:
			ans = 'NO'
			break
	output.append(ans)
for i in output:
	print(i)


for i in range(int(input())):
	flag = 0
	a = input()
	b = input()
	c = input()
	for j in range(len(a)):
		if a[j] != c[j] and b[j] != c[j]:
			flag = 1
			print('NO')
			break
	if flag == 0:
		print('YES')


t = int(input())
while t:
	t -= 1
	(a, b, c) = (input(), input(), input())
	n = len(a)
	flag = True
	for i in range(n):
		if a[i] == c[i] or b[i] == c[i]:
			continue
		else:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	for j in range(len(a)):
		if a[j] != c[j] and b[j] != c[j]:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for i in range(t):
	a = list(input())
	b = list(input())
	c = list(input())
	n = len(a)
	j = 0
	while j < n:
		if c[j] == a[j]:
			b[j] = c[j]
		elif c[j] == b[j]:
			a[j] = c[j]
		else:
			break
		j += 1
	print('YES') if j == n else print('NO')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	ans = True
	for i in range(len(a)):
		if c[i] != a[i] and c[i] != b[i]:
			ans = False
			print('No')
			break
	if ans:
		print('Yes')


for t in range(int(input())):
	a = list(input())
	b = list(input())
	c = list(input())
	f = 0
	for i in range(len(a)):
		if a[i] != b[i]:
			if a[i] == c[i]:
				(b[i], c[i]) = (c[i], b[i])
			elif b[i] == c[i]:
				(a[i], c[i]) = (c[i], a[i])
		elif a[i] == b[i] and a[i] != c[i]:
			print('NO')
			f = 1
			break
	if a == b and f == 0:
		print('YES')
	elif f == 0:
		print('NO')


for _ in range(int(input())):
	possible = True
	for chars in zip(input(), input(), input()):
		size = len(set(chars))
		if size == 3 or (size == 2 and chars[0] == chars[1]):
			possible = False
			break
	if possible:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	a = input()
	b = input()
	c = input()
	flag = True
	for j in range(len(a)):
		if not (c[j] == b[j] or c[j] == a[j]):
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	a = input()
	b = input()
	c = input()
	a1 = ''
	b1 = ''
	count = 0
	for i in range(0, len(c)):
		if c[i] == a[i]:
			b1.join(c[i])
			count += 1
		elif c[i] == b[i]:
			a1.join(c[i])
			count += 1
		else:
			print('NO')
			break
	if a1 == b1 and count == len(c):
		print('YES')
	t -= 1


t = int(input())
for i in range(t):
	a = list(input())
	b = list(input())
	c = list(input())
	cnt = 0
	for i in range(0, len(a)):
		if c[i] == a[i] or c[i] == b[i]:
			cnt += 1
	if cnt == len(a):
		print('YES')
	else:
		print('NO')


t = int(input())
for test in range(t):
	a = input()
	b = input()
	c = input()
	val = True
	for i in range(len(a)):
		if a[i] != c[i] and b[i] != c[i]:
			val = False
			break
	if val == True:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	tf = True
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			pass
		else:
			tf = False
			break
	if tf:
		print('YES')
	else:
		print('NO')


t = int(input())
for j in range(t):
	a = input()
	b = input()
	c = input()
	isValid = True
	for i in range(len(a)):
		if len(set([a[i], b[i], c[i]])) == 1:
			continue
		if len(set([a[i], b[i], c[i]])) == 3:
			isValid = False
			break
		if a[i] == b[i]:
			isValid = False
			break
	if isValid:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	n = len(a)
	x = 0
	for j in range(n):
		if c[j] != a[j] and c[j] != b[j]:
			x = 1
			break
	if x == 0:
		print('YES')
	else:
		print('NO')


from sys import stdin
input = stdin.readline
for xoxo in range(1):
	for _ in range(int(input())):
		a = input()
		b = input()
		c = input()
		ans = 1
		for i in range(len(a)):
			if c[i] == a[i] or c[i] == b[i]:
				continue
			else:
				ans = -1
		if ans == -1:
			print('NO')
		else:
			print('YES')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	bol = True
	for i in range(len(a)):
		if c[i] not in b[i] and c[i] not in a[i]:
			bol = False
			break
	print('YES') if bol is True else print('NO')


def one():
	return int(input())

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

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

def st():
	return input()
for i in range(one()):
	a = st()
	b = st()
	c = st()
	ans = True
	for i in range(len(a)):
		if c[i] == a[i] or c[i] == b[i]:
			continue
		else:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	ok = True
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			ok = True
		else:
			ok = False
			break
	if ok:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	bool = True
	for j in range(len(a)):
		if a[j] != b[j] and b[j] != c[j] and (c[j] != a[j]) or (a[j] == b[j] and b[j] != c[j]):
			bool = False
			break
	if bool:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	a = list(input())
	b = list(input())
	c = list(input())
	t = len(a)
	for i in range(t):
		if c[i] == b[i] and c[i] != a[i] or c[i] == b[i] == a[i]:
			(c[i], a[i]) = (a[i], c[i])
		elif c[i] == a[i] and c[i] != b[i]:
			(c[i], b[i]) = (b[i], c[i])
		else:
			print('No')
			break
	else:
		print('Yes')


from collections import defaultdict as dd
from collections import Counter as ccd
from itertools import permutations as pp
from itertools import combinations as cc
from random import randint as rd
from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq as hq
from math import gcd
mod = pow(10, 9) + 7

def inp(flag=0):
	if flag == 0:
		return list(map(int, input().strip().split(' ')))
	else:
		return int(input())
t = inp(1)
while t:
	t -= 1
	a = input().strip()
	b = input().strip()
	c = input().strip()
	possible = True
	for i in range(len(a)):
		if a[i] == b[i]:
			if c[i] != a[i]:
				possible = False
				break
		elif c[i] != a[i] and c[i] != b[i]:
			possible = False
			break
	if possible:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	A = str(input())
	B = str(input())
	C = str(input())
	a = list(A)
	b = list(B)
	c = list(C)
	length = len(a)
	for i in range(length):
		if a[i] == b[i] and b[i] == c[i]:
			continue
		elif c[i] == b[i]:
			temp = a[i]
			a[i] = c[i]
			c[i] = temp
			continue
		else:
			temp = b[i]
			b[i] = c[i]
			c[i] = temp
			continue
	check1 = ''
	check2 = ''
	if check1.join(a) == check2.join(b):
		print('YES')
		continue
	else:
		print('NO')
		continue


t = int(input())
for i in range(t):
	abc = []
	for j in range(3):
		abc.append(input())
	(a, b, c) = abc
	a = list(a)
	b = list(b)
	c = list(c)
	for j in range(len(c)):
		if a[j] == c[j]:
			(b[j], c[j]) = (c[j], b[j])
		elif b[j] == c[j]:
			(a[j], c[j]) = (c[j], a[j])
		else:
			print('NO')
			break
	else:
		if a == b:
			print('YES')


t = int(input())
for _ in range(t):
	aa = input()
	bb = input()
	cc = input()
	check = True
	for (a, b, c) in zip(aa, bb, cc):
		if c == a or c == b:
			continue
		check = False
		break
	if check:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	z = 0
	for i in range(len(c)):
		if c[i] == a[i] or c[i] == b[i]:
			z = 1
		else:
			z = 0
			break
	if z == 1:
		print('YES')
	else:
		print('NO')


import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
from functools import lru_cache
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

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

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
for _ in range(int(input())):
	a = input().strip()
	b = input().strip()
	c = input().strip()
	flag = True
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			continue
		else:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


import sys
import math as mt
t = int(input())
for __ in range(t):
	a = input()
	b = input()
	c = input()
	n = len(a)
	cnt = 0
	for i in range(n):
		if b[i] == c[i] or c[i] == a[i]:
			cnt += 1
	if cnt == n:
		print('YES')
	else:
		print('NO')


s = int(input())
for _ in range(s):
	a = input()
	flag = True
	b = input()
	c = input()
	for i in range(len(b)):
		if b[i] != c[i] and a[i] != c[i]:
			flag = False
			print('NO')
			break
	if flag:
		print('YES')


import sys

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(INT()):
	S = input()
	T = input()
	U = input()
	N = len(S)
	for i in range(N):
		if S[i] != U[i] and T[i] != U[i]:
			NO()
			break
	else:
		YES()


t = int(input())
while t > 0:
	count = 0
	a = input()
	b = input()
	c = input()
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			count = count + 1
	if count == len(a):
		print('YES')
	else:
		print('NO')
	t = t - 1


for _ in range(int(input())):
	a = list(input())
	b = list(input())
	c = list(input())
	flag = 0
	for i in range(len(b)):
		if c[i] in (a[i], b[i]):
			pass
		else:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	a = input()
	b = input()
	c = input()
	ans = 'YES'
	for i in range(len(a)):
		if a[i] != b[i]:
			if c[i] == b[i]:
				a = a[:i] + c[i] + a[i + 1:]
			elif c[i] == a[i]:
				b = b[:i] + c[i] + b[i + 1:]
			else:
				ans = 'NO'
				break
		elif a[i] == b[i] != c[i]:
			ans = 'NO'
	print(ans)


t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	flag = 1
	for i in range(len(c)):
		if c[i] != b[i] and c[i] != a[i]:
			flag = 0
			break
	if flag == 0:
		print('NO')
	else:
		print('YES')


n = int(input())
for asd in range(n):
	a = input()
	b = input()
	c = input()
	ans = 'YES'
	for i in range(len(a)):
		if a[i] != c[i] and b[i] != c[i]:
			ans = 'NO'
	print(ans)


t = int(input())
while t:
	t -= 1
	a = input()
	b = input()
	c = input()
	ans = False
	for i in range(len(a)):
		if a[i] != c[i] and c[i] != b[i]:
			print('NO')
			ans = True
			break
	if ans == False:
		print('YES')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	n = len(a)
	for i in range(n):
		if b[i] == c[i] or c[i] == a[i]:
			continue
		else:
			print('NO')
			break
	else:
		print('YES')


y = int(input())
for i in range(y):
	a = list(input())
	b = list(input())
	c = list(input())
	l = len(a)
	f = 1
	for j in range(l):
		if c[j] == a[j] or c[j] == b[j]:
			pass
		else:
			f = 0
			break
	if f == 0:
		print('NO')
	else:
		print('YES')


for morzer in range(int(input())):
	a = input()
	b = input()
	c = input()
	n = len(a)
	fl = 1
	for i in range(n):
		if not (c[i] == b[i] or c[i] == a[i]) and fl:
			print('NO')
			fl = 0
	if fl:
		print('YES')


for i in range(int(input())):
	pr = 0
	a = input()
	b = input()
	c = input()
	for i in range(len(a)):
		if not (c[i] == a[i] or c[i] == b[i]):
			break
		if i == len(a) - 1:
			pr = 1
	print(['NO', 'YES'][pr])


t = int(input())
for i in range(t):
	s1 = input()
	s2 = input()
	s3 = input()
	x1 = 0
	x2 = 0
	indexl = []
	indexl2 = []
	for _ in range(0, len(s1)):
		if s1[_] != s2[_]:
			indexl.append(_)
		else:
			indexl2.append(_)
	for _ in indexl:
		if not (s3[_] == s1[_] or s3[_] == s2[_]):
			x1 = 1
			break
	if x1 == 1:
		print('NO')
	else:
		for _ in indexl2:
			if not s3[_] == s2[_]:
				x2 = 1
				break
		if x2 == 1:
			print('NO')
		else:
			print('YES')


i = int(input())
while i > 0:
	s1 = input()
	s2 = input()
	s3 = input()
	l = len(s1)
	k = 0
	for n in range(0, l):
		if s3[n] != s1[n] and s3[n] != s2[n]:
			k = 1
			break
	if k == 1:
		print('NO')
	else:
		print('YES')
	i -= 1


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	f = 0
	for i in range(len(a)):
		if a[i] == b[i] and a[i] != c[i] or not (a[i] == c[i] or b[i] == c[i]):
			f = 1
	if f == 1:
		print('NO')
	else:
		print('YES')


def solve():
	a = input()
	b = input()
	c = input()
	for i in range(len(a)):
		if a[i] != c[i] and b[i] != c[i]:
			print('NO')
			break
	else:
		print('YES')
T = int(input())
for _ in range(T):
	solve()


for i in range(int(input())):
	a = input()
	b = input()
	c = input()
	c1 = 0
	flag = 0
	for j in range(int(len(a))):
		c1 = 0
		if a[j] == c[j] or b[j] == c[j]:
			c1 = 1
		if c1 == 0:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')


def test(a, b, c):
	res = True
	for i in range(len(a)):
		tst = a[i] == c[i] or b[i] == c[i]
		res = res and tst
	return res
t = int(input())
for i in range(t):
	(a, b, c) = (input(), input(), input())
	if test(a, b, c):
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	a = input()
	b = input()
	c = input()
	for (ai, bi, ci) in zip(a, b, c):
		if ci != ai and ci != bi:
			print('NO')
			break
	else:
		print('YES')


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

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

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

def inputstring():
	return [x for x in input()]

def inputstringnum():
	return [ord(x) - ord('a') for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	a = inputstring()
	b = inputstring()
	c = inputstring()
	good = True
	for i in range(len(a)):
		if a[i] != c[i] and b[i] != c[i]:
			good = False
			break
	if good:
		print('YES')
	else:
		print('NO')


def solve():
	a = input()
	b = input()
	c = input()
	n = len(a)
	for x in range(n):
		if a[x] != c[x] and b[x] != c[x]:
			return 'NO'
	return 'YES'
t = int(input())
for _ in range(t):
	print(solve())


t = int(input())
while t:
	t -= 1
	a = input()
	b = input()
	c = input()
	flag = True
	for i in range(len(a)):
		if not (a[i] == c[i] or b[i] == c[i] or (a[i] == b[i] and a[i] == c[i])):
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c) = (input(), input(), input())
	n = len(a)
	f = True
	for i in range(n):
		if not (a[i] == c[i] or c[i] == b[i]):
			f = False
			break
	print('YES' if f else 'NO')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	check = True
	for i in range(len(a)):
		if a[i] == c[i] and b[i] != c[i] or (a[i] != c[i] and b[i] == c[i]) or (a[i] == b[i] and b[i] == c[i]):
			continue
		else:
			check = False
	if check:
		print('YES')
	else:
		print('NO')


p = input()
for m in range(int(p)):
	k = list(zip(input(), input(), input()))
	for i in range(len(k)):
		if len(set(k[i])) == len(k[i]) or (k[i][0] == k[i][1] and k[i][0] != k[i][2]):
			judge = 1
			break
		else:
			judge = 0
	print('NO' if judge else 'YES')


t = int(input())
for _ in range(t):
	(a, b, c) = (input(), input(), input())
	n = len(c)
	flag = 0
	for i in range(n):
		(ai, bi, ci) = (a[i], b[i], c[i])
		if ai != bi and (ai == ci or bi == ci):
			continue
		elif ai == bi and ai == ci:
			continue
		else:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	a = list(a)
	b = list(b)
	c = list(c)
	for i in range(len(a)):
		if a[i] != b[i]:
			if a[i] == c[i]:
				b[i] = c[i]
			if b[i] == c[i]:
				a[i] = c[i]
	if a == b == c:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	l = len(a)
	temp = True
	for j in range(l):
		if a[j] == b[j] and a[j] != c[j]:
			temp = False
			break
		elif a[j] != c[j] and b[j] != c[j]:
			temp = False
			break
	if temp:
		print('YES')
	else:
		print('NO')


for _ in [0] * int(input()):
	an = list(input())
	bn = list(input())
	cn = list(input())
	s = ''
	key = True
	for i in range(len(an)):
		if bn[i] == cn[i]:
			s = an[i]
			an[i] = cn[i]
			cn[i] = s
			s = ''
		elif an[i] == cn[i]:
			s = bn[i]
			bn[i] = cn[i]
			cn[i] = s
			s = ''
		elif an[i] == bn[i]:
			key = False
	if an == bn and key:
		print('YES')
	else:
		print('NO')


p = int(input())
for _ in range(p):
	flag = 0
	d = input()
	e = input()
	f = input()
	for i in range(len(f)):
		if d[i] != e[i] and (f[i] == d[i] or f[i] == e[i]):
			pass
		elif d[i] == e[i] and f[i] == d[i]:
			pass
		else:
			flag = 1
			break
	if flag != 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	print('YES' if all((x == z or y == z for (x, y, z) in zip(a, b, c))) else 'NO')


import math
t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	flag = True
	for i in range(len(a)):
		if c[i] == a[i] or c[i] == b[i]:
			continue
		else:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


for x in range(int(input())):
	(a, b, c) = (input(), input(), input())
	f = 0
	for y in range(len(a)):
		if a[y] != c[y] and b[y] != c[y]:
			f = 1
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for z in range(t):
	a = input()
	b = input()
	c = input()
	a = list(a)
	b = list(b)
	c = list(c)
	cn = 0
	for i in range(len(a)):
		if a[i] != b[i] and (c[i] == a[i] or c[i] == b[i]):
			cn += 1
		elif a[i] == b[i] and a[i] == c[i]:
			cn += 1
	if cn == len(a):
		print('YES')
	else:
		print('NO')


a = int(input())
for _ in range(a):
	x = input()
	y = input()
	z = input()
	c = True
	for i in range(len(z)):
		if z[i] != x[i] and z[i] != y[i]:
			c = False
	print('YES' if c else 'NO')


t = int(input())

def test(a, b, c):
	for (x, y, z) in zip(a, b, c):
		if not (x == z or y == z):
			return False
	return True
for _ in range(t):
	a = input()
	b = input()
	c = input()
	if test(a, b, c):
		print('YES')
	else:
		print('NO')


from math import factorial
from collections import Counter
from heapq import heapify, heappop, heappush
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')

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

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 1000000007
INF = float('inf')

def main():
	N = int(input())
	for _ in range(N):
		(a, b, c) = (input(), input(), input())
		le = len(a)
		for i in range(le):
			if c[i] == a[i] or c[i] == b[i] or (a[i] == b[i] and a[i] == c[i]):
				continue
			else:
				print('NO')
				break
		else:
			print('YES')
main()


t = int(input())
while t > 0:
	a = input('')
	a = list(a)
	b = input('')
	b = list(b)
	c = input('')
	c = list(c)
	for i in range(0, len(a)):
		if a[i] == c[i] and b[i] != c[i]:
			b[i] = c[i]
		elif b[i] == c[i] and a[i] != c[i]:
			a[i] = c[i]
		else:
			a[i] = c[i]
	if a == b:
		print('YES')
	else:
		print('NO')
	t = t - 1


test_case = int(input())
for _ in range(test_case):
	(a, b, c) = [list(input()) for i in range(3)]
	for i in range(len(a)):
		if a[i] == c[i]:
			(b[i], c[i]) = (c[i], b[i])
		elif b[i] == c[i]:
			(a[i], c[i]) = (c[i], a[i])
		else:
			(a[i], c[i]) = (c[i], a[i])
	print('YES' if a == b else 'NO')


def Input():
	tem = input().split()
	ans = []
	for it in tem:
		ans.append(int(it))
	return ans
T = Input()[0]
for t in range(T):
	a = input()
	b = input()
	c = input()
	n = len(a)
	flag = True
	for i in range(n):
		if a[i] != c[i] and c[i] != b[i]:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	n = False
	for i in range(len(a)):
		if a[i] != c[i] and b[i] != c[i]:
			n = True
			print('NO')
			break
	if not n:
		print('YES')


t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	ans = 'YES'
	for i in range(len(a)):
		if a[i] != c[i] and c[i] != b[i]:
			ans = 'NO'
	print(ans)


for i in range(int(input())):
	(a, b, c) = [input() for k in range(3)]
	flag = 1
	for j in range(len(c)):
		if not (c[j] == b[j] or c[j] == a[j]):
			flag = 0
			break
	if flag:
		print('YES')
	else:
		print('NO')


n = int(input())
Result = []
for i in range(0, n):
	notMatch = False
	str_1 = input()
	str_2 = input()
	str_3 = input()
	for i in range(0, len(str_3)):
		if str_3[i] is not str_1[i] and str_3[i] is not str_2[i]:
			notMatch = True
			break
	if notMatch is True:
		Result.append('NO')
	else:
		Result.append('YES')
for i in Result:
	print(i)


for _ in range(int(input())):
	(a, b, c) = [input() for i in range(3)]
	for (i, j, k) in zip(a, b, c):
		if i != k and j != k:
			print('NO')
			break
	else:
		print('YES')


n = int(input())
for _ in range(n):
	a = input()
	b = input()
	c = input()
	ok = 1
	for x in range(len(a)):
		if not (a[x] == c[x] or b[x] == c[x]):
			ok = 0
	print(['NO', 'YES'][ok])


def solve(a, b, c):
	n = len(a)
	for i in range(n):
		if a[i] != c[i] and b[i] != c[i]:
			print('NO')
			return
	print('YES')

def main():
	tc = int(input())
	for _ in range(tc):
		a = input()
		b = input()
		c = input()
		solve(a, b, c)
main()


test = int(input())
while test != 0:
	a = input()
	a1 = list(a)
	b = input()
	b1 = list(b)
	c = input()
	c1 = list(c)
	count = 0
	flag = 0
	for i in range(len(a1)):
		if a1[i] != c1[i] and b1[i] != c1[i]:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')
	test -= 1


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	f = 0
	for i in range(len(a)):
		if c[i] == b[i] or c[i] == a[i]:
			continue
		else:
			f = 1
			break
	if f:
		print('NO')
	else:
		print('Yes')


import collections, heapq

def solution():
	(a, b, c) = (input().strip(), input().strip(), input().strip())
	for i in range(len(a)):
		if not (c[i] == b[i] or c[i] == a[i]):
			print('NO')
			return
	print('YES')

def main():
	T = int(input().strip())
	for _ in range(T):
		solution()
main()


t = int(input())
for test in range(t):
	a = list(input())
	b = list(input())
	c = list(input())
	flag = 0
	for i in range(len(a)):
		if a[i] == b[i] and a[i] == c[i]:
			continue
		elif a[i] == b[i]:
			flag = 1
		elif a[i] == c[i]:
			continue
		elif b[i] == c[i]:
			continue
		else:
			flag = 1
	if flag == 0:
		print('YES')
	else:
		print('NO')


import sys
from math import ceil, sqrt
read = sys.stdin.buffer.readline
mi = lambda : map(int, read().split())
li = lambda : list(mi())
cin = lambda : int(read())

def isp(n):
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return True
primes = []
for _ in range(cin()):
	a = input()
	b = input()
	c = input()
	flag = True
	for i in range(len(a)):
		if c[i] != a[i] and c[i] != b[i]:
			flag = False
			break
	print(['no', 'yes'][flag])


t = int(input())
for k in range(t):
	a = input()
	b = input()
	c = input()
	n = len(a)
	j = 0
	while j < n and c[j] in [a[j], b[j]]:
		j += 1
	if j == n:
		print('YES')
	else:
		print('NO')


from math import ceil, sqrt, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def li():
	return list(mi())
t = ii()
while t:
	t -= 1
	a = si()
	b = si()
	c = si()
	f = 0
	c1 = 0
	n = len(a)
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			f = 0
		else:
			f = 1
			break
	if f:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(0, t):
	flag = 1
	a = list(map(str, input()))
	b = list(map(str, input()))
	c = list(map(str, input()))
	for x in range(0, len(a)):
		if b[x] == c[x] and a[x] == c[x]:
			aux = c[x]
			c[x] = b[x]
			b[x] = aux
		elif b[x] == c[x] and a[x] != c[x]:
			aux = c[x]
			c[x] = a[x]
			a[x] = aux
		elif b[x] != c[x] and a[x] == c[x]:
			aux = c[x]
			c[x] = b[x]
			b[x] = aux
		else:
			flag = 0
			break
	if flag == 0:
		print('NO')
	else:
		print('YES')


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def debug(*var, sep=' ', end='\n'):
	print(*var, file=sys.stderr, end=end, sep=sep)
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
(t,) = I()
while t:
	t -= 1
	a = input()
	b = input()
	c = input()
	n = len(a)
	ans = 'YES'
	for i in range(n):
		s = set([a[i], b[i], c[i]])
		if len(s) > 2 or (a[i] == b[i] and c[i] != a[i]):
			ans = 'NO'
			break
	print(ans)


n = int(input())
t = []
for j in range(n + 1):
	if j == n:
		break
	x = input()
	y = input()
	z = input()
	c = 0
	for i in range(len(x)):
		if x[i] == z[i] or y[i] == z[i]:
			c = c + 1
	if c == len(x):
		t.append('YES')
	else:
		t.append('NO')
for k in t:
	print(k)


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	temp = True
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			continue
		else:
			temp = False
			break
	if temp:
		print('YES')
	else:
		print('NO')


def main():
	import sys
	input = sys.stdin.readline
	t = int(input())
	for _ in range(t):
		A = input().rstrip('\n')
		B = input().rstrip('\n')
		C = input().rstrip('\n')
		N = len(A)
		ok = 1
		for i in range(N):
			if A[i] != C[i] and B[i] != C[i]:
				ok = 0
				break
		if ok:
			print('YES')
		else:
			print('NO')
main()


for t in range(int(input())):
	a = input()
	b = input()
	c = input()
	f = 1
	for i in range(len(a)):
		if b[i] == c[i] or c[i] == a[i]:
			continue
		else:
			f = 0
			break
	if f:
		print('YES')
	else:
		print('NO')


t = int(input())
mass = []
for i in range(t):
	s1 = input()
	s2 = input()
	s3 = input()
	c = 0
	const = len(s1)
	for j in range(const):
		if s1[j] == s3[j] or s2[j] == s3[j]:
			c += 1
	if c == const:
		mass.append('YES')
	else:
		mass.append('NO')
for i in mass:
	print(i)


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	a = sys.stdin.readline().strip()
	b = sys.stdin.readline().strip()
	c = sys.stdin.readline().strip()
	for (i, cs) in enumerate(c):
		if cs not in {a[i], b[i]}:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for i2 in range(t):
	x = str(input())
	y = str(input())
	z = str(input())
	no = 0
	for i in range(len(x)):
		if x[i] != z[i] and y[i] != z[i]:
			no = 1
			break
	if no == 1:
		print('NO')
	else:
		print('YES')


import sys
t = int(sys.stdin.readline().rstrip())

def main():
	for _ in range(t):
		s = [sys.stdin.readline().rstrip() for _ in range(3)]
		a = s[0]
		b = s[1]
		c = s[2]
		n = len(a)
		for i in range(n):
			if c[i] == a[i] or c[i] == b[i]:
				continue
			else:
				break
		else:
			yield 'YES'
			continue
		yield 'NO'
ans = main()
print(*ans, sep='\n')


T = int(input())
for i in range(T):
	a = input()
	b = input()
	c = input()
	ans = 'YES'
	for i in range(len(a)):
		if b[i] == a[i] and a[i] != c[i]:
			ans = 'NO'
			break
		if not (b[i] == a[i] == c[i] or (b[i] != a[i] and (a[i] == c[i] or b[i] == c[i]))):
			ans = 'NO'
			break
	print(ans)


from sys import stdin, stdout
import bisect
import math

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

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

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

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

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

def soe(limit):
	l = [1] * (limit + 1)
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
			n = n - 1
		else:
			a = a * a
			n = n >> 1
	return r

def solve():
	a = st()
	co = 0
	b = st()
	c = st()
	for i in range(len(a)):
		if c[i] != a[i] and c[i] != b[i]:
			co = 1
			break
	if co:
		pr('NO')
	else:
		pr('YES')
for _ in range(inp()):
	solve()


for i in range(int(input())):
	(a, b, c) = (input(), input(), input())
	(cnt, n) = (0, len(c))
	for i in range(n):
		if c[i] == a[i] or c[i] == b[i]:
			cnt += 1
		else:
			break
	print('YES') if cnt == n else print('NO')


def solve():
	a = input().strip()
	b = input().strip()
	c = input().strip()
	n = len(a)
	i = 0
	while i < n:
		if a[i] == b[i]:
			if a[i] == c[i]:
				i += 1
			else:
				print('NO')
				return
		elif c[i] == b[i]:
			i += 1
		elif c[i] == a[i]:
			i += 1
		else:
			print('NO')
			return
	print('YES')
t = int(input())
while t:
	t -= 1
	solve()


t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	c1 = 0
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			c1 += 1
	if c1 == len(a):
		print('YES')
	else:
		print('NO')


def swap(x, y):
	(x, y) = (y, x)
	return (x, y)

def main_func(a, b, c):
	a = list(a)
	b = list(b)
	c = list(c)
	for i in range(len(a)):
		if a[i] == c[i]:
			(b[i], c[i]) = swap(b[i], c[i])
		elif b[i] == c[i]:
			(a[i], c[i]) = swap(a[i], c[i])
		else:
			return 'NO'
	return 'YES'
for i in range(int(input())):
	a = input()
	b = input()
	c = input()
	print(main_func(a, b, c))


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	can = True
	for i in range(len(a)):
		if a[i] != c[i] and b[i] != c[i]:
			can = False
			break
	print('YES' if can else 'NO')


for i in range(int(input())):
	a = input()
	b = input()
	c = input()
	if a == b and a != c:
		print('NO')
	elif a != b and (a == c or b == c):
		print('YES')
	else:
		flag = 0
		j = 0
		while j < len(a):
			if a[j] != b[j] and (a[j] == c[j] or b[j] == c[j]):
				j += 1
			elif a[j] == b[j] and a[j] == c[j]:
				j += 1
			else:
				flag = 1
				break
		if flag == 0:
			print('YES')
		else:
			print('NO')


def f(a, b, c):
	for i in range(len(c)):
		if c[i] != a[i] and c[i] != b[i]:
			return 'NO'
	return 'YES'
for i in range(int(input())):
	a = input()
	b = input()
	c = input()
	print(f(a, b, c))


n = int(input())
for q in range(n):
	a = input()
	b = input()
	c = input()
	d = len(a)
	f = 0
	for i in range(d):
		if c[i] == a[i] or c[i] == b[i]:
			pass
		else:
			f = 1
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for l in range(t):
	a = input()
	b = input()
	c = input()
	k = 1
	for i in range(len(a)):
		if not (a[i] == c[i] or b[i] == c[i]):
			k = 0
	if k == 0:
		print('NO')
	else:
		print('YES')


def solve_a():
	n = int(input())
	for _ in range(n):
		a()

def a():
	x = input()
	y = input()
	z = input()
	n = len(x)
	for i in range(n):
		if x[i] != z[i] and y[i] != z[i]:
			print('NO')
			return
	print('YES')
solve_a()


def solve(a, b, c):
	for i in range(len(a)):
		if a[i] != c[i] and b[i] != c[i]:
			return False
	return True
n = int(input())
for i in range(n):
	a = input()
	b = input()
	c = input()
	if solve(a, b, c):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	x = input()
	y = input()
	z = input()
	l = len(x)
	k = 0
	for i in range(l):
		if (z[i] != x[i]) & (z[i] != y[i]):
			k = 1
			print('NO')
			break
	if k == 0:
		print('YES')


t = int(input())
stra = []
strb = []
strc = []
for i in range(t):
	stra.append(input())
	strb.append(input())
	strc.append(input())

def checkswap(a, b, c):
	n = len(a)
	count = 0
	for i in range(n):
		if a[i] == c[i] or (b[i] == c[i] and a[i] != b[i]):
			count += 1
	if count == n:
		return True
	return False
for i in range(t):
	if checkswap(stra[i], strb[i], strc[i]):
		print('YES')
	else:
		print('NO')


t = int(input())
for j in range(t):
	a = list(input())
	b = list(input())
	c = list(input())
	ct = 0
	for (i, j, k) in zip(a, b, c):
		if k != i and k != j:
			ct += 1
			print('NO')
			break
	if ct == 0:
		print('YES')


t = int(input())
m = []
ans = 'no'
c = 0
for i in range(t):
	for j in range(3):
		s = input()
		m.append(s)
	for k in range(len(m[0])):
		if m[2][k] == m[1][k] or m[2][k] == m[0][k]:
			c += 1
	if c == len(m[0]):
		ans = 'yes'
	print(ans)
	ans = 'no'
	c = 0
	m = []


local = False
if local:
	file = open('A.txt', 'r')

def IN():
	if local:
		return file.readline()
	else:
		return input()

def solve(a, b, c):
	for i in range(len(c)):
		if c[i] != b[i] and c[i] != a[i]:
			return 'NO'
	return 'YES'
t = int(IN())
for i in range(t):
	a = IN()
	b = IN()
	c = IN()
	print(solve(a, b, c))


input = __import__('sys').stdin.readline
for _ in range(int(input())):
	(a, b, c) = (input(), input(), input())
	ans = 'YES'
	for i in range(len(a)):
		if len({a[i], b[i], c[i]}) == 3 or a[i] == b[i] != c[i]:
			ans = 'NO'
			break
	print(ans)


str = input()
Case = int(str)
for T in range(Case):
	a = input()
	b = input()
	c = input()
	n = len(a)
	Find = True
	for i in range(n):
		if a[i] != c[i] and b[i] != c[i]:
			Find = False
			break
	if Find:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	a = input()
	b = input()
	c = input()
	flag = 'YES'
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			flag = 'YES'
		else:
			flag = 'NO'
			break
	print(flag)


def calc(a: list, b: list, c: list):
	for i in range(len(a)):
		if a[i] != c[i]:
			(a[i], c[i]) = (c[i], a[i])
		elif b[i] != c[i]:
			(b[i], c[i]) = (c[i], b[i])
	return (''.join(a), ''.join(b))

def main():
	n: int = int(input())
	for _ in range(n):
		a: list = list(input())
		b: list = list(input())
		c: list = list(input())
		(a, b) = calc(a, b, c)
		if a == b:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
while t > 0:
	a = input()
	b = input()
	c = input()
	for (i, j, k) in zip(a, b, c):
		if i == k or j == k:
			pass
		else:
			print('NO')
			break
	else:
		print('YES')
	t -= 1


def solve():
	a = input()
	b = input()
	c = input()
	for i in range(len(a)):
		if c[i] != a[i] and c[i] != b[i]:
			return -1
	return 1
for _ in range(int(input())):
	if solve() == 1:
		print('YES')
	else:
		print('NO')


test = int(input())
while test:
	a = list(input())
	b = list(input())
	c = list(input())
	test -= 1
	lenn = len(a)
	a_temp = list(a)
	b_temp = list(b)
	count = 1
	for i in range(lenn):
		if a[i] != b[i]:
			a_temp[i] = c[i]
			b_temp[i] = c[i]
			if a_temp[i] == b[i]:
				pass
			else:
				a_temp[i] = a[i]
			if b_temp[i] == a[i]:
				pass
			else:
				b_temp[i] = b[i]
		elif a[i] != c[i] and b[i] != c[i]:
			count = 0
	d = ''.join(a_temp)
	e = ''.join(b_temp)
	if d == e and count == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	st1 = input()
	st2 = input()
	st3 = input()
	fl = 1
	for i in range(len(st1)):
		if st1[i] != st3[i] and st2[i] != st3[i]:
			fl = 0
	if fl:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	ok = True
	for i in range(min(len(a), len(b), len(c))):
		if a[i] == c[i] or b[i] == c[i]:
			continue
		else:
			ok = False
	if ok == True:
		print('YES')
	else:
		print('NO')


s = int(input())
count = 0
ans = []
while count < s:
	a = input()
	b = input()
	c = input()
	dic = [x for x in zip(list(a), list(b), list(c))]
	new_a = ''
	new_b = ''
	for y in dic:
		if y[2] == y[1] and y[0] != y[1]:
			new_a += y[2]
			new_b += y[1]
		else:
			new_a += y[0]
			new_b += y[2]
	if new_a == new_b:
		ans.append('YES')
	else:
		ans.append('NO')
	count += 1
print('\n'.join(ans))


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

def main():
	for t in range(int(input())):
		a = input().rstrip()
		b = input().rstrip()
		c = input().rstrip()
		n = len(b)
		ans = 'YES'
		for i in range(n):
			if c[i] != a[i] and c[i] != b[i]:
				ans = 'NO'
				break
		print(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()


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	l = 0
	for x in range(len(a)):
		if a[x] == c[x] or b[x] == c[x]:
			l += 1
		else:
			print('NO')
			break
	if l == len(a):
		print('YES')


for i in range(int(input())):
	a = input()
	b = input()
	c = input()
	r = 0
	for j in range(len(a)):
		if a[j] == c[j] or b[j] == c[j]:
			r += 1
	if r == len(a):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	a = input()
	b = input()
	c = input()
	n = len(a)
	flag = 'YES'
	for j in range(0, n):
		if not (c[j] == a[j] or c[j] == b[j]):
			flag = 'NO'
	print(flag)


T = int(input())
for case in range(T):
	a = list(input())
	b = list(input())
	c = list(input())
	N = len(a)
	zz = True
	for x in range(N):
		if not (a[x] == c[x] or b[x] == c[x]):
			zz = False
			break
	if zz:
		print('YES')
	else:
		print('NO')


kl = int(input())
for l in range(kl):
	a = str(input())
	b = str(input())
	c = str(input())
	pr = 1
	for i in range(len(a)):
		if c[i] not in {a[i], b[i]}:
			pr = 0
			break
	if pr:
		print('YES')
	else:
		print('NO')


t = int(input())
for case_num in range(t):
	a = input()
	b = input()
	c = input()
	ok = True
	for i in range(len(a)):
		if a[i] != c[i] and b[i] != c[i]:
			ok = False
			break
	print('YES' if ok else 'NO')


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)
input = sys.stdin.readline

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

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

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

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
for _ in range(ii()):
	a = input()
	b = input()
	c = input()
	n = len(a)
	flag = 0
	for i in range(n):
		if a[i] == c[i] or b[i] == c[i]:
			flag = 1
		else:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for case in range(0, t):
	a = list(input())
	b = list(input())
	c = list(input())
	for (i, item) in enumerate(zip(a, b, c)):
		if c[i] == a[i] and c[i] != b[i]:
			(c[i], b[i]) = (b[i], c[i])
		elif c[i] != a[i] and c[i] == b[i]:
			(c[i], a[i]) = (a[i], c[i])
		elif a[i] == b[i] and a[i] != c[i]:
			(c[i], a[i]) = (a[i], c[i])
	print('YES') if a == b else print('NO')


t = int(input())
while t:
	t -= 1
	s1 = input()
	s1 = [i for i in s1]
	s2 = input()
	s2 = [i for i in s2]
	s3 = input()
	for i in range(len(s1)):
		if s1[i] == s3[i]:
			s2[i] = s3[i]
		else:
			s1[i] = s3[i]
	s1 = ''.join(s1)
	s2 = ''.join(s2)
	if s1 == s2:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	f = False
	for i in range(len(c)):
		if c[i] != a[i] and c[i] != b[i]:
			f = True
	if f:
		print('NO')
	else:
		print('YES')


test = int(input())
for i in range(test):
	a = list(str(input()))
	b = list(str(input()))
	c = list(str(input()))
	size = len(c)
	for j in range(size):
		if c[j] == a[j]:
			temp = c[j]
			c[j] = b[j]
			b[j] = temp
		elif c[j] == b[j]:
			temp = c[j]
			c[j] = a[j]
			a[j] = temp
		elif a[j] == b[j]:
			temp = c[j]
			c[j] = a[j]
			a[j] = temp
	if a == b:
		print('YES')
	else:
		print('NO')


t = int(input())
a = []
for i in range(t * 3):
	a.append(input())
i = 0
while i < len(a):
	x = a[i]
	y = a[i + 1]
	z = a[i + 2]
	t = 0
	for j in range(len(x)):
		if x[j] != z[j] and y[j] != z[j]:
			print('NO')
			t = 1
			break
	if t == 0:
		print('YES')
	i += 3


def equ(a, b, c):
	l = len(a)
	for i in range(l):
		if a[i] == c[i] or b[i] == c[i]:
			continue
		else:
			return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	print(equ(a, b, c))


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

def I():
	return int(input())

def S():
	return str(input())

def L():
	return list(R())
from collections import Counter
import math
import sys
from itertools import permutations
import bisect
for _ in range(I()):
	a = S()
	b = S()
	c = S()
	cnt = sum([c[i] == a[i] or c[i] == b[i] for i in range(len(a))])
	print(['YES', 'NO'][cnt < len(a)])


from math import *
from bisect import bisect_left as bl
from bisect import bisect_right as br
from collections import Counter as ctr
from collections import deque as dq
from array import array
from re import search
li = lambda : list(map(int, input().split()))
arr = lambda a: array('i', a)
bi = lambda n: bin(n).replace('0b', '')
yn = lambda f: print('NYOE S'[f::2])
sbstr = lambda a, s: search('.*'.join(a), s)

def solve():
	for _ in range(int(input())):
		a = list(input())
		b = list(input())
		c = list(input())
		for i in range(len(a)):
			if a[i] != c[i] and b[i] != c[i]:
				print('NO')
				break
		else:
			print('YES')
solve()


def solution():
	from sys import stdin, stdout
	(_input, _print, _range, _int, _zip, _set, _len) = (stdin.readline, stdout.write, range, int, zip, set, len)
	n = _int(_input())
	for _ in _range(n):
		a = _input().replace('\n', '')
		b = _input().replace('\n', '')
		c = _input().replace('\n', '')
		flag = True
		for i in _zip(a, b, c):
			c = _len(_set(i))
			if c == 1:
				continue
			if c == 3:
				flag = False
				break
			elif i[0] == i[1]:
				flag = False
				break
		if flag:
			_print('YES\n')
		else:
			_print('NO\n')
solution()


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

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

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

def solve():
	a = input()
	b = input()
	c = input()
	result = True
	for i in range(len(a)):
		result = result and (a[i] == c[i] or b[i] == c[i])
	if result:
		print('YES')
	else:
		print('NO')
while t:
	solve()
	t -= 1


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	s = len(a)
	j = 0
	check = []
	while j < s:
		if a[j] != b[j]:
			if c[j] != a[j] and c[j] != b[j]:
				print('NO')
				j = s + 1
			else:
				j += 1
		elif c[j] == a[j]:
			j += 1
		else:
			print('NO')
			j = s + 1
	if j == s:
		print('YES')


numTests = int(input())
answers = []
for i in range(numTests):
	ans = 'YES'
	a = input()
	b = input()
	c = input()
	for i in range(len(a)):
		if not (a[i] == c[i] or b[i] == c[i]):
			ans = 'NO'
			break
	answers.append(ans)
for a in answers:
	print(a)


t = int(input())
while t:
	t -= 1
	flag = 0
	a = input()
	b = input()
	c = input()
	for i in range(len(a)):
		if a[i] == b[i] and a[i] == c[i] or (a[i] == c[i] and a[i] != b[i]) or (b[i] == c[i] and a[i] != c[i]):
			pass
		else:
			flag = 1
			print('NO')
			break
	if flag == 0:
		print('YES')


import sys
for _ in range(int(sys.stdin.readline())):
	a = sys.stdin.readline().rstrip('\n')
	b = sys.stdin.readline().rstrip('\n')
	c = sys.stdin.readline().rstrip('\n')
	pos = True
	for i in range(len(a)):
		if a[i] != c[i] and b[i] != c[i]:
			pos = False
			break
	if pos:
		print('YES')
	else:
		print('NO')


def main():
	t = int(input())
	for i in range(t):
		a = input()
		b = input()
		c = input()
		ans = 'YES'
		for j in range(len(a)):
			if c[j] == a[j] or c[j] == b[j]:
				continue
			else:
				ans = 'NO'
				break
		print(ans)
main()


import sys
input = lambda : sys.stdin.readline().strip()
for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	n = len(a)
	flag = True
	for i in range(n):
		if a[i] == c[i] or b[i] == c[i]:
			pass
		else:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
from math import *
from heapq import *
from collections import *

def main():
	ntest = int(stdin.readline())
	for test in range(ntest):
		a = stdin.readline().strip()
		b = stdin.readline().strip()
		c = stdin.readline().strip()
		try:
			n = len(a)
			for i in range(n):
				x = a[i]
				y = b[i]
				z = c[i]
				assert x == z or y == z
			stdout.write('YES\n')
		except:
			stdout.write('NO\n')
		stdout.flush()
	return 0
main()


t = int(input())
for _ in range(t):
	flag = 1
	a = str(input())
	b = str(input())
	c = str(input())
	n = len(c)
	for i in range(n):
		if c[i] != a[i] and c[i] != b[i]:
			flag = 0
			print('No')
			break
	if flag:
		print('YES')


def int_lst_input():
	return [int(val) for val in input().split(' ')]

def int_input():
	return int(input())

def print_lst(lst):
	print(' '.join([str(val) for val in lst]))

def solve():
	t = int_input()
	for _ in range(t):
		a = list(input())
		b = list(input())
		c = list(input())
		n = len(a)
		yes = True
		for i in range(n):
			if a[i] != c[i] and b[i] != c[i] or (a[i] == b[i] and (a[i] != c[i] or b[i] != c[i])):
				print('NO')
				yes = False
				break
		if yes:
			print('YES')
solve()


x = int(input())
list1 = []
for i in range(x):
	a = input()
	b = input()
	c = input()
	f = 0
	for i in range(0, len(a)):
		if not (c[i] == a[i] or c[i] == b[i]):
			f = 1
	if f == 0:
		list1.append('YES')
	else:
		list1.append('NO')
for i in range(0, len(list1)):
	print(list1[i])


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	a = input().rstrip()
	b = input().rstrip()
	c = input().rstrip()
	ok = True
	for (aa, bb, cc) in zip(a, b, c):
		if cc != aa and cc != bb:
			ok = False
			break
	if ok:
		print('YES')
	else:
		print('NO')


import sys
from math import *
input = sys.stdin.readline

def bo(i):
	return ord(i) - ord('a')
t = int(input())
while t > 0:
	t -= 1
	a = list(input().rstrip())
	b = list(input().rstrip())
	c = list(input().rstrip())
	n = len(a)
	d = 0
	for i in range(n):
		if a[i] == b[i] and a[i] != c[i]:
			d += 1
			break
		if a[i] != b[i] and (b[i] != c[i] and a[i] != c[i]):
			d += 1
			break
	if d == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	flag = True
	for i in range(0, len(a)):
		if a[i] == b[i] and a[i] != c[i]:
			flag = False
			break
		elif a[i] != b[i] and a[i] != c[i] and (b[i] != c[i]):
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for tt in range(t):
	a = input().strip()
	b = input().strip()
	c = input().strip()
	swaps = 0
	for i in range(len(a)):
		if c[i] == b[i] or a[i] == c[i]:
			swaps += 1
	if swaps == len(a):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	x1 = input()
	x2 = input()
	x3 = input()
	f = 0
	for i in range(len(x1)):
		if x1[i] == x3[i] or x2[i] == x3[i]:
			f = 1
		else:
			f = 0
			break
	if f:
		print('YES')
	else:
		print('NO')


t = int(input())
for ti in range(t):
	a = input()
	b = input()
	c = input()
	n = len(a)
	try:
		for i in range(n):
			if c[i] != a[i] and c[i] != b[i]:
				raise Exception
		print('YES')
	except:
		print('NO')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	fl = 1
	for i in range(len(a)):
		if c[i] == b[i] or c[i] == a[i]:
			continue
		fl = 0
	if fl:
		print('yes')
	else:
		print('no')


def problem1(a, b, c):
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			continue
		else:
			return 'NO'
	return 'YES'
N = int(input())
for i in range(N):
	a = input()
	b = input()
	c = input()
	print(problem1(a, b, c))


t = int(input())
while t > 0:
	a = input()
	b = input()
	c = input()
	n = len(a)
	k = all((a[i] == c[i] or b[i] == c[i] for i in range(n)))
	if k:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
for z in range(t):
	a = input()
	b = input()
	c = input()
	f = 0
	for i in range(len(a)):
		if a[i] != c[i] and b[i] != c[i]:
			f = 1
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for d in range(t):
	a = str(input())
	b = str(input())
	c = str(input())
	f = 0
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			f += 1
	if f == len(a):
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	a = list(input())
	b = list(input())
	c = list(input())
	flag = True
	for j in range(len(c)):
		if c[j] == a[j]:
			b[j] = c[j]
		elif c[j] == b[j]:
			a[j] = c[j]
		elif c[j] != b[j] and c[j] != a[j]:
			flag = False
	if a != b or flag == False:
		print('NO')
	elif a == b:
		print('YES')


t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	x = 0
	y = 0
	n = len(a)
	for i in range(n):
		if c[i] == a[i]:
			x += 1
		elif c[i] == b[i]:
			y = y + 1
	if x + y == n:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	flag = 0
	for j in range(len(a)):
		if c[j] not in [b[j], a[j]]:
			flag = 1
			break
	print('YES' if flag == 0 else 'NO')


t = int(input())
while t:
	t -= 1
	a = input()
	b = input()
	c = input()
	ch = 1
	for i in range(len(c)):
		if c[i] != a[i] and c[i] != b[i]:
			print('NO')
			ch = 0
			break
	if ch:
		print('YES')


CASES = int(input())
RES = []
for i in range(0, CASES):
	A_STR = input()
	B_STR = input()
	C_STR = input()
	STR_LEN = len(A_STR)
	flag = 1
	for j in range(0, STR_LEN):
		if C_STR[j] != B_STR[j] and C_STR[j] != A_STR[j]:
			flag = 0
			break
	if flag:
		RES.append('YES')
	else:
		RES.append('NO')
for r in RES:
	print(r)


import sys
input = sys.stdin.readline
import math
for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	a = a[:-1]
	b = b[:-1]
	c = c[:-1]
	n = len(a)
	a1 = ''
	b1 = ''
	c1 = ''
	for i in range(n):
		if c[i] == b[i]:
			c1 += a[i]
			a1 += c[i]
			b1 += b[i]
		else:
			c1 += b[i]
			b1 += c[i]
			a1 += a[i]
	if a1 == b1:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	a = input()
	b = input()
	c = input()
	s1 = list(a)
	s2 = list(b)
	s3 = list(c)
	c1 = 0
	for i in range(len(s1)):
		if s1[i] == s2[i] == s3[i]:
			c1 += 1
		elif s1[i] == s3[i]:
			t1 = s3[i]
			s3[i] = s2[i]
			s2[i] = t1
			c1 += 1
		else:
			t1 = s3[i]
			s3[i] = s1[i]
			s1[i] = t1
			c1 += 1
	if s1 == s2 and c1 == len(a):
		print('YES')
	else:
		print('NO')
	t = t - 1


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	A = [i for i in a]
	B = [i for i in b]
	C = [i for i in c]
	x = 0
	for j in range(len(A)):
		if C[j] == A[j] or C[j] == B[j]:
			x += 1
		else:
			print('NO')
			break
		if x == len(A):
			print('YES')


from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time

def I():
	return int(input())

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

def S():
	return input()

def MS():
	return map(str, input().split())

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

def LI_():
	return [int(i) - 1 for i in input().split()]

def StoI():
	return [ord(i) - 97 for i in input()]

def ItoS(nn):
	return chr(nn + 97)

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

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
YN = {False: 'No', True: 'Yes'}
MOD = 10 ** 9 + 7
inf = float('inf')
IINF = 10 ** 10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False

def solve(T):
	a = S()
	b = S()
	c = S()
	n = len(a)
	cnt = 0
	for i in range(n):
		if a[i] == c[i] or b[i] == c[i]:
			cnt += 1
	if cnt == n:
		print('YES')
	else:
		print('NO')

def main():
	T = I()
	for i in range(T):
		solve(T)
main()


t = int(input())
for _ in range(t):
	s1 = input()
	s2 = input()
	s3 = input()
	can = True
	for i in range(len(s3)):
		if s1[i] == s3[i] or s2[i] == s3[i]:
			continue
		else:
			can = False
			break
	if can:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	(a1, b1, c1) = (list(a), list(b), list(c))
	k = True
	for i in range(len(a)):
		if a1[i] == c1[i]:
			(b1[i], c1[i]) = (c1[i], b1[i])
		elif b1[i] == c1[i]:
			(a1[i], c1[i]) = (c1[i], a1[i])
		else:
			k = False
			break
	if k:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	n = len(a)
	nd = 0
	for i in range(0, n):
		if a[i] == c[i] or b[i] == c[i]:
			nd += 1
	if nd == n:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	a = list(input())
	b = list(input())
	c = list(input())
	if a == c or c == b:
		print('YES')
	else:
		ans = True
		for i in range(len(a)):
			if a[i] != c[i] and c[i] != b[i]:
				ans = False
				break
		if not ans:
			print('NO')
		else:
			print('YES')


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import random
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

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

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

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		a = list(input())
		b = list(input())
		c = list(input())
		flag = 0
		for x in range(len(a)):
			if a[x] != b[x]:
				if a[x] == c[x]:
					continue
				elif b[x] == c[x]:
					continue
				else:
					flag = 1
					break
			elif a[x] != c[x]:
				flag = 1
				break
		if flag:
			no()
		else:
			yes()
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


import math
from collections import *
import sys
from functools import reduce

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

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
UGLYMOD = int(1000000000.0) + 7
SEXYMOD = 998244353
MAXN = int(100000.0)
for _testcases_ in range(int(input())):
	a = input()
	b = input()
	c = input()
	flag = True
	for i in range(len(a)):
		lenOfNums = len(set([a[i], b[i], c[i]]))
		if lenOfNums == 3:
			flag = False
			break
		elif lenOfNums == 2 and a[i] == b[i]:
			flag = False
			break
	print('YES' if flag else 'NO')


for __ in range(int(input())):
	a = input()
	b = input()
	c = input()
	c += a
	k = 0
	for i in range(len(b)):
		if a[i] == c[i] or b[i] == c[i]:
			if not (a[i] == b[i] and a[i] != c[i]):
				k += 1
	if k == len(b):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	h = 0
	for e in range(len(a)):
		if a[e] == b[e]:
			if a[e] == c[e]:
				continue
			else:
				h = 1
				break
		elif b[e] == c[e] or a[e] == c[e]:
			continue
		else:
			h = 1
			break
	if h == 1:
		print('NO')
	else:
		print('YES')


import math
t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	n = len(a)
	i = 0
	fl = 0
	while i < n:
		if a[i] == b[i] and a[i] != c[i]:
			fl = 1
			break
		if a[i] == b[i] or b[i] == c[i] or a[i] == c[i]:
			fl = 0
		else:
			fl = 1
			break
		i += 1
	if fl == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	(a, b, c) = (input(), input(), input())
	for (q, w, e) in zip(a, b, c):
		if e == q:
			continue
		if e == w:
			continue
		break
	else:
		if len(a) == len(b):
			print('YES')
			continue
	print('NO')


import sys, itertools, math
T = int(sys.stdin.readline())
for _ in range(T):
	A = sys.stdin.readline().strip()
	B = sys.stdin.readline().strip()
	C = sys.stdin.readline().strip()
	for i in range(len(A)):
		if C[i] != A[i] and C[i] != B[i]:
			print('NO')
			break
	else:
		print('YES')


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil, pi, sin, cos, acos, atan
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = ip()
for _ in range(t):
	a = ips()
	b = ips()
	c = ips()
	n = len(a)
	flag = True
	for i in range(n):
		if a[i] == c[i] or b[i] == c[i]:
			pass
		else:
			flag = False
			break
	if flag:
		ans = 'YES'
	else:
		ans = 'NO'
	out(ans)


import sys
T = int(sys.stdin.readline())
for i in range(T):
	a = list(map(str, sys.stdin.readline().strip()))
	b = list(map(str, sys.stdin.readline().strip()))
	c = list(map(str, sys.stdin.readline().strip()))
	check = True
	for j in range(len(c)):
		if a[j] == b[j] and a[j] != c[j]:
			check = False
			break
		if a[j] != b[j] and a[j] != c[j] and (b[j] != c[j]):
			check = False
			break
	if check:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	x = input()
	y = input()
	z = input()
	flag = 0
	if x == z or y == z:
		print('YES')
	else:
		for i in range(len(x)):
			if x[i] == z[i] or y[i] == z[i]:
				flag = 1
			else:
				flag = 0
				print('NO')
				break
		if flag == 1:
			print('YES')


for i in range(int(input())):
	a = input()
	b = input()
	c = input()
	y = True
	for j in range(len(a)):
		if c[j] != a[j] and c[j] != b[j]:
			y = False
			break
	if y:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	a1 = input()
	a2 = input()
	a3 = input()
	flag = 0
	for i in range(len(a1)):
		if a1[i] != a3[i] and a2[i] != a3[i]:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


test = int(input())
for t in range(test):
	a = input()
	b = input()
	c = input()
	for x in range(len(a)):
		if a[x] != c[x] and b[x] != c[x]:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
while t:
	t -= 1
	a = input()
	b = input()
	c = input()
	l = len(a)
	flag = 0
	for i in range(l):
		if a[i] == c[i] or b[i] == c[i]:
			continue
		flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


I = input
for _ in range(int(I())):
	print('YES' if all((c in (a, b) for (a, b, c) in zip(I(), I(), I()))) else 'NO')


t = int(input())
while t > 0:
	t = t - 1
	a = [i for i in input()]
	b = [i for i in input()]
	c = [i for i in input()]
	n = len(a)
	for i in range(n):
		if c[i] == a[i]:
			temp = b[i]
			b[i] = c[i]
			c[i] = temp
		elif c[i] == b[i]:
			temp = a[i]
			a[i] = c[i]
			c[i] = temp
		else:
			temp = a[i]
			a[i] = c[i]
			c[i] = temp
	if a == b:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	l = list(input())
	m = list(input())
	s = list(input())
	t = 0
	p = len(l)
	for i in range(p):
		if l[i] == s[i]:
			u = m[i]
			m[i] = s[i]
			s[i] = m[i]
			t += 1
		elif m[i] == s[i]:
			u = l[i]
			l[i] = s[i]
			s[i] = m[i]
			t += 1
	if t == p:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	a = input()
	b = input()
	c = input()
	aux = 0
	for i in range(len(a)):
		if a[i] == b[i] == c[i]:
			continue
		elif a[i] != b[i] and (a[i] == c[i] or b[i] == c[i]):
			continue
		else:
			aux = 1
			break
	if aux == 0:
		print('YES')
	else:
		print('NO')


n = input()
for i in range(int(n)):
	a_str = input()
	b_str = input()
	c_str = input()
	value = all((a == c or b == c for (a, b, c) in zip(a_str, b_str, c_str)))
	print('YES' if value else 'NO')


for i in range(int(input())):
	a = input()
	b = input()
	c = input()
	d = 0
	for j in range(len(a)):
		if a[j] != b[j]:
			if a[j] in c[j] or b[j] in c[j]:
				d += 1
		elif a[j] == b[j] and b[j] == c[j]:
			d += 1
	if d == len(a):
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	a = input()
	b = input()
	c = input()
	t = 1
	for j in range(len(b)):
		if b[j] == c[j] or a[j] == c[j] or a[j] == c[j] == b[j]:
			continue
		else:
			t = 0
			break
	if t == 0:
		print('No')
	else:
		print('Yes')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	n = len(a)
	chk = 0
	for x in range(n):
		if a[x] == b[x] == c[x]:
			continue
		elif a[x] == b[x]:
			chk = 1
			break
		elif a[x] == c[x] or b[x] == c[x]:
			continue
		chk = 1
		break
	print('YES' if chk == 0 else 'NO')


import math
t = int(input())
while t:
	a = input()
	b = input()
	c = input()
	tr = 0
	for i in range(len(a)):
		j = []
		j.append(a[i])
		j.append(b[i])
		j.append(c[i])
		j = set(j)
		if len(j) == 3:
			tr = 1
			break
		if len(j) == 2:
			if a[i] == b[i]:
				tr = 1
				break
	if tr > 0:
		print('NO')
	else:
		print('YES')
	t = t - 1


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	a = input().rstrip()
	b = input().rstrip()
	c = input().rstrip()
	N = len(a)
	flag = True
	for i in range(N):
		if a[i] == c[i] or b[i] == c[i]:
			continue
		else:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
while t != 0:
	a = input()
	b = input()
	c = input()
	flag = 0
	for i in range(0, len(a)):
		if c[i] == a[i] or c[i] == b[i]:
			flag = 1
		else:
			flag = 0
			break
	if flag == 1:
		print('yes')
	else:
		print('no')
	t = t - 1


def mi():
	return map(int, input().split())
for _ in range(int(input())):
	a = list(input())
	b = list(input())
	c = list(input())
	np = False
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			continue
		np = True
		break
	if np:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	(a, b, c) = [input() for _ in range(3)]
	cant = False
	for (ai, bi, ci) in zip(a, b, c):
		if ci is bi or ai is ci:
			pass
		else:
			cant = True
	print('YNEOS'[cant::2])


x = int(input())
d = []
e = []
f = []
for i in range(x):
	m = input()
	n = input()
	o = input()
	d.append(m)
	e.append(n)
	f.append(o)
for i in range(x):
	a = d[i]
	b = e[i]
	c = f[i]
	a = list(a)
	b = list(b)
	c = list(c)
	for j in range(len(a)):
		if a[j] == c[j] and b[j] != c[j]:
			temp = b[j]
			b[j] = c[j]
			c[j] = temp
		elif b[j] == c[j] and a[j] != c[j]:
			temp = a[j]
			a[j] = c[j]
			c[j] = temp
		else:
			temp = a[j]
			a[j] = c[j]
			c[j] = temp
	a = ''.join(a)
	b = ''.join(b)
	if a == b:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(a, b, c) = (input(), input(), input())
	lent = len(a)
	f = True
	for j in range(lent):
		if c[j] not in [a[j], b[j]]:
			print('NO')
			f = False
			break
	if f:
		print('YES')


n = int(input())
for i in range(n):
	fl = 'YES'
	a = input()
	b = input()
	c = input()
	for j in range(len(a)):
		if a[j] == b[j] and a[j] != c[j]:
			fl = 'NO'
		elif not (a[j] == c[j] or b[j] == c[j]):
			fl = 'NO'
	print(fl)


def solve():
	A = input()
	B = input()
	C = input()
	n = len(A)
	idx = 0
	cnt = 0
	while idx < n:
		f_a = A[idx]
		f_b = B[idx]
		f_c = C[idx]
		if f_c == f_b or f_c == f_a:
			cnt += 1
		idx += 1
	if cnt == n:
		print('YES')
	else:
		print('NO')
t = int(input())
for _ in range(t):
	solve()


for x in range(int(input())):
	s1 = input()
	s2 = input()
	s3 = input()
	k = 0
	for (x, y, z) in zip(s1, s2, s3):
		if x == z or y == z:
			if x != y:
				pass
		else:
			print('NO')
			k = 1
			break
	if k != 1:
		print('YES')


def is_possible(a, b, c):
	for (i, item) in enumerate(c):
		if a[i] == b[i] == c[i] or a[i] == c[i] or b[i] == c[i]:
			continue
		return 'NO'
	return 'YES'
T = int(input().strip())
for t in range(T):
	a = input().strip()
	b = input().strip()
	c = input().strip()
	print(is_possible(a, b, c))


for i in range(int(input())):
	a = input()
	b = input()
	c = input()
	can = True
	for (i, val) in enumerate(c):
		if val != a[i] and val != b[i]:
			can = False
			break
	if can:
		print('YES')
	else:
		print('NO')


a = int(input())
lst = []
for x in range(0, a):
	first = input()
	second = input()
	third = input()
	lst.append([first, second, third])

def checker(var):
	for num in range(0, len(var[0])):
		if var[0][num] == var[1][num] and var[0][num] != var[2][num]:
			print('NO')
			return 0
		if var[0][num] != var[2][num] and var[1][num] != var[2][num]:
			print('NO')
			return 0
	print('YES')
for a in lst:
	v = checker(a)


n = int(input())
for i in range(n):
	a = input()
	b = input()
	c = input()
	flag = 1
	x = len(a)
	for i in range(x):
		if a[i] == c[i] or b[i] == c[i]:
			pass
		else:
			flag = 0
			break
	if flag:
		print('YES')
	else:
		print('NO')


m = int(input())
l = []
for _ in range(m):
	a = list(input())
	b = list(input())
	c = list(input())
	for i in range(len(a)):
		if c[i] != a[i] and c[i] != b[i]:
			l.append('NO')
			break
	else:
		l.append('YES')
for i in l:
	print(i)


n = int(input())
for i in range(n):
	a = input()
	b = input()
	c = input()
	is_possible = True
	for j in range(len(a)):
		if a[j] != b[j] and a[j] != c[j] and (b[j] != c[j]) or (a[j] == b[j] and b[j] != c[j]):
			print('NO')
			is_possible = False
			break
	if is_possible:
		print('YES')


t = int(input())
while t > 0:
	t = t - 1
	a = input()
	b = input()
	c = input()
	n = len(a)
	flag = 0
	for i in range(n):
		if a[i] == b[i] != c[i]:
			print('No')
			flag = 1
			break
		elif a[i] != b[i]:
			if c[i] != a[i] and c[i] != b[i]:
				print('No')
				flag = 1
				break
	if flag == 0:
		print('Yes')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	s = 'YES'
	for i in range(len(a)):
		if not (c[i] == a[i] or c[i] == b[i]):
			s = 'NO'
			break
	print(s)


for i in range(int(input())):
	a = list(input())
	b = list(input())
	c = list(input())
	k = 0
	for j in range(len(a)):
		if a[j] == c[j]:
			(b[j], c[j]) = (c[j], b[j])
			k += 1
		elif b[j] == c[j]:
			(a[j], c[j]) = (c[j], a[j])
			k += 1
	if a == b and k == len(a):
		print('YES')
	else:
		print('NO')


def solve():
	A = input()
	B = input()
	C = input()
	n = len(A)
	idx = 0
	while idx < n:
		f_a = A[idx]
		f_b = B[idx]
		f_c = C[idx]
		if f_c != f_b and f_c != f_a:
			print('NO')
			return
		idx += 1
	print('YES')
t = int(input())
for _ in range(t):
	solve()


n = int(input())
lines = ''
for i in range(3 * n):
	lines += input() + '\n'
templines = lines.split('\n')
temparr = [[templines[i], templines[i + 1], templines[i + 2]] for i in range(0, 3 * n, 3)]
for i in range(n):
	a = temparr[i][0]
	b = temparr[i][1]
	c = temparr[i][2]
	l = len(a)
	for j in range(l):
		if a[j] == b[j] and b[j] == c[j]:
			j = j + 1
			continue
		if b[j] == c[j]:
			j = j + 1
			continue
		if a[j] == c[j]:
			j = j + 1
			continue
		else:
			break
	if j == l:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	a = list(input())
	b = list(input())
	c = input()
	for (k, j) in enumerate(c):
		if j == a[k]:
			b[k] = j
		elif j == b[k]:
			a[k] = j
		else:
			print('NO')
			break
	else:
		print('YES')


q = int(input())
for i in range(q):
	a = input()
	b = input()
	c = input()
	result = 'YES'
	for x in range(len(a)):
		if a[x] != c[x] and b[x] != c[x]:
			result = 'NO'
	print(result)


t = int(input())
while t > 0:
	a = list(input())
	b = list(input())
	c = list(input())
	for i in range(len(c)):
		if c[i] == a[i]:
			temp1 = b[i]
			temp2 = c[i]
			b[i] = temp2
			c[i] = temp1
		else:
			temp1 = a[i]
			temp2 = c[i]
			c[i] = temp1
			a[i] = temp2
	if ''.join(a) == ''.join(b):
		print('YES')
	else:
		print('NO')
	t = t - 1


x = int(input())
for i in range(x):
	a = str(input())
	b = str(input())
	c = str(input())
	flag = 'YES'
	j = 0
	while flag == 'YES' and j < len(a):
		if c[j] != a[j] and c[j] != b[j]:
			flag = 'NO'
		else:
			j += 1
	print(flag)


t = int(input())
for I in range(t):
	a = input()
	b = input()
	c = input()
	poss = 1
	for i in range(len(a)):
		if a[i] != b[i] and b[i] != c[i] and (c[i] != a[i]) or (a[i] == b[i] and b[i] != c[i]):
			poss = 0
			break
	if poss:
		print('YES')
	else:
		print('NO')


tests = int(input())
for test in range(tests):
	first = input()
	second = input()
	third = input()
	count = 0
	for (i, j, k) in zip(first, second, third):
		if i == k or j == k:
			count += 1
	if count == len(first):
		print('YES')
	else:
		print('NO')


q = int(input())
for u in range(q):
	a = input()
	b = input()
	c = input()
	n = 0
	for i in range(len(c)):
		if c[i] == a[i] or c[i] == b[i]:
			n += 1
	if n == len(c):
		print('YES')
	else:
		print('NO')


def string(a, b, c):
	for i in range(len(a)):
		if a[i] == b[i] and b[i] == c[i]:
			continue
		elif a[i] != b[i] and (c[i] == a[i] or c[i] == b[i]):
			continue
		else:
			return False
	return True
t = int(input())
while t > 0:
	a = str(input())
	b = str(input())
	c = str(input())
	if string(a, b, c) == True:
		print('Yes')
	else:
		print('No')
	t = t - 1


t = int(input())
while t > 0:
	a = input()
	b = input()
	c = input()
	k = len(a)
	swap = 0
	for i in range(k):
		if a[i] == c[i]:
			swap += 1
		elif b[i] == c[i]:
			swap += 1
		else:
			swap = 0
			break
	if swap == k:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	l = len(a)
	lis1 = list(a)
	lis2 = list(b)
	lis3 = list(c)
	f = 0
	for i in range(l):
		if lis1[i] == lis2[i] == lis3[i]:
			continue
		(lis1[i], lis3[i]) = (lis3[i], lis1[i])
		if lis1[i] == lis2[i]:
			continue
		(lis1[i], lis3[i]) = (lis3[i], lis1[i])
		(lis2[i], lis3[i]) = (lis3[i], lis2[i])
		if lis1[i] == lis2[i]:
			continue
		else:
			f = 1
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	a = input()
	b = input()
	c = input()
	flag = True
	for i in range(len(a)):
		if a[i] == b[i]:
			if a[i] != c[i]:
				flag = False
		elif a[i] == c[i] or b[i] == c[i]:
			continue
		else:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c) = (input(), input(), input())
	ans = True
	for i in range(len(a)):
		if not (c[i] == b[i] or c[i] == a[i]):
			ans = False
	if ans:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = list(input())
	b = list(input())
	c = list(input())
	f = 0
	s = 0
	for i in range(len(a)):
		if a[i] == b[i] and b[i] == c[i]:
			f += 1
		elif a[i] != b[i]:
			if b[i] == c[i] or c[i] == a[i]:
				f += 1
	if f == len(a):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	x = ''
	y = ''
	flag = True
	l = len(a)
	for j in range(l):
		if a[j] == c[j]:
			x += a[j]
			y += c[j]
		elif b[j] == c[j]:
			x += c[j]
			y += b[j]
		else:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


for j in range(int(input())):
	a = list(input())
	b = list(input())
	c = list(input())
	l = len(a)
	k = 0
	for i in range(l):
		if a[i] == b[i]:
			if a[i] == c[i]:
				continue
			else:
				k = 1
				break
		elif a[i] == c[i] or b[i] == c[i]:
			if a[i] == c[i]:
				t = b[i]
				b[i] = c[i]
				c[i] = t
			else:
				t = a[i]
				a[i] = c[i]
				c[i] = t
		else:
			k = 1
			break
	if k == 1:
		print('NO')
	else:
		print('YES')


import sys

def solve():
	line = sys.stdin.readline()
	case_number = int(line.strip())
	for i in range(0, case_number):
		str_a = sys.stdin.readline().strip()
		str_b = sys.stdin.readline().strip()
		str_c = sys.stdin.readline().strip()
		is_ok = True
		for j in range(0, len(str_a)):
			if str_a[j] != str_c[j] and str_b[j] != str_c[j]:
				is_ok = False
				break
		print('YES' if is_ok else 'NO')
solve()


for _ in range(int(input())):
	a = list(input())
	b = list(input())
	c = list(input())
	n = len(a)
	if b == c:
		print('YES')
	else:
		flag = True
		for i in range(n):
			if a[i] != b[i]:
				if b[i] == c[i]:
					a[i] = c[i]
				elif a[i] == c[i]:
					b[i] = c[i]
				else:
					print('NO')
					flag = False
					break
			elif a[i] == b[i]:
				if a[i] != c[i]:
					print('NO')
					flag = False
					break
		if a == b and flag:
			print('YES')


def main():
	l = 1
	T = int(input())
	out = ''
	while l != T + 1:
		A = input()
		B = input()
		C = input()
		out += f'{solve(A, B, C)}\n'
		l += 1
	print(out, flush=True)

def solve(A, B, C):
	for i in range(len(C)):
		if C[i] != B[i] and C[i] != A[i]:
			return 'NO'
	return 'YES'
main()


t = int(input())
q = []

def split(word):
	return [char for char in word]
for i in range(t):
	result = 'YES'
	a = split(input())
	b = split(input())
	c = split(input())
	for j in range(len(a)):
		if a[j] != b[j] and a[j] != c[j] and (b[j] != c[j]) or (a[j] == b[j] and a[j] != c[j]):
			result = 'NO'
			break
		else:
			continue
	q.append(result)
for i in q:
	print(i)


t = int(input())
for T in range(t):
	a = [input() for i in range(3)]
	b = True
	for i in range(len(a[0])):
		if a[0][i] != a[2][i] and a[1][i] != a[2][i]:
			b = False
	if b:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	a = input()
	b = input()
	c = input()
	r = 1
	for i in range(len(c)):
		if a[i] != c[i] and b[i] != c[i]:
			print('No')
			r = 0
			break
	if r:
		print('Yes')


def findAns(a, b, c):
	for i in range(len(b)):
		if a[i] == b[i] and b[i] != c[i]:
			print('NO')
			return 0
		elif a[i] == c[i] or b[i] == c[i]:
			continue
		else:
			print('NO')
			return 0
	print('YES')
for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	findAns(a, b, c)


for i in range(int(input())):
	(a, b, c) = (input(), input(), input())
	ans = 1
	for i in range(len(a)):
		if a[i] != b[i] and a[i] != c[i] and (b[i] != c[i]) or (a[i] == b[i] and c[i] != a[i]):
			ans = 0
			break
	print('YES' if ans else 'NO')


t = int(input())
while t > 0:
	t -= 1
	a = input()
	b = input()
	c = input()
	a = list(a)
	b = list(b)
	c = list(c)
	s = True
	for i in range(len(a)):
		if c[i] != a[i] and c[i] != b[i]:
			s = False
			break
		else:
			s = True
	if s == True:
		print('YES')
	else:
		print('NO')


def mapit():
	temp = list(map(int, input().split()))
	return temp

def solution():
	a = input()
	b = input()
	c = input()
	n = len(a)
	for i in range(n):
		if a[i] != b[i]:
			if a[i] != c[i] and b[i] != c[i]:
				print('NO')
				return
		elif a[i] != c[i]:
			print('NO')
			return
	print('YES')
	return
	return
t = int(input())
while t:
	t -= 1
	solution()


from collections import defaultdict
from itertools import permutations
from os import system
import sys
import queue
import math
for i in range(int(input())):
	a = list(input())
	b = list(input())
	c = list(input())
	bcopy = a[:]
	counter = 0
	flag = False
	for i in range(0, len(a)):
		if a[i] != b[i]:
			if c[i] == b[i]:
				(c[i], a[i]) = (a[i], c[i])
			elif c[i] == a[i]:
				(c[i], b[i]) = (b[i], c[i])
		elif a[i] == b[i] and a[i] != c[i]:
			flag = True
	if a == b and flag == False:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
flag = False
T = int(stdin.readline())
for i in range(T):
	flag = False
	str1 = stdin.readline()
	str2 = stdin.readline()
	str3 = stdin.readline()
	str1 = list(str1)
	str2 = list(str2)
	str3 = list(str3)
	for j in range(len(str3) - 1):
		if str3[j] == str1[j]:
			str2[j] = str3[j]
		elif str3[j] == str2[j]:
			str1[j] = str3[j]
		else:
			flag = True
			break
	if flag:
		stdout.write(str('NO\n'))
	elif ''.join(str1) == ''.join(str2):
		stdout.write(str('YES\n'))
	else:
		stdout.write(str('NO\n'))


f = lambda : list(input())
for _ in range(int(input())):
	(a, b, c) = (f(), f(), f())
	print('YNEOS'[any((z != x and z != y for (x, y, z) in zip(a, b, c))) == True::2])


def check_strings(a, b, c):
	s_len = len(a)
	for i in range(s_len):
		if not (a[i] == c[i] or b[i] == c[i]):
			return False
	return True
test_number = int(input())
for i in range(test_number):
	a = input()
	b = input()
	c = input()
	if check_strings(a, b, c):
		print('YES')
	else:
		print('NO')


t = int(input())
out = str()
for each in range(t):
	a = list(input())
	b = list(input())
	c = list(input())
	count = 0
	for j in range(len(c)):
		if c[j] == a[j] or c[j] == b[j]:
			count += 1
		else:
			break
	if count == len(c):
		out += 'YES'
	else:
		out += 'NO'
	if each < t:
		out += '\n'
print(out)


a = int(input())
for k in range(a):
	b = input()
	c = input()
	d = input()
	sum = 0
	for j in range(len(b)):
		if b[j] == c[j] == d[j]:
			sum += 1
		elif b[j] != c[j] and (c[j] == d[j] or b[j] == d[j]):
			sum += 1
		else:
			print('NO')
			break
	if sum == len(b):
		print('yes')


for i in range(int(input())):
	a = input()
	b = input()
	c = input()
	f = True
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			pass
		else:
			print('NO')
			f = False
			break
	if f:
		print('YES')


from sys import stdin
for _ in range(int(stdin.readline())):
	a = stdin.readline().strip()
	b = stdin.readline().strip()
	c = stdin.readline().strip()
	cond = True
	for i in range(len(a)):
		if a[i] == b[i]:
			if c[i] != a[i]:
				cond = False
				break
			else:
				pass
		elif c[i] == a[i] or c[i] == b[i]:
			pass
		else:
			cond = False
			break
	if cond == True:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	s1 = input()
	s2 = input()
	s3 = input()
	count = 0
	for i in range(len(s1)):
		if s3[i] == s2[i] or s1[i] == s3[i]:
			count += 1
	print('YES') if count == len(s1) else print('NO')


import sys

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

def sieve(n):
	a = [1] * n
	for i in range(2, n):
		if a[i]:
			for j in range(i * i, n, i):
				a[j] = 0
	return a
for __ in range(int(input())):
	a = input()
	b = input()
	c = input()
	n = len(a)
	ans = 'YES'
	for i in range(n):
		if c[i] == b[i] or c[i] == a[i]:
			continue
		ans = 'NO'
	print(ans)


n = int(input())
while n != 0:
	l1 = list(input())
	l2 = list(input())
	l3 = list(input())
	for i in range(len(l2)):
		if l2[i] != l3[i]:
			t = l2[i]
			l2[i] = l3[i]
			l3[i] = t
	for i in range(len(l2)):
		if l1[i] != l2[i]:
			t = l1[i]
			l1[i] = l3[i]
			l3[i] = t
	if l2 == l1:
		print('YES')
	else:
		print('NO')
	n = n - 1


def program():
	a = input()
	b = input()
	c = input()
	n = len(a)
	for i in range(n):
		if a[i] != c[i] and b[i] != c[i]:
			print('NO')
			return 0
	print('YES')
t = int(input())
for i in range(t):
	program()


def solve(a, b, c):
	if all((z in (x, y) for (x, y, z) in zip(a, b, c))):
		print('YES')
	else:
		print('NO')

def main():
	t = int(input().strip())
	for _ in range(t):
		a = input().strip()
		b = input().strip()
		c = input().strip()
		solve(a, b, c)
main()


n = int(input())
for i in range(n):
	a = input()
	b = input()
	c = input()
	flag = True
	for (p, q, r) in zip(a, b, c):
		if not (p == r or q == r):
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


n = int(input())
while n:
	n -= 1
	a = input()
	b = input()
	c = input()
	for i in range(len(a)):
		if (a[i] == c[i] or b[i] == c[i]) and a[i] != b[i] or a[i] == b[i] == c[i]:
			bool1 = True
		else:
			bool1 = False
			break
	if bool1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	i = 0
	l = len(a)
	while i < l and (a[i] == c[i] or b[i] == c[i]):
		i += 1
	if i == l:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	f = 'YES'
	for i in range(len(a)):
		if a[i] != c[i] and b[i] != c[i]:
			f = 'NO'
	print(f)


T = input()
list = []
for processNumber in range(int(T)):
	a = input()
	b = input()
	c = input()
	list.append((a, b, c))
for processNumber in range(int(T)):
	ans = True
	[a, b, c] = list[processNumber]
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			continue
		else:
			ans = False
			break
	if ans == True:
		print('YES')
	else:
		print('NO')


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
t = int(input())
for _ in range(t):
	a = list(input())
	b = list(input())
	c = list(input())
	flag = 0
	for i in range(len(a)):
		if a[i] != b[i]:
			if a[i] == c[i] or b[i] == c[i]:
				continue
			else:
				flag = 1
				break
		elif a[i] == c[i] == b[i]:
			continue
		else:
			flag = 1
			break
	if not flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	s1 = input()
	s2 = input()
	s3 = input()
	l1 = []
	l2 = []
	l3 = []
	for i in s1:
		l1.append(i)
	for i in s2:
		l2.append(i)
	for i in s3:
		l3.append(i)
	k = False
	for i in range(len(l1)):
		if l1[i] == l3[i]:
			k = True
		elif l2[i] == l3[i]:
			k = True
		else:
			k = False
			break
	if k:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	ans = 'YES'
	for i in range(len(a)):
		if c[i] == a[i]:
			continue
		elif c[i] == b[i]:
			continue
		else:
			ans = 'NO'
			break
	print(ans)


t = int(input())
while t:
	a = input()
	b = input()
	c = input()
	n = len(a)
	lol = 0
	for i in range(n):
		if a[i] == b[i] and b[i] != c[i]:
			lol = 1
			break
		if a[i] != b[i]:
			if c[i] != b[i] and c[i] != a[i]:
				lol = 1
				break
	if lol:
		print('NO')
	else:
		print('YES')
	t -= 1


testcast = int(input())
for kkkddki in range(testcast):
	first = str(input())
	second = str(input())
	third = str(input())
	n = len(first)
	flag = 0
	for i in range(n):
		if first[i] != second[i] and second[i] != third[i] and (first[i] != third[i]) or (second[i] == first[i] and first[i] != third[i]):
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	f = 'YES'
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			None
		else:
			f = 'NO'
			break
	print(f)


import sys
readline = sys.stdin.readline
T = int(readline())
Ans = [None] * T
for qu in range(T):
	A = list(map(ord, readline().strip()))
	B = list(map(ord, readline().strip()))
	C = list(map(ord, readline().strip()))
	for (a, b, c) in zip(A, B, C):
		if a != c and b != c:
			break
	else:
		Ans[qu] = 'YES'
		continue
	Ans[qu] = 'NO'
print('\n'.join(Ans))


for j in range(int(input())):
	(a, b, c) = (list(input()), list(input()), list(input()))
	l = len(a)
	ch = 0
	for i in range(l):
		if c[i] == b[i]:
			a[i] = c[i]
			ch += 1
		elif c[i] == a[i]:
			ch += 1
			b[i] = c[i]
	if ''.join(a) == ''.join(b) and ch == l:
		print('YES')
	else:
		print('NO')


import math
for _ in range(int(input())):
	a = list(input())
	b = list(input())
	c = list(input())
	k = 0
	for i in range(len(a)):
		if a[i] == c[i]:
			b[i] = c[i]
		elif b[i] == c[i]:
			a[i] = c[i]
		else:
			k += 1
			break
	if a == b == c:
		print('YES')
	elif k == 0 and a == b:
		print('YES')
	else:
		print('NO')


t = int(input())
for j in range(t):
	(a1, a2, a3) = (input(), input(), input())
	for i in range(len(a1)):
		if a3[i] != a1[i]:
			x = list(a1)
			x[i] = a3[i]
			a1 = ''.join(x)
		elif a3[i] != a2[i]:
			x = list(a2)
			x[i] = a3[i]
			a2 = ''.join(x)
	if a1 == a2:
		print('YES')
	else:
		print('NO')


def answer():
	n = int(input())
	while n:
		a = input()
		b = input()
		c = input()
		i = 0
		done = 0
		while i < len(a):
			if a[i] == b[i]:
				if b[i] == c[i]:
					pass
				else:
					if not done:
						print('NO')
						done = 1
					break
			elif b[i] == c[i]:
				pass
			elif a[i] == c[i]:
				pass
			elif not done:
				print('NO')
				done = 1
			i += 1
		if not done:
			print('YES')
		n -= 1
answer()


num = int(input())
for _ in range(num):
	a = input()
	b = input()
	c = input()
	flag = True
	for (x, y, z) in zip(a, b, c):
		if x == z or y == z:
			pass
		else:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	for i in range(len(a)):
		if a[i] != c[i]:
			a[i].replace('a[i]', 'c[i]')
			a = a[:i] + c[i] + a[i + 1:]
		elif b[i] != c[i]:
			b[i].replace('b[i]', 'c[i]')
			b = b[:i] + c[i] + b[i + 1:]
	if a == b:
		print('yes')
	else:
		print('no')


t = int(input())
for _ in range(t):
	a = list(input())
	b = list(input())
	c = list(input())
	n = len(a)
	flag = True
	for i in range(n):
		if a[i] == c[i] or b[i] == c[i]:
			continue
		else:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


n = int(input())
a = list()
b = list()
c = list()
for j in range(n):
	a.append(input())
	b.append(input())
	c.append(input())
for j in range(n):
	ans = 1
	for i in range(len(a[j])):
		if a[j][i] == b[j][i]:
			if a[j][i] == c[j][i]:
				continue
			else:
				ans = 0
				break
		elif a[j][i] != b[j][i] and (a[j][i] == c[j][i] or b[j][i] == c[j][i]):
			continue
		else:
			ans = 0
			break
	if ans:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c) = (input(), input(), input())
	res = 'YES'
	for i in range(len(a)):
		if b[i] != c[i] and a[i] != c[i]:
			res = 'NO'
			break
	print(res)


for i in range(int(input())):
	a = input()
	b = input()
	c = input()
	d = 0
	r = 0
	for i in range(len(a)):
		if (a[i] != b[i] and c[i] != b[i]) and a[i] != c[i]:
			d += 1
			break
		elif a[i] != b[i] and c[i] == b[i]:
			r += 1
		elif a[i] == c[i] and b[i] != c[i]:
			r += 1
		elif a[i] == c[i] and b[i] == c[i]:
			r += 1
	print('YES' if d == 0 and r == len(a) else 'NO')


import sys
t = 1
t = int(input())
for i in range(t):
	a = list(sys.stdin.readline().strip())
	b = list(sys.stdin.readline().strip())
	c = list(sys.stdin.readline().strip())
	f = 1
	for j in range(len(a)):
		if a[j] == c[j] or b[j] == c[j]:
			continue
		else:
			f = 0
	if f:
		print('YES')
	else:
		print('NO')


result = ''
for i in range(0, int(input())):
	a = input()
	b = input()
	c = input()
	flag = True
	n = 0
	for k in range(0, len(a)):
		if a[k] == c[k] or b[k] == c[k]:
			n += 1
		elif a[k] == b[k]:
			n += 2
		else:
			flag = False
			break
	if flag and n <= len(a):
		result += 'YES\n'
	else:
		result += 'NO\n'
print(result.rstrip('\n'))


t = int(input())
for _ in range(t):
	strings = zip(input(), input(), input())
	print('YES' if all([a == c or b == c for (a, b, c) in strings]) else 'NO')


for _ in range(int(input())):
	ls = [x for x in input()]
	ls1 = [x for x in input()]
	ls2 = [x for x in input()]
	flag = 0
	for i in range(len(ls)):
		if ls2[i] != ls[i] and ls2[i] != ls1[i]:
			flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
r = []
for T in range(t):
	a = input()
	b = input()
	c = input()
	flag = True
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			pass
		else:
			flag = False
			break
	print('YES') if flag else print('NO')


from math import ceil
for _ in range(int(input())):
	flag = 'YES'
	a = list(input())
	b = list(input())
	c = list(input())
	for i in range(len(a)):
		if len({a[i], b[i], c[i]}) == 3:
			flag = 'NO'
		if len({a[i], b[i], c[i]}) == 2:
			if a[i] == b[i]:
				flag = 'NO'
				break
	print(flag)


n = int(input())
s = {}
for i in range(n):
	a = input()
	b = input()
	c = input()
	s[i] = [a, b, c]
for (key, value) in s.items():
	flag = True
	a = list(value[0])
	b = list(value[1])
	c = list(value[2])
	for i in range(len(a)):
		if c[i] == a[i] or c[i] == b[i]:
			flag = True
		else:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	a = input()
	b = input()
	c = input()
	length = len(a)
	count = 0
	for i in range(0, length):
		x = a[i]
		y = b[i]
		if x == c[i]:
			count += 1
		elif y == c[i]:
			count += 1
	if count == length:
		print('YES')
	else:
		print('NO')
	t -= 1


num_cases = int(input())
for i in range(num_cases):
	(a, b, c) = (input(), input(), input())
	for i in range(len(a)):
		if a[i] == b[i] and c[i] != b[i]:
			print('NO')
			break
		elif a[i] != b[i]:
			if a[i] == c[i] or b[i] == c[i]:
				pass
			else:
				print('NO')
				break
		if i == len(a) - 1:
			print('YES')


from sys import stdin, stdout
t = int(stdin.readline())
for case in range(t):
	a = stdin.readline()
	b = stdin.readline()
	c = stdin.readline()
	ok = True
	for i in range(len(a)):
		if a[i] == b[i] and b[i] == c[i] or (a[i] == c[i] or c[i] == b[i]):
			pass
		else:
			ok = False
			break
	if ok:
		stdout.write('YES\n')
	else:
		stdout.write('NO\n')


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	sa = ''
	sb = ''
	for i in range(len(a)):
		if a[i] == c[i]:
			sa += a[i]
			sb += c[i]
		elif b[i] == c[i]:
			sb += b[i]
			sa += c[i]
		else:
			sa += a[i]
			print('NO')
			break
	if sa == sb:
		print('YES')


t = int(input())
for kase in range(t):
	a = input()
	b = input()
	c = input()
	n = len(a)
	ok = True
	for i in range(n):
		if c[i] != a[i] and c[i] != b[i]:
			ok = False
	if ok:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	a = input()
	b = input()
	c = input()
	ans = 0
	for j in range(len(a)):
		if c[j] == a[j] or c[j] == b[j]:
			ans += 1
	if ans == len(b):
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
t = int(input())
for tt in range(t):
	a = input()
	b = input()
	c = input()
	can = True
	for i in range(len(a)):
		if c[i] == a[i] or c[i] == b[i]:
			continue
		else:
			can = False
			break
	if can:
		print('YES')
	else:
		print('NO')


import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub
sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2 ** 62 - 1

def read_int():
	return int(input())

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

def read_float():
	return float(input())

def read_float_n():
	return list(map(float, input().split()))

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

def read_str_n():
	return list(map(str, input().split()))

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

def slv(A, B, C):
	for (a, b, c) in zip(A, B, C):
		if a == c or b == c:
			pass
		else:
			return 'NO'
	return 'YES'

def main():
	N = read_int()
	for _ in range(N):
		A = read_str()
		B = read_str()
		C = read_str()
		print(slv(A, B, C))
main()


def check(a, b, c, n):
	for i in range(n):
		if c[i] != a[i] and c[i] != b[i]:
			print('NO')
			return
	print('YES')
	return
T = int(input())
for _ in range(T):
	a = input()
	b = input()
	c = input()
	n = len(a)
	check(a, b, c, n)


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	flag = True
	for i in range(len(a)):
		if len(set([a[i], b[i], c[i]])) == 3 or (len(set([a[i], b[i], c[i]])) < 3 and a[i] == b[i] and (a[i] != c[i])):
			flag = False
			break
	print(['NO', 'YES'][flag])


t = int(input())
for i in range(t):
	a = str(input().rstrip())
	b = str(input().rstrip())
	c = str(input().rstrip())
	flag = True
	for i in range(len(a)):
		if len(set([a[i], b[i], c[i]])) == 3:
			flag = False
			break
		if a[i] == b[i] and a[i] != c[i]:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


a = int(input())
for j in range(a):
	a1 = input()
	b1 = input()
	c1 = input()
	an = 1
	for i in range(len(a1)):
		if b1[i] == c1[i] or a1[i] == c1[i]:
			pass
		else:
			an = 0
	if an == 0:
		print('NO')
	else:
		print('YES')


t = int(input().strip())
for i in range(t):
	a = input().strip()
	b = input().strip()
	c = input().strip()
	n = len(a)
	flag = True
	for j in range(n):
		if a[j] != b[j]:
			if c[j] == b[j] or a[j] == c[j]:
				continue
			else:
				flag = False
				break
		elif a[j] == c[j]:
			continue
		else:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


def binarySearch(arr, x):
	l = 0
	r = len(arr) - 1
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def js(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] <= x:
			ans = m
			l = m + 1
		else:
			r = m - 1
	return ans

def jg(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] >= x:
			ans = m
			r = m - 1
		else:
			l = m + 1
	return ans
from math import *

def ceil(a, b):
	if a % b == 0:
		return int(a / b)
	else:
		return a // b + 1
for __ in range(int(input())):
	a = input()
	b = input()
	c = input()
	ans = 'YES'
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			pass
		else:
			ans = 'NO'
	print(ans)


c = int(input())
for i in range(c):
	a = input()
	b = input()
	d = input()
	e = len(a)
	f = 'YES'
	for j in range(e):
		if a[j] != d[j] and b[j] != d[j]:
			f = 'NO'
	print(f)


n = int(input())
for ii in range(n):
	a = input()
	b = input()
	c = input()
	m = len(a)
	no = 0
	for i in range(m):
		if a[i] != c[i] and b[i] != c[i]:
			no = 1
	if no == 1:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	a = [I for I in input()]
	b = [I for I in input()]
	c = [I for I in input()]
	n = len(a)
	tot = 0
	for j in range(n):
		if a[j] == c[j]:
			(b[j], c[j]) = (c[j], b[j])
			tot += 1
		elif b[j] == c[j]:
			(a[j], c[j]) = (c[j], a[j])
			tot += 1
	if tot == n:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	a = input()
	b = input()[:len(a)]
	c = input()[:len(a)]
	for j in range(len(a)):
		d = 0
		if a[j] == c[j]:
			m = b[j]
			b = b[0:j] + c[j] + b[j + 1:]
			c = c[0:j] + m + c[j + 1:]
		elif b[j] == c[j]:
			m = a[j]
			a = a[0:j] + c[j] + a[j + 1:]
			c = c[0:j] + m + c[j + 1:]
		else:
			d = 1
			break
	if d == 1:
		print('NO')
	elif a == b:
		print('YES')
	else:
		print('NO')


t = int(input())
for tc in range(t):
	a = list(input())
	b = list(input())
	c = list(input())
	n = len(a)
	ans = 0
	for i in range(n):
		if c[i] == b[i]:
			ans += 1
		elif c[i] == a[i]:
			ans += 1
	if ans == n:
		print('YES')
	else:
		print('NO')


for i in [0] * int(input()):
	a = input()
	b = input()
	c = input()
	for x in range(len(a)):
		if c[x] != b[x] and c[x] != a[x]:
			print('NO')
			break
	else:
		print('YES')


n = int(input())
while n > 0:
	s1 = input()
	s2 = input()
	s3 = input()
	le = len(s3)
	c = 0
	for i in range(le):
		if s1[i] == s2[i] and s3[i] == s2[i]:
			c += 1
		elif s1[i] == s2[i] and s1[i] != s3[i]:
			print('NO')
			break
		elif s1[i] != s2[i] and (s1[i] == s3[i] or s2[i] == s3[i]):
			c += 1
		else:
			print('NO')
			break
	if c == le:
		print('YES')
	n -= 1


import sys, math
MOD = 998244353

def solve():
	a = input()
	b = input()
	c = input()
	n = len(a)
	for i in range(n):
		if a[i] != c[i] and b[i] != c[i]:
			return 'NO'
	return 'YES'
for test in range(1, int(input()) + 1):
	print(solve())


t = int(input())
while t > 0:
	t -= 1
	s1 = input()
	s2 = input()
	s3 = input()
	ok = True
	for i in range(len(s3)):
		if s3[i] != s2[i] and s3[i] != s1[i]:
			ok = False
			break
	if ok:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	s = sum((ac == cc or bc == cc for ((ac, bc), cc) in zip(zip(a, b), c)))
	print(('NO', 'YES')[len(a) == s])


import sys
import math
from collections import defaultdict
from collections import deque
from itertools import combinations
from itertools import permutations
input = lambda : sys.stdin.readline().rstrip()
read = lambda : list(map(int, input().split()))
go = lambda : 1 / 0

def write(*args, sep='\n'):
	for i in args:
		sys.stdout.write('{}{}'.format(i, sep))
INF = float('inf')
MOD = int(1000000000.0 + 7)
YES = 'YES'
NO = 'NO'
for _ in range(int(input())):
	try:
		(a, b, c) = (input(), input(), input())
		for i in zip(a, b, c):
			m = len(set(i))
			if m == 1:
				continue
			elif m == 2:
				if i[0] == i[1]:
					print(NO)
					go()
				else:
					continue
			elif m == 3:
				print(NO)
				go()
		print(YES)
		go()
	except ZeroDivisionError:
		continue
	except Exception as e:
		print(e)
		continue


d = int(input())
for i in range(d):
	x = input()
	y = input()
	z = input()
	m = list(x)
	p = list(y)
	r = list(z)
	flag = 0
	s = 0
	for i in range(len(x)):
		if m[i] != p[i]:
			if m[i] == r[i]:
				p[i] = r[i]
				s = s + 1
			elif p[i] == r[i]:
				m[i] = r[i]
				s = s + 1
			elif m[i] != r[i] and p[i] != r[i]:
				m[i] = r[i]
				s = s + 1
		elif m[i] == p[i]:
			m[i] = r[i]
			s = s + 1
	if m == p and s == len(x):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	i = 0
	n = len(a)
	for j in range(n):
		if a[j] == c[j] and b[j] != c[j] or (a[j] != c[j] and b[j] == c[j]):
			i += 1
		if a[j] == c[j] and c[j] == b[j]:
			i += 1
	if i == n:
		print('YES')
	else:
		print('NO')


import math
t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	ans = True
	for i in range(len(a)):
		if a[i] != c[i] and b[i] != c[i]:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


case = int(input())
t = 0
while t < case:
	count = 0
	a = input()
	b = input()
	c = input()
	n = 0
	while n < len(a):
		if (a[n] == c[n] or b[n] == c[n]) and a[n] != b[n]:
			count += 1
		elif a[n] == b[n] == c[n]:
			count += 1
		else:
			print('NO')
			break
		n += 1
	if count == len(a):
		print('YES')
	t += 1


for t in range(int(input())):
	a = input()
	b = input()
	c = input()
	n = len(a)
	ans = 1
	for i in range(n):
		if not (a[i] == c[i] or b[i] == c[i]):
			ans = 0
			break
	print('YES' if ans else 'NO')


i = int(input())
for k in range(i):
	flag = True
	a = list(input())
	b = list(input())
	c = list(input())
	lenn = len(a)
	n = 0
	for z in range(lenn):
		if b[z] == c[z]:
			a[z] = c[z]
			n += 1
		elif c[z] == a[z]:
			b[z] = c[z]
			n += 1
	for z in range(lenn):
		if a[z] != b[z]:
			flag = False
	if n < lenn:
		flag = False
	if flag:
		print('Yes')
	else:
		print('No')
		flag = True
	n = 0


t = int(input())
d = []

def fonction(a, b, c):
	test = 'Yes'
	for i in range(len(a)):
		if c[i] != a[i] and c[i] != b[i]:
			test = 'No'
			break
	return test
for i in range(t):
	a = input()
	b = input()
	c = input()
	d.append(fonction(a, b, c))
for k in d:
	print(k)


for j in range(int(input())):
	s1 = input()
	s2 = input()
	s3 = input()
	count = 0
	n = len(s1)
	for i in range(0, n):
		if str(s1[i]) == str(s2[i]) and str(s1[i]) == str(s3[i]):
			count += 1
		elif str(s1[i]) != str(s2[i]) and str(s1[i]) == str(s3[i]):
			count += 1
		elif str(s1[i]) != str(s2[i]) and str(s2[i]) == str(s3[i]):
			count += 1
		elif str(s1[i]) == str(s2[i]) and str(s1[i]) != str(s3[i]):
			break
	if count == n:
		print('yes')
	else:
		print('no')


I = input
exec(int(I()) * "print('NYOE S'[all(y in x for*x,y in zip(I(),I(),I()))::2]);")


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	status = 0
	for i in range(len(a)):
		if a[i] == b[i] != c[i] or (a[i] != b[i] and a[i] != c[i] and (b[i] != c[i])):
			status = 1
			break
	print('YNEOS'[status::2])


no = int(input())
res = []
for i in range(no):
	a = input()
	b = input()
	c = input()
	aa = 1
	n = len(a)
	for i in range(n):
		if c[i] != a[i] and c[i] != b[i]:
			aa = 0
			break
	if aa == 0:
		res.append('NO')
	else:
		res.append('YES')
for i in res:
	print(i)


def solve(a, b, c):
	for i in range(len(a)):
		if a[i] != c[i] and b[i] != c[i]:
			return 'NO'
	return 'YES'
answers = []
for i in range(int(input())):
	a = input()
	b = input()
	c = input()
	answers.append(solve(a, b, c))
for answer in answers:
	print(answer)


queries = int(input())
for i in range(queries):
	a = input()
	b = input()
	c = input()
	length = len(a)
	flag = True
	for i in range(length):
		if a[i] != c[i] and b[i] != c[i]:
			flag = False
			break
	print(['NO', 'YES'][flag])


from collections import Counter
from collections import defaultdict
import math
t = int(input())
for _ in range(0, t):
	a = list(input())
	b = list(input())
	c = list(input())
	f = 1
	for i in range(0, len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			f = 1
		else:
			f = 0
			break
	if f:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	a = list(input())
	b = list(input())
	c = list(input())
	i = 0
	n = len(a)
	B = True
	while i < n and B:
		if b[i] == c[i] or a[i] == c[i]:
			i += 1
		else:
			B = False
	if B:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	p = list(input())
	q = list(input())
	r = list(input())
	for i in range(len(p)):
		if p[i] == r[i]:
			(q[i], r[i]) = (r[i], q[i])
		else:
			(p[i], r[i]) = (r[i], p[i])
	x = ''.join(p)
	y = ''.join(q)
	if x == y:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	ans = 'YES'
	for i in range(len(a)):
		(A, B, C) = sorted([a[i], b[i], c[i]])
		if A != B and B != C:
			ans = 'NO'
		if a[i] == b[i] and a[i] != c[i]:
			ans = 'NO'
	print(ans)


for a0 in range(int(input())):
	a = input()
	b = input()
	c = input()
	x = len(a)
	for i in range(x):
		if c[i] == b[i] or a[i] == c[i]:
			continue
		else:
			print('NO')
			break
	else:
		print('YES')


k = []
for _ in range(int(input())):
	a = input('')
	b = input('')
	c = input('')
	for i in range(len(a)):
		if a[i] != b[i] and a[i] != c[i] and (b[i] != c[i]) or a[i] == b[i] != c[i]:
			k.append('NO')
			break
	else:
		k.append('YES')
for i in k:
	print(i)


n = int(input())
for i in range(n):
	A = input()
	B = input()
	C = input()
	c = 0
	for i in range(len(A)):
		if C[i] == A[i] or C[i] == B[i]:
			c += 1
	if c == len(A):
		print('YES')
	else:
		print('NO')


for nt in range(int(input())):
	a = input()
	b = input()
	c = input()
	ans = 'YES'
	for i in range(len(a)):
		if len(set([a[i], b[i], c[i]])) > 2:
			ans = 'NO'
			break
		if a[i] == b[i] and c[i] != a[i]:
			ans = 'NO'
			break
	print(ans)


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
from collections import defaultdict

def solve(l):
	n = len(l)
T = int(input())
for _ in range(T):
	a = input()
	b = input()
	c = input()
	f = 1
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			x = 1
		else:
			f = 0
	if f:
		print('YES')
	else:
		print('NO')


import math
q = int(input())
for _ in range(q):
	a = list(input())
	b = list(input())
	c = list(input())
	n = len(a)
	flag = 1
	for i in range(n):
		if c[i] == a[i] or c[i] == b[i]:
			continue
		else:
			flag = -1
			print('NO')
			break
	if flag == 1:
		print('YES')


n = int(input())
list1 = []
for i in range(n):
	a = input()
	b = input()
	c = input()
	temp = 'YES'
	for i in range(len(a)):
		if a[i] != c[i] and b[i] != c[i]:
			temp = 'NO'
	list1.append(temp)
for j in list1:
	print(j)


import sys
input = sys.stdin.readline

def main():
	for _ in range(int(input())):
		a = input()
		b = input()
		c = input()
		is_break = False
		for i in range(len(a)):
			if a[i] == b[i] != c[i]:
				is_break = True
				break
			if a[i] != b[i] and a[i] != c[i] and (b[i] != c[i]):
				is_break = True
				break
		if is_break:
			print('NO')
		else:
			print('YES')
main()


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	n = len(a)
	f = 0
	for i in range(n):
		if a[i] == b[i] and b[i] == c[i]:
			pass
		elif a[i] != b[i] and (a[i] == c[i] or b[i] == c[i]):
			pass
		else:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


import sys
inp = sys.stdin.readline
input = lambda : inp().strip()
flush = sys.stdout.flush

def iin():
	return int(input())

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

def main():
	T = iin()
	while T:
		T -= 1
		(a, b, c) = (input(), input(), input())
		n = len(a)
		for i in range(n):
			(m, j, n) = (a[i], b[i], c[i])
			if n == j or m == n:
				continue
			else:
				print('No')
				break
		else:
			print('YES')
main()


n = int(input())
for j in range(n):
	a = input()
	b = input()
	c = input()
	flag = 1
	for (i, val) in enumerate(a):
		if a[i] != c[i] and b[i] != c[i]:
			print('NO')
			flag = 0
			break
	if flag:
		print('YES')


T = int(input())
for counts in range(0, T):
	a = list(input())
	b = list(input())
	c = list(input())
	lens = len(a)
	flag = 1
	for i in range(0, lens):
		if c[i] != a[i] and c[i] != b[i]:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	a = str(input())
	b = str(input())
	c = str(input())
	flag = 1
	for j in range(len(c)):
		if not (c[j] == a[j] or c[j] == b[j]):
			flag = 0
	if flag == 1:
		print('YES')
	else:
		print('NO')


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random
from io import BytesIO, IOBase

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

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

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

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
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 _ in range(ii()):
	a = input()
	b = input()
	c = input()
	n = len(a)
	flag = 0
	for i in range(n):
		if a[i] == c[i] or b[i] == c[i]:
			flag = 1
		else:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	a = str(input())
	b = str(input())
	c = str(input())
	flag = 0
	for i in range(0, len(a)):
		d = a[i] + b[i] + c[i]
		if len(set(d)) == 3:
			flag = 1
			break
		elif len(set(d)) == 1:
			continue
		elif len(set(d)) == 2 and a[i] == b[i]:
			flag = 1
			break
	if flag > 0:
		print('NO')
	else:
		print('YES')


a = lambda : input()
for i in range(int(input())):
	b = a()
	c = a()
	d = a()
	e = 0
	for j in range(len(b)):
		if b[j] != d[j] and c[j] != d[j]:
			e += 1
			break
	print('YNEOS'[e::2])


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	d = True
	for j in range(len(c)):
		if a[j] == c[j]:
			continue
		elif b[j] == c[j]:
			continue
		else:
			d = False
			break
	if d == False:
		print('NO')
	else:
		print('YES')


tc = int(input())
while tc:
	tc -= 1
	a = input()
	b = input()
	c = input()
	length = len(a)
	i = 0
	while i < length:
		if c[i] != a[i] and c[i] != b[i]:
			break
		i += 1
	if i == length:
		print('YES')
	else:
		print('NO')


from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 10 ** 9 + 7

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

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n').split(' ')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
	a = st()
	b = st()
	c = st()
	n = len(a)
	ans = 'YES'
	for i in range(n):
		if b[i] == c[i]:
			continue
		elif a[i] == c[i]:
			continue
		elif a[i] == c[i] == b[i]:
			continue
		else:
			ans = 'NO'
			break
	print(ans)


n = int(input())
import math
from functools import reduce
for i in range(n):
	a = list(map(str, input().strip()))
	b = list(map(str, input().strip()))
	c = list(map(str, input().strip()))
	x = -1
	for i in range(len(a)):
		if b[i] == c[i] or a[i] == c[i]:
			x += 1
	if x == len(a) - 1:
		print('YES')
	else:
		print('NO')


def main():
	t = int(input())
	for _ in range(t):
		a = input()
		b = input()
		c = input()
		n = len(a)
		result = 'YES'
		for i in range(n):
			if c[i] != a[i] and c[i] != b[i]:
				result = 'NO'
				break
		print(result)
main()


n = int(input())

def arePermutation(str1, str2):
	n1 = len(str1)
	n2 = len(str2)
	if n1 != n2:
		return False
	a = sorted(str1)
	str1 = ' '.join(a)
	b = sorted(str2)
	str2 = ' '.join(b)
	for i in range(0, n1, 1):
		if str1[i] != str2[i]:
			return False
	return True
for i in range(n):
	first = input()
	second = input()
	third = input()
	count = 0
	for i in range(len(first)):
		if third[i] == second[i] or third[i] == first[i]:
			count += 1
		else:
			break
	if count == len(first):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	g = True
	for i in range(len(c)):
		if a[i] != b[i]:
			if c[i] == a[i] or c[i] == b[i]:
				continue
			else:
				g = False
				break
		elif c[i] != a[i]:
			g = False
			break
	if g:
		print('YES')
	else:
		print('NO')


def answer(abc):
	a = abc[0]
	b = abc[1]
	c = abc[2]
	for i in range(len(a)):
		if a[i] != c[i] and b[i] != c[i]:
			return 'NO'
	return 'YES'
testCount = int(input())
for i in range(testCount):
	abc = []
	for j in range(3):
		abc.append(input())
	print(answer(abc))


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	ans = False
	i = 0
	for (d, e, f) in zip(a, b, c):
		if d == f or e == f:
			i += 1
		else:
			print('NO')
			break
	if i == len(a):
		print('YES')


from itertools import *
for u in range(int(input())):
	a = input()
	b = input()
	c = input()
	x = len(c)
	s = 0
	for i in range(x):
		if c[i] == a[i] or c[i] == b[i]:
			s = s + 1
	if s == x:
		print('YES')
	else:
		print('NO')


class Solution:

	def threeStrings(self, a, b, c):
		for i in range(len(a)):
			if not (b[i] == c[i] or a[i] == c[i]):
				return False
		return True
sol = Solution()
t = int(input())
for _t in range(t):
	a = input()
	b = input()
	c = input()
	ans = sol.threeStrings(a, b, c)
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	a = list(str(input()))
	b = list(str(input()))
	c = list(str(input()))
	flag = 0
	for j in range(len(a)):
		if c[j] == b[j]:
			temp = c[j]
			c[j] = a[j]
			a[j] = temp
		elif c[j] == a[j]:
			temp = c[j]
			c[j] = b[j]
			b[j] = temp
		else:
			flag = 1
	if a == b and flag != 1:
		print('YES')
	else:
		print('NO')


n = int(input())
for j in range(n):
	a = input()
	b = input()
	c = input()
	r = 'YES'
	for i in range(len(a)):
		if not (a[i] == b[i] == c[i] or (a[i] != b[i] and (c[i] == a[i] or c[i] == b[i]))):
			r = 'NO'
			break
	print(r)


t = int(input())
while t > 0:
	t -= 1
	s1 = input()
	s2 = input()
	s3 = input()
	f = True
	for i in range(len(s1)):
		if s1[i] == s2[i] and s3[i] != s1[i]:
			f = False
			break
		elif s1[i] == s3[i] or s2[i] == s3[i]:
			continue
		else:
			f = False
			break
	if f == True:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	a = input()
	b = input()
	c = input()
	count = 0
	for j in range(len(a)):
		if str(a[j]) == str(b[j]) and str(a[j]) == str(c[j]):
			count += 1
		if str(a[j]) != str(b[j]) and str(a[j]) == str(c[j]):
			count += 1
		if str(a[j]) != str(b[j]) and str(b[j]) == str(c[j]):
			count += 1
		if str(a[j]) == str(b[j]) and str(a[j]) != str(c[j]):
			break
	if count == len(a):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	flag = 0
	for (i, j, k) in zip(a, b, c):
		if i == j and (i != k or j != k):
			flag = 1
			break
		if i != j and i != k and (j != k):
			flag = 1
			break
	print('YES') if flag == 0 else print('NO')


import string

def main():
	line = input()
	line1 = input()
	line2 = input()
	letters = dict()
	for i in range(0, len(line)):
		if line[i] != line2[i] and line1[i] != line2[i]:
			print('NO')
			return
	print('YES')
t = int(input())
for i in range(t):
	main()


a = int(input())

def solve(x, y, z):
	for i in range(len(x)):
		if z[i] != x[i] and z[i] != y[i]:
			print('NO')
			return 0
	print('YES')
	return 0
for i in range(a):
	(x, y, z) = (str(input()), str(input()), str(input()))
	solve(x, y, z)


t = int(input())
for i in range(0, t):
	a = input()
	b = input()
	c = input()
	l = len(a)
	cnt = 0
	for i in range(0, l):
		if b[i] == c[i] and a[i] != c[i]:
			cnt = cnt + 1
		elif b[i] != c[i] and a[i] == c[i]:
			cnt = cnt + 1
		elif b[i] == c[i] and a[i] == c[i]:
			cnt = cnt + 1
	if cnt != l:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	flag = 0
	n = len(a)
	for i in range(n):
		if c[i] not in (a[i], b[i]):
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


import sys
from math import ceil
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(int(ri())):
	a = ri()
	b = ri()
	c = ri()
	flag = True
	for i in range(len(a)):
		if not (a[i] == c[i] or b[i] == c[i]):
			flag = False
			break
	if flag:
		YES()
	else:
		NO()


I = input
for _ in range(int(I())):
	print('NYOE S'[all((c in (a, b) for (a, b, c) in zip(I(), I(), I())))::2])


n = int(input())
d = []
for i in range(n):
	a = list(input())
	b = list(input())
	c = list(input())
	for j in range(len(a)):
		if a[j] == c[j] and b[j] != c[j]:
			flag = 1
		elif a[j] != c[j] and b[j] == c[j]:
			flag = 1
		elif a[j] == b[j] == c[j]:
			flag = 1
		else:
			flag = 0
			break
	if flag == 1:
		d.append('YES')
	else:
		d.append('NO')
for i in range(len(d)):
	print(d[i])


import sys
input = sys.stdin.readline
Q = int(input())
Query = []
for _ in range(Q):
	A = input().rstrip()
	B = input().rstrip()
	C = input().rstrip()
	Query.append((A, B, C))
for (A, B, C) in Query:
	ok = True
	for i in range(len(C)):
		if C[i] == A[i] or C[i] == B[i]:
			continue
		ok = False
		break
	print('YES' if ok else 'NO')


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		a = input()
		b = input()
		c = input()
		n = len(a)
		canswap = True
		for i in range(n):
			if a[i] == c[i] or b[i] == c[i]:
				continue
			else:
				canswap = False
				break
		if canswap:
			yield 'YES'
		else:
			yield 'NO'
t = int(input())
ans = gift()
print(*ans, sep='\n')


n = int(input())
t = []
for i in range(n):
	(a, b, c) = (input(), input(), input())
	p = 0
	for k in range(len(a)):
		if a[k] == c[k] or b[k] == c[k]:
			p += 1
	if p == len(a):
		t.append('YES')
	else:
		t.append('NO')
for each in t:
	print(each, sep='/n')


import sys
from sys import stdin, stdout
import bisect
import math
import heapq

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
import math

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def main():
	t = inin()
	for _ in range(t):
		a = sin()
		b = sin()
		c = sin()
		n = len(a)
		ans = 'YES'
		for i in range(n):
			if c[i] == b[i] or a[i] == c[i]:
				continue
			ans = 'NO'
			break
		print(ans)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			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')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


t = int(input())
for case in range(t):
	a = input()
	b = input()
	c = input()
	answer = 'YES'
	for i in range(len(a)):
		if c[i] not in [a[i], b[i]]:
			answer = 'NO'
			break
	print(answer)


n = int(input())
for t in range(n):
	a = input()
	b = input()
	c = input()
	flag = 0
	for k in range(len(a)):
		if b[k] != c[k] and a[k] != c[k]:
			flag = 1
		if flag == 1:
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	n = len(a)
	res = True
	for i in range(n):
		if len(set([a[i], b[i], c[i]])) == 3:
			print('NO')
			res = False
			break
		elif a[i] == b[i]:
			if a[i] != c[i]:
				print('NO')
				res = False
				break
	if res:
		print('YES')


T = int(input())
for i in range(T):
	a = input()
	b = input()
	c = input()
	temp = 1
	for j in range(len(a)):
		if not (c[j] == a[j] or c[j] == b[j]):
			temp = 0
			break
	if temp == 0:
		print('NO')
	else:
		print('YES')


import array
import bisect
import collections
import fractions
import heapq
import itertools
import math
import re
import string
import sys

class joshu:

	@staticmethod
	def getInt():
		return int(input().strip())

	@staticmethod
	def getInts():
		return [int(i) for i in input().strip().split()]

	@staticmethod
	def getFloat():
		return float(input().strip())

	@staticmethod
	def getFloats():
		return [float(i) for i in input().strip().split()]

	@staticmethod
	def getStr():
		return str(input().strip())

	@staticmethod
	def getStrs():
		return [str(i) for i in input().strip().split()]

def solution(ss):
	n = len(ss[0])
	for i in range(n):
		if ss[0][i] != ss[2][i] and ss[1][i] != ss[2][i]:
			return False
	return True

def main():
	case_num = joshu.getInt()
	for case_id in range(case_num):
		ss = [joshu.getStr() for i in range(3)]
		if solution(ss):
			sys.stdout.write('YES\n')
		else:
			sys.stdout.write('NO\n')
main()


for _ in range(int(input())):
	k1 = input()
	k2 = input()
	k3 = input()
	c = 0
	for i in range(len(k1)):
		if k3[i] == k2[i] or k3[i] == k1[i]:
			continue
		else:
			c = 1
	if c == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	A = input()
	B = input()
	C = input()
	for i in range(len(A)):
		if A[i] == C[i] or B[i] == C[i]:
			pass
		else:
			print('NO')
			break
	else:
		print('YES')


from math import *
zzz = int(input())
for zz in range(zzz):
	a = input()
	b = input()
	c = input()
	ha = True
	for i in range(len(a)):
		if not b[i] == c[i] and (not a[i] == c[i]):
			ha = False
			break
	if not ha:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	a = str(input())
	b = str(input())
	c = str(input())
	ok = True
	for i in range(len(c)):
		if c[i] == b[i] and c[i] != a[i]:
			continue
		elif c[i] == a[i] and c[i] != b[i]:
			continue
		elif c[i] == a[i] and c[i] == b[i]:
			continue
		else:
			ok = False
			break
	if ok:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	a = list(input())
	b = list(input())
	c = list(input())
	na = 0
	for i in range(len(a)):
		if a[i] == b[i] == c[i]:
			pass
		elif a[i] == b[i] and a[i] != c[i]:
			na = 1
			break
		elif b[i] == c[i]:
			(a[i], c[i]) = (c[i], a[i])
		elif a[i] == c[i]:
			(b[i], c[i]) = (c[i], b[i])
		else:
			na = 1
			break
	if na == 0:
		print('YES')
	else:
		print('NO')


def solve(a, b, c):
	for i in range(len(a)):
		if a[i] == b[i] and a[i] == c[i]:
			continue
		elif a[i] == c[i]:
			b[i] = c[i]
		elif b[i] == c[i]:
			a[i] = c[i]
		else:
			return 0
	return a == b
for i in range(int(input())):
	a = list(input())
	b = list(input())
	c = list(input())
	if solve(a, b, c):
		print('YES')
	else:
		print('NO')


t = int(input())

def go():
	a = input()
	b = input()
	c = input()
	for (aa, bb, cc) in zip(a, b, c):
		if aa == cc or bb == cc:
			pass
		else:
			return 'NO'
	return 'YES'
for _ in range(t):
	print(go())


t = int(input())
while t > 0:
	a = str(input())
	b = str(input())
	c = str(input())
	x = 1
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			k = 1
		else:
			x = 0
	if x == 1:
		print('YES')
	else:
		print('NO')
	t = t - 1


def hello_nigga():
	for _ in range(int(input())):
		a = input()
		b = input()
		c = input()
		ans = 'YES'
		for i in range(len(a)):
			if len(set([a[i], c[i]])) == 2 and len(set([b[i], c[i]])) == 2:
				ans = 'NO'
				break
		print(ans)
if 'compiler is alive':
	if 'it has sence' and 'the wether is nice':
		hello_nigga()


def solve(A, B, C):
	N = len(A)
	for i in range(N):
		if not (A[i] == C[i] or B[i] == C[i]):
			return 'NO'
	return 'YES'
(T,) = map(int, input().split())
for t in range(T):
	A = input()
	B = input()
	C = input()
	ans = solve(A, B, C)
	print(ans)


t = int(input())
for _ in range(t):
	(a, b, c) = (input(), input(), input())
	if all((a[i] == c[i] or b[i] == c[i] for i in range(len(a)))):
		print('YES')
	else:
		print('NO')


t = int(input())
for loop in range(t):
	a = input()
	b = input()
	c = input()
	flag = True
	for i in range(len(a)):
		if a[i] != c[i] and b[i] != c[i]:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


case = int(input())
for i in range(case):
	count = 0
	a = input().strip('\n\r')
	b = input().strip('\n\r')
	c = input().strip('\n\r')
	for j in range(len(a)):
		if c[j] == a[j] or c[j] == b[j]:
			count += 1
		else:
			print('NO')
			break
	if count == len(a):
		print('YES')


import sys, math
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
t = 1
t = inp()
for tt in range(t):
	a = insr()
	b = insr()
	c = insr()
	qw = 0
	for i in range(len(a)):
		if a[i] == b[i] == c[i]:
			continue
		if a[i] == b[i] and a[i] != c[i] or not (a[i] != b[i] and (a[i] == c[i] or b[i] == c[i])):
			qw = 1
			break
	if qw == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	a = list(input())
	b = list(input())
	c = list(input())
	flag = 0
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			continue
		else:
			print('no')
			flag = 1
			break
	if flag == 0:
		print('yes')


import math
I = input
t = int(I())
for tt in range(t):
	a = input()
	b = input()
	c = input()
	fg = 1
	for i in range(len(a)):
		if c[i] == a[i] and c[i] != b[i]:
			continue
		elif c[i] == b[i] and c[i] != a[i]:
			continue
		elif c[i] == a[i] and c[i] == b[i]:
			continue
		else:
			print('NO')
			fg = 0
			break
	if fg == 1:
		print('YES')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	d = 0
	for i in range(len(a)):
		if b[i] == a[i] or b[i] == c[i] or a[i] == c[i]:
			if a[i] == b[i] and a[i] != c[i]:
				continue
			else:
				d += 1
	if d == len(a):
		print('YES')
	else:
		print('NO')


t = int(input())
for inh in range(0, t):
	a = input()
	b = input()
	c = input()
	n = len(a)
	(ans, i) = (True, 0)
	while i < n:
		if a[i] == c[i] or b[i] == c[i]:
			i += 1
		else:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	a = list(input())
	b = list(input())
	c = list(input())
	for j in range(len(a)):
		if a[j] == b[j] and a[j] != c[j]:
			a[j] = c[j]
		elif a[j] == c[j] and c[j] != b[j]:
			b[j] = a[j]
		elif b[j] == c[j] and c[j] != a[j]:
			a[j] = b[j]
		else:
			()
	if a == b:
		print('YES')
	else:
		print('NO')


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_int = lambda : int(sys.stdin.readline().strip())
pt = lambda x: sys.stdout.write(str(x))
for _ in range(get_int()):
	a = get_string()
	b = get_string()
	c = get_string()
	n = len(a)
	flag = True
	for i in range(n):
		(first, second) = (a[i], b[i])
		if c[i] == first or c[i] == second:
			flag = True
		else:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	flag = True
	for (i, j, k) in zip(a, b, c):
		if i != k and j != k:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	t = 0
	for i in range(len(a)):
		l = [a[i], b[i], c[i]]
		s = {a[i], b[i], c[i]}
		if len(s) == 1:
			t += 1
		if len(l) != len(s) and a[i] != b[i]:
			t += 1
	if t == len(a):
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	a = [input() for i in range(3)]
	print('YES' if all((a[2][i] in (a[0][i], a[1][i]) for i in range(len(a[0])))) else 'NO')


t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	n = len(a)
	a0 = ''
	b0 = ''
	for i in range(n):
		if a[i] == b[i] == c[i]:
			a0 += a[i]
			b0 += b[i]
		elif a[i] == b[i]:
			break
		elif a[i] == c[i]:
			b0 += c[i]
			a0 += a[i]
		elif b[i] == c[i]:
			a0 += c[i]
			b0 += b[i]
		else:
			break
	if a0 == b0:
		if len(a0) == len(b0) == n:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for T in range(t):
	a = input()
	b = input()
	c = input()
	bla = True
	for i in range(len(a)):
		if a[i] != c[i] and b[i] != c[i]:
			bla = False
	if bla:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	n = len(a)
	r = 0
	for i in range(n):
		if c[i] in a[i] + b[i]:
			r += 1
	if r == n:
		print('YES')
	else:
		print('NO')


n = int(input())
flag = 0
for i in range(n):
	a = input()
	b = input()
	c = input()
	buff = ''
	for j in range(len(a)):
		if a[j] == c[j]:
			buff = b[j]
			b = b[:j] + c[j] + b[j + 1:]
			c = c[:j] + buff + c[j + 1:]
		elif b[j] == c[j]:
			buff = a[j]
			a = a[:j] + c[j] + a[j + 1:]
			c = c[:j] + buff + c[j + 1:]
		else:
			print('NO')
			flag = 1
			break
	if flag != 1:
		if a == b:
			print('YES')
		else:
			print('NO')
	flag = 0


for _ in range(int(input())):
	a = str(input())
	b = str(input())
	c = str(input())
	k = len(a)
	t = 0
	count = 0
	for i in range(k):
		if a[i] == b[i] and c[i] == b[i]:
			count += 1
		elif a[i] != b[i]:
			if c[i] == b[i]:
				count += 1
			elif c[i] == a[i]:
				count += 1
			else:
				t = 1
	if t == 0 and count == k:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = list(input())
	b = list(input())
	c = list(input())
	x = 1
	for i in range(len(a)):
		if a[i] != b[i]:
			if a[i] != c[i]:
				temp = a[i]
				a[i] = c[i]
				c[i] = temp
			else:
				temp = b[i]
				b[i] = c[i]
				c[i] = temp
		elif a[i] == b[i] != c[i]:
			x = 0
			break
	if a == b and x:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = list(input())
	b = list(input())
	c = list(input())
	l = 0
	for i in range(len(a)):
		if c[i] == b[i]:
			a[i] = c[i]
		elif c[i] == a[i]:
			b[i] = c[i]
		else:
			b[i] = c[i]
		if a[i] == b[i]:
			l += 1
	if l == len(a):
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	f = 0
	for i in range(len(a)):
		if a[i] == c[i] or c[i] == b[i]:
			continue
		else:
			f = 1
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	a = list(input())
	b = list(input())
	c = list(input())
	s = 0
	for j in range(len(c)):
		if a[j] == c[j] or b[j] == c[j]:
			s += 1
		else:
			break
	if s == len(c):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = str(input())
	b = str(input())
	c = str(input())
	x = k = int(0)
	y = len(a)
	while x < y:
		if a[x] != b[x]:
			if a[x] != c[x] and b[x] != c[x]:
				k = 1
				break
		elif c[x] != a[x]:
			k = 1
			break
		x = x + 1
	if k == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
while t:
	t = t - 1
	a = input()
	b = input()
	c = input()
	l = len(a)
	x = 0
	for i in range(l):
		if c[i] != a[i] and c[i] != b[i]:
			print('NO')
			break
		elif c[i] == a[i] or c[i] == b[i]:
			x = x + 1
	if x == l:
		print('YES')


T = int(input())
for _ in range(0, T):
	a = input()
	b = input()
	c = input()
	list1 = list(a)
	list2 = list(b)
	list3 = list(c)
	for i in range(0, len(list3)):
		if list3[i] == list2[i]:
			temp = list1[i]
			list1[i] = list3[i]
			list3[i] = temp
		else:
			temp = list2[i]
			list2[i] = list3[i]
			list3[i] = temp
	if list1 == list2:
		print('YES')
	else:
		print('NO')


tcases = int(input())
for i in range(tcases):
	a = list(input())
	b = list(input())
	c = list(input())
	slen = len(a)
	flag = True
	for i in range(slen):
		if a[i] == b[i] and b[i] == c[i] or (a[i] != b[i] and a[i] == c[i]) or (a[i] != b[i] and b[i] == c[i]):
			continue
		else:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


import math
testcases = int(input())
while testcases > 0:
	myString1 = input()
	myString2 = input()
	myString3 = input()
	flag = 0
	for i in range(len(myString1)):
		if myString3[i] != myString2[i] and myString3[i] != myString1[i]:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')
	testcases -= 1


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	ans = 'YES'
	num = 0
	n = len(a)
	for i in range(len(a)):
		if a[i] != b[i] and c[i] != a[i] and (c[i] != b[i]):
			ans = 'NO'
			break
		if a[i] == b[i] and a[i] != c[i]:
			ans = 'NO'
			break
	print(ans)


t = int(input())

def checkio(string1, string2, string3):
	flag = True
	for i in range(len(string3)):
		if string2[i] == string1[i] and string3[i] == string1[i]:
			continue
		if string3[i] == string2[i]:
			continue
		elif string3[i] == string1[i]:
			continue
		else:
			flag = False
	if flag == False:
		return 'NO'
	else:
		return 'YES'
for i in range(t):
	string1 = input()
	string2 = input()
	string3 = input()
	print(checkio(string1, string2, string3))


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	flag = True
	for k in range(len(c)):
		if c[k] == a[k] or c[k] == b[k]:
			continue
		else:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')


import sys
T = int(input())
for t in range(T):
	a = input()
	b = input()
	c = input()
	n = len(a)
	r = ''
	trovato = True
	for i in range(n):
		if a[i] == b[i] and a[i] != c[i]:
			print('NO')
			trovato = False
			break
		if c[i] != b[i] and c[i] != a[i]:
			print('NO')
			trovato = False
			break
	if trovato:
		print('YES')


t = int(input())
for _ in range(t):
	(a, b, c) = (input(), input(), input())
	n = len(c)

	def solFinder(a, b, c):
		for i in range(n):
			if a[i] == b[i] and c[i] != a[i]:
				return False
			if c[i] not in (a[i], b[i]):
				return False
		return True
	if solFinder(a, b, c):
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	a = input()
	b = input()
	c = input()
	a1 = list(a)
	b1 = list(b)
	c1 = list(c)
	c = 0
	for i in range(0, len(a1)):
		if c1[i] == b1[i] or c1[i] == a1[i]:
			c = c + 1
	if c == len(a1):
		print('YES')
	else:
		print('NO')
	t = t - 1


for _ in range(int(input())):
	(a, b, c) = (input(), input(), input())
	n = len(a)
	ok = True
	for i in range(n):
		if c[i] not in [a[i], b[i]]:
			ok = False
	print('YES' if ok else 'NO')


for i in range(int(input())):
	a_ = input()
	a = list(a_)
	b_ = input()
	b = list(b_)
	c_ = input()
	c = list(c_)
	a1 = len(a)
	b1 = len(b)
	c1 = len(c)
	if len(a) != len(b) != len(c):
		print('NO')
	else:
		for i in range(a1):
			if c[i] == b[i]:
				(a[i], c[i]) = (c[i], a[i])
			elif c[i] == a[i]:
				(b[i], c[i]) = (c[i], b[i])
			elif c[i] != a[i] and c[i] != b[i]:
				(a[i], c[i]) = (c[i], a[i])
				(b[i], c[i]) = (c[i], b[i])
		if a == b:
			print('YES')
		else:
			print('No')


t = int(input())
for you in range(t):
	a = input()
	b = input()
	c = input()
	poss = 1
	n = len(a)
	for i in range(n):
		if c[i] == b[i] or c[i] == a[i]:
			continue
		poss = 0
		break
	if poss:
		print('YES')
	else:
		print('NO')


num_t = int(input())
for _ in range(num_t):
	a = input()
	b = input()
	c = input()
	failed = False
	for i in range(len(a)):
		if c[i] != a[i] and c[i] != b[i]:
			failed = True
			break
	if failed:
		print('no')
	else:
		print('yes')


def f(a, b, c):
	for i in range(len(a)):
		if a[i] != c[i] and b[i] != c[i]:
			return 'NO'
	return 'YES'
t = int(input())
while t > 0:
	a = input()
	b = input()
	c = input()
	print(f(a, b, c))
	t -= 1


for _ in range(int(input())):
	a_string = input()
	b_string = input()
	c_string = input()
	for i in range(len(a_string)):
		if a_string[i] == c_string[i] or b_string[i] == c_string[i]:
			pass
		else:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
output = [] * t
count = 0
for i in range(t):
	count = 0
	s1 = input()
	s2 = input()
	s3 = input()
	for x in range(len(s1)):
		if s1[x] == s3[x] or s2[x] == s3[x]:
			count += 1
	if count == len(s1):
		output.append('YES')
	else:
		output.append('NO')
for x in output:
	print(x)


for i in range(int(input())):
	a = input()
	b = input()
	c = input()
	t = 0
	for i in range(len(c)):
		if c[i] != a[i] and c[i] != b[i]:
			t = 1
	print('YNEOS'[t::2])


for _ in range(int(input())):
	a = list(input())
	b = list(input())
	c = list(input())
	for i in range(len(c)):
		if c[i] == a[i] and (c[i] != b[i] or c[i] == b[i]):
			(c[i], b[i]) = (b[i], c[i])
		elif c[i] == b[i] and (c[i] != a[i] or c[i] == a[i]):
			(c[i], a[i]) = (a[i], c[i])
		else:
			(c[i], a[i]) = (a[i], c[i])
	d = ''.join(map(str, a))
	e = ''.join(map(str, b))
	if d == e:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = list(input())
	b = list(input())
	c = list(input())
	poss = True
	for i in range(len(a)):
		if c[i] == b[i]:
			continue
		elif c[i] == a[i]:
			continue
		else:
			poss = False
			break
	if poss:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
t = int(stdin.readline().strip())
for _ in range(t):
	a = stdin.readline().strip()
	b = stdin.readline().strip()
	c = stdin.readline().strip()
	flag = True
	for i in range(len(a)):
		if c[i] != a[i] and c[i] != b[i]:
			flag = False
	if flag:
		stdout.write('YES\n')
	else:
		stdout.write('NO\n')


def solve(a, b, c):
	for i in range(len(a)):
		if c[i] not in [a[i], b[i]]:
			return 'NO'
	return 'YES'
t = int(input())
while t > 0:
	t -= 1
	print(solve(input(), input(), input()))


from math import ceil, floor, log, sqrt, factorial
for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	for i in range(len(a)):
		if a[i] == b[i] != c[i]:
			print('No')
			break
		elif a[i] != c[i] and b[i] != c[i]:
			print('No')
			break
	else:
		print('Yes')


import sys
import bisect
import heapq
from math import *
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = pow(10, 9) + 7

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

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

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

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nl():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def solve():
	a = inp()
	b = inp()
	c = inp()
	f = True
	for i in range(0, len(a)):
		if a[i] == b[i] and (c[i] == a[i] or c[i] == b[i]):
			continue
		if a[i] != b[i] and (c[i] == a[i] or c[i] == b[i]):
			continue
		f = False
		break
	if f:
		print('YES')
	else:
		print('NO')
testcase(int(inp()))


from sys import stdin, stdout
rl = lambda : stdin.readline()
rll = lambda : stdin.readline().split()

def main():
	T = int(rl())
	for _ in range(T):
		strs = []
		for __ in range(3):
			strs.append(rll()[0])
		flag = True
		for (a, b, c) in zip(strs[0], strs[1], strs[2]):
			if a == b and c != b:
				stdout.write('NO\n')
				flag = False
				break
			if a != b and (c != a and c != b):
				stdout.write('NO\n')
				flag = False
				break
		if flag:
			stdout.write('YES\n')
	stdout.close()
main()


for _ in range(int(input())):
	(a, b, c) = [input() for _ in range(3)]
	ans = 'YES'
	for (x, y, z) in zip(a, b, c):
		if z == y or z == x:
			continue
		else:
			ans = 'NO'
			break
	print(ans)


test = int(input())

def check(a, b, c):
	for i in range(len(c)):
		if c[i] == a[i] or c[i] == b[i]:
			continue
		else:
			return False
	return True
for _ in range(test):
	a = input()
	b = input()
	c = input()
	if check(a, b, c):
		print('YES')
	else:
		print('NO')


for _ in [0] * int(input()):
	v = list(input())
	x = list(input())
	q = list(input())
	s = ''
	k = True
	for i in range(len(v)):
		if x[i] == q[i]:
			s = v[i]
			v[i] = q[i]
			q[i] = s
			s = ''
		elif v[i] == q[i]:
			s = x[i]
			x[i] = q[i]
			q[i] = s
			s = ''
		elif v[i] == x[i]:
			k = False
	if v == x and k:
		print('YES')
	else:
		print('NO')


def ans(a, b, c):
	l = len(a)
	count = 0
	for i in range(0, l, 1):
		if a[i] == c[i] or b[i] == c[i]:
			count += 1
	if count == l:
		print('YES')
	else:
		print('NO')
t = int(input())
while t > 0:
	a = str(input())
	b = str(input())
	c = str(input())
	ans(a, b, c)
	t -= 1


def tre_str():
	a = input()
	b = input()
	c = input()
	l = len(a)
	m = len(b)
	n = len(c)
	p = l = m = n
	i = 0
	while i < p:
		if a[i] != c[i] and b[i] != c[i]:
			return 'NO'
		i += 1
	return 'YES'
test = int(input())
for i in range(0, test):
	print(tre_str())


t = int(input())
for _ in range(t):
	A = input()
	B = input()
	C = input()
	check = True
	for i in range(len(A)):
		if A[i] == B[i] and A[i] == C[i]:
			continue
		elif A[i] == C[i] or B[i] == C[i]:
			continue
		else:
			check = False
			break
	if check:
		print('YES')
	else:
		print('NO')


def function_1(a, b, c):
	result = 'YES'
	for i in range(len(a)):
		check_set = set([a[i], b[i], c[i]])
		if len(check_set) == 3:
			return 'NO'
		if len(check_set) == 2:
			if a[i] == b[i]:
				return 'NO'
			else:
				continue
		else:
			continue
	return result
n = int(input())
for i in range(n):
	values = list()
	for i in range(3):
		value = list(input())
		values.append(value)
	result = function_1(*values)
	print(result)


a = []
b = []
c = []
t = int(input())
temp = 0
for i in range(t):
	a.append(input())
	b.append(input())
	c.append(input())
for i in range(t):
	for j in range(len(a[i])):
		if a[i][j] == c[i][j]:
			temp += 1
		elif b[i][j] == c[i][j]:
			temp += 1
	if temp == len(a[i]):
		print('YES')
	else:
		print('NO')
	temp = 0


T = int(input())
answer = ''
for t in range(T):
	a = input()
	b = input()
	c = input()
	ok = True
	for i in range(len(c)):
		if c[i] != a[i] and c[i] != b[i]:
			ok = False
			break
	if ok:
		answer += 'YES\n'
	else:
		answer += 'NO\n'
print(answer)


for _ in range(int(input())):
	a = list(input())
	b = list(input())
	c = list(input())
	cc = 1
	for i in range(len(a)):
		if b[i] != c[i] and a[i] != c[i]:
			print('NO')
			cc = 0
			break
	if cc:
		print('YES')


for _ in range(int(input())):
	(a, b, c) = (input(), input(), input())
	d = 'YES'
	for j in range(len(a)):
		if a[j] == b[j] and a[j] != c[j]:
			d = 'NO'
			break
		elif len(set([a[j], b[j], c[j]])) == 3:
			d = 'NO'
	print(d)


t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	for (x, y, z) in zip(a, b, c):
		if z not in (x, y):
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	ans = True
	for (aa, bb, cc) in zip(a, b, c):
		if aa == cc or cc == bb:
			continue
		else:
			ans = False
	if ans:
		print('YES')
	else:
		print('NO')


for q in range(int(input())):
	a = input()
	b = input()
	c = input()
	res = 'YES'
	for (i, j, k) in zip(a, b, c):
		if k != i and k != j:
			res = 'NO'
			break
	print(res)


for _ in range(int(input())):
	s1 = input()
	s2 = input()
	s3 = input()
	n = len(s1)
	flag = 0
	for i in range(n):
		if s1[i] != s3[i] and s2[i] != s3[i]:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


def solve(a, b, c):
	for i in range(len(c)):
		if not (a[i] == c[i] or b[i] == c[i]):
			return False
	return True

def main():
	t = int(input())
	for i in range(t):
		print('YES') if solve(input(), input(), input()) else print('NO')
main()


from itertools import permutations
import math
import sys
import queue
T = int(input())
for TT in range(0, T):
	a = input()
	b = input()
	c = input()
	L = len(a)
	yes = 1
	for i in range(0, L):
		if c[i] != a[i] and c[i] != b[i]:
			yes = 0
	if yes:
		print('YES')
	else:
		print('NO')


try:
	t = int(input())
	for _ in range(t):
		a = list(input())
		b = list(input())
		c = list(input())
		flag = 1

		def swap(a, b):
			return (b, a)
		for i in range(len(c)):
			if c[i] != a[i] and c[i] != b[i]:
				flag = 0
				break
			elif c[i] == a[i]:
				(c[i], b[i]) = swap(c[i], b[i])
			else:
				(c[i], a[i]) = swap(c[i], a[i])
		if flag == 0:
			print('NO')
		elif ''.join(a) == ''.join(b):
			print('YES')
		else:
			print('NO')
except Exception:
	pass


n = int(input())
for g in range(n):
	a = list(map(str, input().strip()))
	b = list(map(str, input().strip()))
	c = list(map(str, input().strip()))
	x = -1
	for y in range(len(a)):
		if b[y] == c[y] or a[y] == c[y]:
			x += 1
	if x == len(a) - 1:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	a = input()
	b = input()
	c = input()
	swapable = True
	for lol in range(0, len(a)):
		if a[lol] != c[lol] and b[lol] != c[lol]:
			swapable = False
			break
	if swapable:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
r = []
for i in range(t):
	a = input()
	b = input()
	c = input()
	k = 0
	for j in range(len(a)):
		if a[j] == b[j]:
			if c[j] != a[j]:
				k = 1
				break
		elif c[j] != a[j] and c[j] != b[j]:
			k = 1
			break
	if k == 0:
		r.append('YES')
	else:
		r.append('NO')
for i in range(len(r)):
	print(r[i])


for x in range(int(input())):
	a = input()
	b = input()
	c = input()
	r = 'YES'
	for i in range(len(c)):
		if c[i] == a[i] or c[i] == b[i]:
			i += 1
		else:
			r = 'NO'
			break
	print(r)


t = int(input())
for case in range(t):
	a = input()
	b = input()
	c = input()
	sol = 'YES'
	for i in range(len(a)):
		if c[i] != a[i] and c[i] != b[i]:
			sol = 'NO'
			break
	print(sol)


def calc_variant():
	a = input()
	b = input()
	c = input()
	res = 'YES'
	for i in range(len(a)):
		if not (a[i] == c[i] or b[i] == c[i]):
			res = 'NO'
	return res
n = int(input())
res = []
for i in range(n):
	res.append(calc_variant())
for c in res:
	print(c)


l = list()
t = int(input())
for i in range(t):
	j = 1
	a = input()
	b = input()
	c = input()
	for i in range(len(a)):
		if a[i] == b[i]:
			if a[i] != c[i]:
				j = 0
		elif a[i] != c[i] and b[i] != c[i]:
			j = 0
	if j == 1:
		l.append('YES')
	if j == 0:
		l.append('NO')
for i in l:
	print(i)


t = int(input())
for _ in range(t):
	a = str(input())
	b = str(input())
	c = str(input())
	n = len(a)
	flag = True
	for i in range(n):
		if c[i] == b[i]:
			continue
		elif c[i] == a[i]:
			continue
		else:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	s1 = input()
	s2 = input()
	s3 = input()
	ans = 'YES'
	for i in range(len(s2)):
		if s3[i] != s2[i] and s3[i] != s1[i]:
			ans = 'NO'
	print(ans)


for i in range(int(input())):
	q = input()
	w = input()
	e = input()
	r = 1
	for i in range(len(q)):
		if e[i] == w[i] or q[i] == e[i]:
			r = 1
		else:
			r = 0
			break
	if r == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	result = 'YES'
	for (idx, ch) in enumerate(c):
		if ch != a[idx] and ch != b[idx]:
			result = 'NO'
			break
	print(result)


for _ in range(int(input())):
	ans = 'YES'
	for (a, b, c) in zip(input(), input(), input()):
		if a != c and b != c:
			ans = 'NO'
			break
	print(ans)


n = int(input())
for i in range(n):
	a = list(input())
	b = list(input())
	c = list(input())
	p = 1
	swap = 0
	for j in range(len(a)):
		if a[j] != b[j] and c[j] == b[j]:
			a[j] = c[j]
			swap += 1
		elif a[j] != b[j] and c[j] == a[j]:
			b[j] = a[j]
			swap += 1
		elif a[j] == b[j] and b[j] == c[j]:
			swap += 1
	if swap == len(a):
		for k in range(len(a)):
			if a[k] != b[k]:
				p = 0
				break
		if p:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def go(a, b, c):
	for i in range(len(c)):
		if c[i] == a[i] or c[i] == b[i]:
			continue
		else:
			return False
	return True
for __ in range(int(input())):
	a = input()
	b = input()
	c = input()
	if go(a, b, c):
		print('YES')
	else:
		print('NO')


from collections import defaultdict, deque
from itertools import permutations
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from copy import deepcopy
from math import ceil
MOD = pow(10, 9) + 7
test = int(input())
for _ in range(test):
	a = input()
	b = input()
	c = input()
	if b == c:
		print('YES')
	else:
		flag = True
		for i in range(len(a)):
			seti = set([])
			seti.add(a[i])
			seti.add(b[i])
			seti.add(c[i])
			if len(seti) == 2:
				if a[i] == b[i]:
					flag = False
					break
			elif len(seti) == 3:
				flag = False
				break
		if flag == False:
			print('NO')
		else:
			print('YES')


for i in range(int(input())):
	a = list(input())
	b = list(input())
	c = list(input())
	y = 0
	for j in range(len(a)):
		x = [a[j], b[j], c[j]]
		if c[j] == b[j] or c[j] == a[j]:
			y = y + 1
	if y == len(a):
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
q = int(input())
for _ in range(q):
	a = input()
	b = input()
	c = input()
	good = True
	for i in range(len(a)):
		if not (a[i] == c[i] or b[i] == c[i]):
			good = False
	if good:
		print('YES')
	else:
		print('NO')


I = input
n = I()
for m in range(int(n)):
	(a, b, c) = (I() for i in range(3))
	print('YES' if all((a[k] == c[k] or b[k] == c[k] for k in range(len(a)))) else 'NO')


def iseql(a1, b1, c1, n):
	for i in range(n):
		if c1[i] == a1[i]:
			(c1[i], b1[i]) = (b1[i], c1[i])
		elif c1[i] == b1[i]:
			(c1[i], a1[i]) = (a1[i], c1[i])
		else:
			return False
	return True
t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	if a == c or b == c:
		print('YES')
	else:
		x = len(c)
		a1 = list(a)
		b1 = list(b)
		c1 = list(c)
		if iseql(a1, b1, c1, x):
			print('YES')
		else:
			print('NO')


def isSwapped(a, b, c):
	n = len(a)
	cnt = n
	for i in range(n):
		if a[i] != c[i] != b[i]:
			cnt -= 1
	if cnt != n:
		return 'NO'
	else:
		return 'YES'
for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	print(isSwapped(a, b, c))


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	aS = []
	bS = []
	for j in range(len(a)):
		if a[j] == c[j]:
			aS.append(1)
		else:
			aS.append(0)
	for j in range(len(b)):
		if b[j] == c[j]:
			bS.append(1)
		else:
			bS.append(0)
	cS = str(list(map(sum, zip(aS, bS))))
	if '0' in cS:
		print('NO')
	else:
		print('YES')


from sys import stdin, stdout
q = int(stdin.readline())
for x in range(q):
	bool1 = True
	a = stdin.readline().rstrip()
	b = stdin.readline().rstrip()
	c = stdin.readline().rstrip()
	for y in range(len(a)):
		if not (a[y] == c[y] or b[y] == c[y]):
			bool1 = False
	if bool1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	a = list(input())
	b = list(input())
	c = list(input())
	flag = 0
	for i in range(len(a)):
		if not (a[i] == b[i] == c[i] or b[i] == c[i] or a[i] == c[i]):
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


T = int(input())
for m in range(T):
	a = input()
	b = input()
	c = input()
	length = len(a)
	flag = True
	for i in range(length):
		if a[i] == b[i]:
			if a[i] != c[i]:
				flag = False
		elif a[i] == c[i] or b[i] == c[i]:
			continue
		else:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c) = [list(input()) for _ in range(3)]
	f = 0
	for i in range(len(a)):
		if c[i] == b[i]:
			a[i] = c[i]
		elif c[i] == a[i]:
			b[i] = c[i]
		else:
			f = 1
			break
	print('NO' if f else 'YES')


t = int(input())
for i in range(t):
	str1 = input()
	str2 = input()
	str3 = input()
	cnt = 0
	for i in range(len(str1)):
		if str1[i] == str3[i] or str2[i] == str3[i]:
			cnt += 1
	if cnt == len(str1):
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
t = int(input())
for test in range(t):
	a = input().strip()
	b = input().strip()
	c = input().strip()
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			continue
		else:
			print('NO')
			break
	else:
		print('YES')


T = int(input())
for i in range(T):
	a = str(input())
	b = str(input())
	c = str(input())
	j = 0
	flag = True
	while j < len(a):
		if a[j] == b[j] and c[j] != a[j]:
			flag = False
			break
		if a[j] != b[j] and c[j] != a[j] and (c[j] != b[j]):
			flag = False
			break
		j += 1
	if flag:
		print('YES')
	else:
		print('NO')


for entry in range(int(input())):
	a = input()
	b = input()
	c = input()
	x = 0
	n = len(a)
	for i in range(n):
		if a[i] == c[i]:
			x = x + 1
		elif b[i] == c[i]:
			x = x + 1
	if x == n:
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	a = input()
	b = input()
	c = input()
	l = len(a)
	isok = True
	for i in range(l):
		if a[i] != c[i] and b[i] != c[i]:
			isok = False
	if isok:
		print('YES')
	else:
		print('NO')


for l in range(int(input(''))):
	a = input('')
	b = input('')
	c = input('')
	ans = True
	for l in range(len(a)):
		if c[l] == a[l] or c[l] == b[l]:
			continue
		else:
			ans = False
	if ans == True:
		print('YES')
	else:
		print('NO')


t = int(input())

def test():
	a = input().strip()
	b = input().strip()
	c = input().strip()
	for (x, y, z) in zip(a, b, c):
		if z != x and z != y:
			print('NO')
			return
	print('YES')
for _ in range(t):
	test()


import math
import sys
import re

def func(a, b, c):
	m = len(a)
	for x in range(m):
		if c[x] != a[x] and c[x] != b[x]:
			return 'NO'
	return 'YES'
n = int(input())
for x in range(n):
	a = input()
	b = input()
	c = input()
	print(func(a, b, c))


def main():
	for _ in range(int(input())):
		a = input()
		b = input()
		c = input()
		ans = 'YES'
		for i in range(len(a)):
			if not (a[i] == c[i] or b[i] == c[i]):
				ans = 'NO'
				break
		print(ans)
main()


import sys
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__
t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	n = len(a)
	for i in range(n):
		if c[i] != a[i] and c[i] != b[i]:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	a = list(input())
	b = list(input())
	c = list(input())
	n = len(a)
	cnt = 0
	for i in range(n):
		if a[i] == c[i]:
			tmp = b[i]
			b[i] = c[i]
			c[i] = tmp
			cnt += 1
		elif b[i] == c[i]:
			tmp = a[i]
			a[i] = c[i]
			c[i] = tmp
			cnt += 1
		elif b[i] == c[i] and a[i] == c[i]:
			cnt += 1
			continue
		else:
			break
	if a == b and cnt == n:
		print('YES')
	else:
		print('NO')


def strings(a, b, c):
	for i in range(len(c)):
		if a[i] != c[i] and b[i] != c[i]:
			return False
	return True
for t in range(int(input())):
	a = input()
	b = input()
	c = input()
	if strings(a, b, c) == True:
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	(a, b, c) = (input(), input(), input())
	for x in zip(a, b, c):
		xl = len(set(x))
		if xl == 3:
			print('NO')
			break
		elif xl == 2:
			if x[0] == x[1]:
				print('NO')
				break
	else:
		print('YES')


for _ in range(int(input())):
	a = str(input())
	b = str(input())
	c = str(input())
	flag = True
	for i in range(len(c)):
		if c[i] == a[i]:
			b = b[:i] + c[i] + b[i + 1:]
		if c[i] == b[i]:
			a = a[:i] + c[i] + a[i + 1:]
		else:
			flag = False
			break
	if flag is True:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	al = list(input())
	bl = list(input())
	cl = list(input())
	for (a, b, c) in zip(al, bl, cl):
		if a != c and b != c:
			print('NO')
			break
	else:
		print('YES')


for i in range(int(input())):
	(a, b, c) = (input(), input(), input())
	ans = 'Yes'
	for j in range(len(c)):
		if c[j] == a[j] or c[j] == b[j]:
			continue
		else:
			ans = 'No'
			break
	print(ans)


def three_strings(a, b, c):
	for i in range(len(a)):
		if a[i] != c[i] and b[i] != c[i]:
			return False
	return True
for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	print('YES' if three_strings(a, b, c) else 'NO')


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	t1 = True
	for i1 in range(len(a)):
		if a[i1] != c[i1] and b[i1] != c[i1]:
			t1 = False
			break
	if t1:
		print('YES')
	else:
		print('NO')


def q_1():
	a = input()
	b = input()
	c = input()
	boool = True
	for i in range(len(a)):
		if a[i] != b[i] and b[i] != c[i] and (a[i] != c[i]) or a[i] == b[i] != c[i]:
			boool = False
			break
	if boool is True:
		print('YES')
	else:
		print('NO')
t = int(input())
for ts in range(t):
	q_1()


T = int(input().strip())
for t in range(T):
	a = str(input().strip())
	b = str(input().strip())
	c = str(input().strip())
	l = len(a)
	status = 'YES'
	for i in range(l):
		if c[i] == a[i] or c[i] == b[i]:
			continue
		else:
			status = 'NO'
			break
	print(status)


t = int(input())
ls = [input() for _ in range(3 * t)]
a = []
b = []
c = []
for i in range(3 * t):
	if i % 3 == 0:
		a.append(ls[i])
	elif i % 3 == 1:
		b.append(ls[i])
	elif i % 3 == 2:
		c.append(ls[i])
for j in range(t):
	for k in range(len(a[j])):
		if c[j][k] != a[j][k] and c[j][k] != b[j][k]:
			print('NO')
			break
		elif k == len(a[j]) - 1:
			print('YES')


def check(a, b, c):
	rank = 0
	expected_rank = len(a)
	for i in range(0, expected_rank):
		if a[i] == c[i] or b[i] == c[i]:
			rank += 1
	if rank == expected_rank:
		print('YES')
	else:
		print('NO')
test_num = int(input())
while test_num > 0:
	a = input()
	b = input()
	c = input()
	check(a, b, c)
	test_num -= 1


t = int(input())
for _ in range(t):
	(a, b, c) = (input(), input(), input())
	res = True
	for i in range(len(a)):
		if a[i] != b[i]:
			res = a[i] == c[i] or b[i] == c[i]
		else:
			res = a[i] == b[i] == c[i]
		if not res:
			break
	res = 'YES' if res else 'NO'
	print(res)


for __ in range(int(input())):
	(a, b, c) = (input(), input(), input())
	ans = True
	for i in range(len(a)):
		if a[i] == b[i]:
			if c[i] == a[i]:
				pass
			else:
				ans = False
		elif c[i] == a[i] or c[i] == b[i]:
			pass
		else:
			ans = False
		if not ans:
			break
	print('YES') if ans else print('NO')


n = int(input())
for test in range(0, n):
	a = input()
	b = input()
	c = input()
	t = True
	for i in range(0, len(a)):
		if c[i] != a[i] and c[i] != b[i]:
			t = False
			break
	if t:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(a, b, c) = [input() for i in range(3)]
	cn = 0
	for i in range(len(a)):
		if not (a[i] != b[i] and (a[i] == c[i] or b[i] == c[i])) and (not a[i] == b[i] == c[i]):
			print('NO')
			cn = 1
			break
	if cn != 1:
		print('YES')


def check(str_a, str_b, str_c, size):
	i = 0
	while i < size:
		if str_c[i] != str_a[i] and str_c[i] != str_b[i]:
			return 0
		i += 1
	return 1
my_list = []
test = int(input())
while test > 0:
	a = input()
	b = input()
	c = input()
	num = len(a)
	value = check(a, b, c, num)
	my_list.append(value)
	test -= 1
for i in my_list:
	if i == 0:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	l = len(a)
	x = []
	y = []
	z = []
	for i in range(l):
		x.append(a[i])
		y.append(b[i])
		z.append(c[i])
	f = 0
	for i in range(l):
		if z[i] == x[i]:
			t = z[i]
			z[i] = y[i]
			y[i] = t
		elif z[i] == y[i]:
			t = z[i]
			z[i] = x[i]
			x[i] = t
		else:
			f = 1
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


def swap(a, b, c):
	for i in range(len(c)):
		if c[i] != a[i] and c[i] != b[i]:
			return 'No'
	return 'Yes'
t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	print(swap(a, b, c))


t = int(input())
for case in range(1, t + 1):
	(a, b, c) = (input(), input(), input())
	assert len(a) == len(b) == len(c)
	possible = all((z == x or z == y for (x, y, z) in zip(a, b, c)))
	output = 'YES' if possible else 'NO'
	print(output)


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

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

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	ans = []
	for _ in range(n):
		a = S()
		b = S()
		c = S()
		k = len(a)
		f = False
		for i in range(k):
			if a[i] == c[i] or b[i] == c[i]:
				pass
			else:
				ans.append('NO')
				f = True
				break
		if not f:
			ans.append('YES')
	for x in ans:
		print(x)
main()


t = int(input())
for test in range(t):
	a = input()
	b = input()
	c = input()
	flag = 1
	for i in range(len(a)):
		if a[i] == b[i]:
			if c[i] != a[i]:
				flag = 0
				break
		elif c[i] == a[i] or c[i] == b[i]:
			continue
		else:
			flag = 0
			break
	if flag:
		print('YES')
	else:
		print('NO')


from sys import stdin

def solve(a, b, c):
	(ans, i, N) = (True, 0, len(a))
	while i < N and ans:
		(ans, i) = (c[i] == a[i] or c[i] == b[i], i + 1)
	return ans

def main():
	t = int(stdin.readline().strip())
	for _ in range(t):
		a = stdin.readline().strip()
		b = stdin.readline().strip()
		c = stdin.readline().strip()
		print('YES' if solve(a, b, c) else 'NO')
main()


for _ in range(int(input())):
	a = str(input())
	b = str(input())
	c = str(input())
	count = 0
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			count += 1
	if count == len(a):
		print('YES')
	else:
		print('NO')


import sys
for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	f = 1
	for i in range(len(a)):
		if b[i] == c[i]:
			continue
		if a[i] in c[i]:
			continue
		f = 0
	if f:
		print('YES')
	else:
		print('NO')


def main():
	t = int(input())
	for __ in range(t):
		a = input()
		b = input()
		c = input()
		n = len(a)
		flag = True
		for i in range(n):
			if a[i] == b[i] and b[i] != c[i]:
				flag = False
				break
			elif a[i] != c[i] and b[i] != c[i]:
				flag = False
				break
		if flag:
			print('YES')
		else:
			print('NO')
main()


def solve():
	(a, b, c) = (list(input()), list(input()), list(input()))
	for i in range(len(a)):
		if c[i] == a[i]:
			(c[i], b[i]) = (b[i], c[i])
		elif c[i] == b[i]:
			(c[i], a[i]) = (a[i], c[i])
		else:
			print('NO')
			return
	if a == b:
		print('YES')
	else:
		print('NO')
t = int(input())
for _ in range(t):
	solve()


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():

	def solve():
		aa = input()
		bb = input()
		cc = input()
		for (a, b, c) in zip(aa, bb, cc):
			if a != c and b != c:
				print('NO')
				return
		print('YES')
	q = int(input())
	for _ in range(q):
		solve()
main()


from math import ceil
n = int(input())
for i in range(n):
	(a, b, c) = [input() for j in range(3)]
	faisable = True
	for (j, k, l) in zip(a, b, c):
		if len(set([j, k, l])) == 3 or (j == k and j != l):
			faisable = False
	print(['NO', 'YES'][faisable])


t = int(input())
for kek in range(t):
	a = input()
	b = input()
	c = input()
	flag = True
	for i in range(len(a)):
		if (a[i] == c[i]) + (b[i] == c[i]) < 1:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


import sys
import bisect
from collections import deque

def no():
	print('NO')

def dist(z, c):
	return (z[0] - c[0]) * (z[0] - c[0]) + (z[1] - c[1]) * (z[1] - c[1])

def vec(z, c):
	return z[0] * c[1] - z[1] * c[0]

def pro(z, c):
	return [z[0] - c[0], z[1] - c[1]]

def main():
	s = sys.stdin.readline()
	t = sys.stdin.readline()
	d = sys.stdin.readline()
	for i in range(len(s)):
		if not (d[i] == t[i] or d[i] == s[i]):
			print('NO')
			return 0
	print('YES')
for i in range(int(sys.stdin.readline())):
	main()


n = int(input())
for i in range(n):
	s = input()
	t = input()
	u = input()
	k = 0
	for j in range(len(s)):
		if u[j] != s[j] and u[j] != t[j]:
			k = 1
			break
	if k == 1:
		print('NO')
	else:
		print('YES')


def ii():
	return int(input())

def si():
	return input()

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

def li():
	return list(mi())
import math
for i in range(ii()):
	a = si()
	b = si()
	c = si()
	l = []
	for i in range(len(a)):
		if a[i] == c[i]:
			l.append(i)
	for i in range(len(a)):
		if b[i] == c[i]:
			l.append(i)
	l = list(set(l))
	s = len(l)
	if s == len(a):
		print('YES')
	else:
		print('NO')


import atexit
import io
import sys
import math
from collections import defaultdict, Counter
t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	for j in range(len(a)):
		if a[j] != b[j]:
			if c[j] != b[j] and c[j] != a[j]:
				print('NO')
				break
		elif c[j] != a[j]:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	(A, B, C, Check) = (input(), input(), input(), True)
	for i in range(len(A)):
		if C[i] in [B[i], A[i]]:
			continue
		else:
			Check = False
			break
	print('YES' if Check else 'NO')


t = int(input())
for i in range(t):
	f1 = 0
	a = input()
	b = input()
	c = input()
	n = int(len(a))
	for j in range(n):
		if a[j] != c[j] and b[j] != c[j]:
			f1 = 1
			print('NO')
			break
		elif a[j] == b[j] and a[j] != c[j] and (b[j] != c[j]):
			print('NO')
			f1 = 1
			break
	if f1 != 1:
		print('YES')


import math

class Read:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(sep=' '):
		return input().split(sep)

	@staticmethod
	def list_int(sep=' '):
		return list(map(int, input().split(sep)))

def solve():
	a = input()
	b = input()
	c = input()
	for i in range(len(c)):
		if c[i] == a[i] or c[i] == b[i]:
			continue
		else:
			print('NO')
			return
	print('YES')
query_count = Read.int()
while query_count:
	query_count -= 1
	solve()


for _ in range(int(input())):
	(a, b, c) = (input(), input(), input())
	for i in range(len(a)):
		if len(set([a[i], b[i], c[i]])) > 2 or (a[i] == b[i] and b[i] != c[i]):
			print('NO')
			break
	else:
		print('YES')


n = int(input())

def fon(a, b, c):
	t = 0
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			t += 1
	return t
for i in range(n):
	for j in range(1):
		a = input()
		b = input()
		c = input()
		if fon(a, b, c) == len(a):
			print('YES')
		else:
			print('NO')


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [Scanner.string() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [Scanner.int() for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def solve():
	A = Scanner.string()
	B = Scanner.string()
	C = Scanner.string()
	for i in range(len(A)):
		if A[i] == C[i] or B[i] == C[i]:
			continue
		else:
			return False
	return True

def main():
	T = Scanner.int()
	for _ in range(T):
		print('YNEOS'[not solve()::2])
main()


N = int(input())
for _ in range(N):
	flag = False
	a = list(input())
	b = list(input())
	c = list(input())
	shin_flag = False
	for i in range(len(a)):
		if a[i] != b[i]:
			if a[i] == c[i] or b[i] == c[i]:
				flag = True
			else:
				shin_flag = True
		elif a[i] == c[i] or b[i] == c[i]:
			flag = True
		else:
			shin_flag = True
	if shin_flag:
		print('NO')
		continue
	if flag:
		print('YES')
	else:
		print('NO')


MOD = 1000000007
MOD2 = 998244353
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
for _ in range(ii()):
	a = si()
	b = si()
	c = si()
	fg = 0
	for i in range(len(a)):
		if a[i] != b[i] and c[i] not in [a[i], b[i]] or a[i] == b[i] != c[i]:
			fg = 1
			break
	if fg:
		print('NO')
	else:
		print('YES')


x = int(input())
for i in range(x):
	strs = []
	result = False
	check = False
	for j in range(3):
		s = input()
		strs.append(s)
	for (index, value) in enumerate(strs[0]):
		if strs[2][index] == strs[1][index] or strs[2][index] == strs[0][index]:
			if index == len(strs[0]) - 1:
				result = True
			pass
		else:
			break
	if result:
		print('YES')
	else:
		print('NO')


m = int(input())
import math
for i in range(m):
	a = input()
	b = input()
	c = input()
	l = len(a)
	flag = 1
	for i in range(l):
		if a[i] != b[i]:
			if a[i] == c[i] or b[i] == c[i]:
				pass
			else:
				flag = 0
		elif a[i] != c[i]:
			flag = 0
	print('YES' if flag else 'NO')


t = int(input())
for i in range(t):
	a = list(input())
	b = list(input())
	c = list(input())
	length = len(a)
	temp = ''
	for j in range(length):
		if c[j] == b[j]:
			temp = c[j]
			c[j] = a[j]
			a[j] = temp
		else:
			temp = c[j]
			c[j] = b[j]
			b[j] = temp
	a = ''.join(a)
	b = ''.join(b)
	if a == b:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	q = 0
	for i in range(len(a)):
		if a[i] != b[i]:
			if a[i] == c[i] or b[i] == c[i]:
				continue
			else:
				print('NO')
				q = 1
				break
		elif a[i] == c[i]:
			continue
		else:
			q = 1
			print('NO')
			break
	if q == 0:
		print('YES')


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

def num():
	return int(input())
from itertools import repeat
t = num()
for _ in repeat(None, t):
	a = input()
	b = input()
	c = input()
	if all((q == e or w == e for (q, w, e) in zip(a, b, c))):
		print('YES')
	else:
		print('NO')


def solve(test):
	ok = True
	a = input()
	b = input()
	c = input()
	n = len(a)
	for i in range(n):
		ok *= b[i] == c[i] or c[i] == a[i]
	print('YES' if ok else 'NO')
t = 1
t = int(input())
for _ in range(t):
	solve(_ + 1)


t = int(input())
for i in range(t):
	s1 = input()
	s2 = input()
	s3 = input()
	n = len(s1)
	flag = 0
	for j in range(n):
		if s1[j] == s2[j]:
			if s1[j] != s3[j]:
				flag = 1
				break
		elif s1[j] != s3[j] and s2[j] != s3[j]:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	ind = 0
	flag = 0
	for i in range(len(a)):
		if b[i] == c[i] or c[i] == a[i] or a[i] == b[i] == c[i]:
			continue
		else:
			flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


import sys

def check(a, b, c):
	n = len(a)
	for i in range(n):
		if a[i] == b[i] and a[i] != c[i]:
			return False
		if a[i] != b[i]:
			if a[i] == c[i]:
				pass
			elif b[i] == c[i]:
				pass
			else:
				return False
	return True
t = int(sys.stdin.readline())
for _ in range(t):
	a = sys.stdin.readline()[:-1]
	b = sys.stdin.readline()[:-1]
	c = sys.stdin.readline()[:-1]
	if check(a, b, c):
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	a = list(input())
	b = list(input())
	c = list(input())
	count = len(c)
	for i in range(len(a)):
		if a[i] == b[i] == c[i]:
			count -= 1
			continue
		if a[i] == b[i]:
			continue
		elif b[i] == c[i]:
			a[i] = b[i]
			count -= 1
		elif a[i] == c[i]:
			b[i] = a[i]
			count -= 1
	if a == b and count == 0:
		print('YES')
	else:
		print('NO')


T = int(input())
a = ''
b = ''
c = ''
for test in range(T):
	check = True
	a = ''
	b = ''
	c = ''
	a = input()
	b = input()
	c = input()
	N = len(a)
	for i in range(N):
		if c[i] is a[i] or c[i] is b[i]:
			pass
		else:
			check = False
	if check == False:
		print('NO')
	else:
		print('YES')


n = int(input())
(A, B, C) = ([], [], [])
for i in range(n):
	A.append(input())
	B.append(input())
	C.append(input())
ans = ['NO'] * n
for i in range(len(A)):
	c = 0
	for j in range(len(A[i])):
		if A[i][j] == C[i][j] or B[i][j] == C[i][j]:
			c += 1
	if c == len(A[i]):
		ans[i] = 'YES'
for a in ans:
	print(a)


t = int(input())
for i in range(t):
	s1 = input()
	s2 = input()
	s3 = input()
	check = 1
	for i in range(len(s1)):
		if s3[i] != s1[i] and s3[i] != s2[i]:
			check = 0
			break
	if check == 0:
		print('NO')
	else:
		print('YES')


def func(a, b, c):
	for i in range(len(a)):
		if c[i] == b[i]:
			pass
		elif c[i] == a[i]:
			pass
		else:
			print('NO')
			return 0
	print('YES')
	return 1
T = int(input())
for i in range(T):
	a = input()
	b = input()
	c = input()
	func(a, b, c)


def check(a, b, c):
	n = len(a)
	value = 'YES'
	for i in range(n):
		if c[i] == a[i] or c[i] == b[i]:
			continue
		else:
			value = 'NO'
			break
	return value
t = int(input().rstrip())
result = list()
for i in range(t):
	a = input().rstrip()
	b = input().rstrip()
	c = input().rstrip()
	result.append(check(a, b, c))
for i in result:
	print(i)


t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	f = False
	for i in range(len(c)):
		if c[i] == b[i]:
			continue
		elif c[i] == a[i]:
			continue
		else:
			f = True
			break
	if f:
		print('NO')
	else:
		print('YES')


r = input
for _ in [0] * int(r()):
	(a, b, c, d) = (r(), r(), r(), 1)
	for (i, x) in enumerate(c):
		d &= not a[i] != x != b[i]
	print('NYOE S'[d::2])


t = int(input())
while t:
	t += -1
	a = input()
	b = input()
	c = input()
	n = len(a)
	ch = 1
	for i in range(n):
		if a[i] == c[i] or b[i] == c[i]:
			continue
		else:
			ch = 0
			break
	if ch == 0:
		print('NO')
	else:
		print('YES')


m = int(input())
for test_no in range(m):
	s1 = input()
	s2 = input()
	s3 = input()
	c = True
	for i in range(len(s1)):
		if not (not (s1[i] != s2[i] and s2[i] != s3[i] and (s3[i] != s1[i])) and (not (s1[i] == s2[i] and s1[i] != s3[i]))):
			c = False
	if c:
		print('YES')
	else:
		print('NO')


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')
testcases = int(input())
for j in range(testcases):
	a = input()
	b = input()
	c = input()
	broke = False
	for s in range(len(a)):
		vala = a[s]
		valb = b[s]
		valc = c[s]
		if vala == valb == valc:
			continue
		elif valc == vala or valc == valb:
			continue
		else:
			broke = True
			break
	if broke == True:
		print('NO')
	else:
		print('YES')


T = int(input())
for _ in range(T):
	A = input()
	B = input()
	C = input()
	N = len(A)
	for i in range(N):
		if not (A[i] == C[i] or B[i] == C[i]):
			print('NO')
			break
	else:
		print('YES')


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		A = input().strip()
		B = input().strip()
		C = input().strip()
		for (a, b, c) in zip(A, B, C):
			if c == a or c == b:
				continue
			else:
				print('NO')
				break
		else:
			print('YES')
main()


from sys import stdin
from bisect import bisect_left as bl
from bisect import bisect_right as br

def input():
	return stdin.readline()[:-1]

def intput():
	return int(input())

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

def intsput():
	return map(int, sinput())

class RangedList:

	def __init__(self, start, stop, val=0):
		self.shift = 0 - start
		self.start = start
		self.stop = stop
		self.list = [val] * (stop - start)

	def __setitem__(self, key, value):
		self.list[key + self.shift] = value

	def __getitem__(self, key):
		return self.list[key + self.shift]

	def __repr__(self):
		return str(self.list)

	def __iter__(self):
		return iter(self.list)
t = intput()
for _ in range(t):
	a = input()
	b = input()
	c = input()
	if all((a[i] == c[i] or b[i] == c[i] for i in range(len(a)))):
		print('YES')
	else:
		print('NO')


t = int(input())
for q in range(t):
	a = input()
	b = input()
	c = input()
	l = len(a)
	count = 0
	for x in range(len(a)):
		if a[x] == c[x] or b[x] == c[x]:
			count += 1
	if count == l:
		print('YES')
	else:
		print('NO')


t = int(input())
output = []
for j in range(t):
	cnt = 0
	a = list(input())
	b = list(input())
	c = list(input())
	n = len(a)
	for i in range(n):
		if a[i] == c[i]:
			tmp = b[i]
			b[i] = c[i]
			c[i] = tmp
			cnt = cnt + 1
		elif b[i] == c[i]:
			tmp = a[i]
			a[i] = c[i]
			c[i] = tmp
			cnt = cnt + 1
	if cnt == n:
		output.append('YES')
	else:
		output.append('NO')
for i in output:
	print(i)


t = int(input())
for _ in range(t):
	a = input().rstrip()
	b = input().rstrip()
	c = input().rstrip()
	for (ah, bh, ch) in zip(a, b, c):
		if ah != ch and bh != ch:
			print('NO')
			break
	else:
		print('YES')


for i in range(int(input())):
	a = str(input())
	b = str(input())
	c = str(input())
	pos = 0
	count = 0
	for i in c:
		if i == a[pos]:
			b = b[:pos] + i + b[pos + 1:]
			count = count + 1
		elif i == b[pos]:
			a = a[:pos] + i + a[pos + 1:]
			count = count + 1
		pos = pos + 1
	if count == len(a):
		print('YES')
	else:
		print('NO')


n = int(input())
answers = []
for i in range(n):
	(a, b, c) = [input() for j in range(3)]
	ans = 'YES'
	for idx in range(len(a)):
		if c[idx] != a[idx] and c[idx] != b[idx]:
			ans = 'NO'
			break
	answers.append(ans)
for a in answers:
	print(a)


import sys
import math

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

def iinput():
	return [int(x) for x in sys.stdin.readline().split()]

def main():
	(a, b, c) = (input(), input(), input())
	n = len(a)
	for j in range(n):
		if c[j] != a[j] and c[j] != b[j]:
			print('NO')
			return
	print('YES')
	return
for i in range(int(input())):
	main()


import sys
sys.setrecursionlimit(10 ** 7)
T = int(input())
CASE = []
for _ in range(T):
	a = input()
	b = input()
	c = input()
	CASE.append([a, b, c])
res = []
for (a, b, c) in CASE:
	l = len(c)
	ans = 'YES'
	for i in range(l):
		if c[i] != a[i] and c[i] != b[i]:
			ans = 'NO'
			break
	res.append(ans)
print('\n'.join(res))


t = int(input())
for i in range(t):
	s1 = input()
	s2 = input()
	s3 = input()
	l = len(s1)
	f = 0
	for j in range(l):
		n = [s1[j], s2[j], s3[j]]
		if n[0] == n[1]:
			if n[0] != n[2]:
				f = 1
				break
			else:
				continue
		elif n.count(s1[j]) != 2 and n.count(s2[j]) != 2:
			f = 1
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	a = str(input())
	b = str(input())
	c = str(input())
	signal = True
	k = len(a)
	for i in range(k):
		if c[i] != a[i] and c[i] != b[i]:
			signal = False
			break
	print('NYOE S'[signal::2])


tt = int(input())
while tt > 0:
	a = input()
	b = input()
	c = input()
	possible = True
	for i in range(len(a)):
		if c[i] == a[i] or c[i] == b[i]:
			possible = True
		else:
			possible = False
			break
	if possible:
		print('YES')
	else:
		print('NO')
	tt -= 1


from math import ceil

def solve():
	a = str(input())
	b = str(input())
	c = str(input())
	for i in range(len(a)):
		if c[i] == a[i] or c[i] == b[i]:
			continue
		else:
			print('NO')
			return
	print('YES')
t = int(input())
for i in range(t):
	solve()


for t in range(int(input())):
	A = input()
	B = input()
	C = input()
	N = len(A)
	ans = 1
	for i in range(N):
		if not (A[i] == C[i] or B[i] == C[i]):
			ans = 0
			break
	print('YES' if ans else 'NO')


n = int(input())
for i in range(n):
	all = [input(), input(), input()]
	was = True
	for g in range(len(all[0])):
		bf = [all[0][g], all[1][g], all[2][g]]
		if bf[0] == bf[1]:
			if bf[0] != bf[2]:
				was = False
		elif not (bf[1] == bf[2] or bf[0] == bf[2]):
			was = False
	print('YES' if was else 'NO')


from math import ceil
from math import sqrt
from math import factorial
from collections import Counter
from operator import itemgetter
i = lambda : input()
ii = lambda : int(input())
iia = lambda : list(map(int, input().split()))
isa = lambda : list(input().split())
t = ii()
for _ in range(t):
	a = input()
	b = input()
	c = input()
	flag = 1
	s = set()
	for i in range(len(a)):
		if a[i] != c[i] and b[i] != c[i]:
			flag = 0
			break
	if flag == 0:
		print('NO')
	else:
		print('YES')


t = int(input())
while t > 0:
	t -= 1
	a = input()
	b = input()
	c = input()
	n = len(a)
	check = False
	for i in range(n):
		if not (a[i] == c[i] or b[i] == c[i]):
			print('NO')
			check = True
			break
	if not check:
		print('YES')


t = int(input())
l1 = []
for i in range(t):
	a = list(input())
	b = list(input())
	c = list(input())
	f = 0
	for j in range(len(a)):
		if a[j] == c[j] or b[j] == c[j]:
			f += 1
		else:
			break
	l1.append('YES') if f == len(a) else l1.append('NO')
for item in l1:
	print(item)


def main():
	string1 = str(input())
	string2 = str(input())
	string3 = str(input())
	string1 = list(string1)
	string2 = list(string2)
	string3 = list(string3)
	for i in range(len(string1)):
		if string1[i] == string3[i] and string2[i] != string3[i]:
			(string2[i], string3[i]) = (string3[i], string2[i])
		elif string2[i] == string3[i] and string1[i] != string3[i]:
			(string1[i], string3[i]) = (string3[i], string1[i])
		elif string1[i] == string2[i] and string2[i] == string3[i]:
			continue
		else:
			(string1[i], string3[i]) = (string3[i], string1[i])
	for i in range(len(string1)):
		if string1[i] != string2[i]:
			print('NO')
			return
	print('YES')
	return

def test():
	t = int(input())
	while t:
		main()
		t -= 1
test()


n = int(input())
while n > 0:
	n -= 1
	a = input()
	b = input()
	c = input()
	i = 0
	while i < len(a):
		if a[i] == c[i] or b[i] == c[i]:
			i += 1
			continue
		print('NO')
		break
	if i == len(a):
		print('YES')


import sys
from pprint import pprint
if not 'DEBUG' in globals():
	readline = sys.stdin.readline

def read(map_func):
	return map_func(readline().rstrip())

def reads(map_func):
	return list(map(map_func, readline().rstrip().split()))

def readn(map_func, n):
	return [map_func(readline().rstrip()) for _ in range(n)]

def readint():
	return read(int)

def readints():
	return reads(int)

def readcol(n):
	return readn(int)

def readmat(n):
	return [readints() for _ in range(n)]

def readmap(n):
	return readn(list)

def makemat(n, m, v):
	return [[v for _ in range(m)] for _ in range(n)]

def zeromat(n, m=None):
	return makemat(n, m if m else n, 0)

def listmat(n, m=None):
	return [[[] for _ in range(m if m else n)] for _ in range(n)]

def crosslist(y, x, n=None, m=None):
	return [(p, q) for (p, q) in [(y, x + 1), (y - 1, x), (y, x - 1), (y + 1, x)] if (n == None or 0 <= p < n) and (m == None or 0 <= q < m)]

def roundlist(y, x, n=None, m=None):
	return [(p, q) for (p, q) in [(y, x + 1), (y - 1, x + 1), (y - 1, x), (y - 1, x - 1), (y, x - 1), (y + 1, x - 1), (y + 1, x), (y + 1, x + 1)] if (n == None or 0 <= p < n) and (m == None or 0 <= q < m)]

def plog(obj):
	pprint(obj) if 'DEBUG' in globals() else None

def log(msg, label=None):
	print((label + ': ' if label else '') + str(msg)) if 'DEBUG' in globals() else None

def _logmat(mat, label=None):
	fmt = '{:' + str(max((max((len(str(s)) for s in m)) for m in mat))) + 'd}'
	f = lambda row: '[' + ' '.join((fmt.format(x) for x in row)) + ']'
	[log('[' + f(row), label) if i == 0 else log((' ' * (len(label) + 3) if label else ' ') + f(row) + ']', None) if i == len(mat) - 1 else log((' ' * (len(label) + 3) if label else ' ') + f(row), None) for (i, row) in enumerate(mat)]

def logmat(mat, label=None):
	_logmat(mat, label) if 'DEBUG' in globals() else None

def check(a, b, c):
	for i in range(len(a)):
		if a[i] != c[i] and b[i] != c[i]:
			return False
	return True
for _ in range(readint()):
	(a, b, c) = readn(str, 3)
	if check(a, b, c):
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(a, b, c) = [input() for j in range(3)]
	ans = 'yes'
	for j in range(len(a)):
		if c[j] != a[j] and c[j] != b[j]:
			ans = 'no'
			break
	print(ans)


t = int(input())
for r in range(t):
	a = list(input())
	b = list(input())
	c = list(input())
	l = len(a)
	matched = True
	for i in range(l):
		if c[i] == b[i] or c[i] == a[i]:
			continue
		else:
			matched = False
			break
	if matched:
		print('YES')
	if not matched:
		print('NO')


def calc(A, B, C):
	for (i, c) in enumerate(C):
		if c != A[i] and c != B[i]:
			return 'NO'
	return 'YES'
N = int(input())
cases = []
for _ in range(N):
	cases.append([input(), input(), input()])
for (a, b, c) in cases:
	print(calc(a, b, c))


def solve():
	a = input()
	b = input()
	c = input()
	n = len(a)
	k = 0
	for i in range(n):
		if a[i] == c[i] or b[i] == c[i]:
			k += 1
	if k == n:
		print('YES')
	else:
		print('NO')
	return
t = int(input())
while t:
	solve()
	t -= 1


q = int(input())
for rwere in range(q):
	a = input()
	b = input()
	c = input()
	n = len(a)
	dasie = True
	for i in range(n):
		if c[i] == a[i] or c[i] == b[i]:
			continue
		else:
			dasie = False
	if dasie:
		print('YES')
	else:
		print('NO')


import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce
sys.setrecursionlimit(4100000)
INF = 1 << 60
MOD = 10 ** 9 + 7
t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	n = len(a)
	yes = True
	for j in range(n):
		if not (c[j] == a[j] or c[j] == b[j]):
			yes = False
			break
	if yes:
		print('YES')
	else:
		print('NO')


from sys import stdin
for _ in range(int(stdin.readline())):
	a = stdin.readline().strip('\n')
	b = stdin.readline().strip('\n')
	c = stdin.readline().strip('\n')
	n = len(a)
	flag = True
	for i in range(n):
		no = len(set([a[i], b[i], c[i]]))
		if no == 3 or (no == 2 and a[i] == b[i]):
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


test = int(input())
while test:
	a = input()
	b = input()
	c = input()
	check = False
	for i in range(len(a)):
		if a[i] != b[i] and (a[i] == c[i] or b[i] == c[i]):
			check = True
		elif a[i] == c[i] and b[i] == c[i]:
			check = True
		else:
			check = False
			break
	if check:
		print('YES')
	else:
		print('NO')
	test -= 1


import math
from collections import defaultdict
ml = lambda : map(int, input().split())
ll = lambda : list(map(int, input().split()))
ii = lambda : int(input())
ip = lambda : list(input())
t = 1
t = ii()
for _ in range(t):
	a = ip()
	b = ip()
	c = ip()
	flag = 0
	for i in range(len(c)):
		if c[i] != a[i] and c[i] != b[i]:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')


x = int(input())
for i in range(0, x):
	changes = 0
	a = list(input())
	b = list(input())
	c = list(input())
	for l in range(0, len(c)):
		if a[l] == c[l]:
			changes += 1
			b[l] = c[l]
		elif b[l] == c[l]:
			changes += 1
			a[l] = c[l]
	if a == b and changes == len(c):
		print('YES')
	else:
		print('NO')


def solve(a, b, c):
	for i in range(len(c)):
		if a[i] == b[i] == c[i]:
			continue
		if len({a[i], b[i], c[i]}) != 2 or a[i] == b[i]:
			return False
	return True
t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	print('YES' if solve(a, b, c) else 'NO')


from sys import stdin, stdout, setrecursionlimit
for _ in range(int(stdin.readline())):
	a = input()
	f = 1
	b = input()
	c = input()
	for (aa, bb, cc) in zip(a, b, c):
		if aa == cc or bb == cc:
			continue
		f = 0
		break
	print('YES' if f else 'NO')


t = int(input().strip())
for _ in range(t):
	a = input().strip()
	b = input().strip()
	c = input().strip()
	ans = True
	for i in range(len(a)):
		if c[i] == a[i] or c[i] == b[i]:
			continue
		else:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	a = input().strip()
	b = input().strip()
	c = input().strip()
	n = len(a)
	f = 0
	i = 0
	while i < n and f != 1:
		l = [a[i], b[i], c[i]]
		if not (l[0] == l[2] or l[1] == l[2]):
			f = 1
		i += 1
	if f == 1:
		print('NO')
	else:
		print('YES')
	t -= 1


for i in range(int(input())):
	a = input()
	b = input()
	c = input()
	n = len(a)
	flag = True
	for x in range(n):
		if not (a[x] == b[x] == c[x] or a[x] == c[x] or b[x] == c[x]):
			flag = False
	if flag == True:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	a = list(input())
	b = list(input())
	c = list(input())
	flag = True
	for i in range(len(a)):
		if a[i] != b[i]:
			if a[i] == c[i] or b[i] == c[i]:
				pass
			else:
				flag = False
				break
		elif a[i] != c[i]:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


def string(a, b, c):
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			pass
		else:
			return 'NO'
	return 'YES'
n = int(input())
for _ in range(n):
	a = input()
	b = input()
	c = input()
	print(string(a, b, c))


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	cc = 0
	for j in range(len(a)):
		if a[j] == b[j] and a[j] == c[j]:
			cc = 1
		elif (a[j] == b[j] or a[j] == c[j] or b[j] == c[j]) and a[j] != b[j]:
			cc = 1
		else:
			cc = 0
			break
	if cc == 0:
		print('NO')
	else:
		print('YES')


from time import sleep as sle
from math import *
from random import randint as ri

def gcd(a, b):
	if a == b:
		return a
	elif a > b:
		return gcd(a - b, b)
	else:
		return gcd(b, a)

def pr(x):
	print()
	for s in x:
		print(s)

def solve():
	n = int(input())
	for _ in range(n):
		a = [q for q in input()]
		b = [q for q in input()]
		c = [q for q in input()]
		bo = [c[i] in [a[i], b[i]] for i in range(len(a))]
		if False in bo:
			print('NO')
		else:
			print('YES')
solve()


t = int(input())
import math
for z in range(t):
	a = input()
	b = input()
	c = input()
	a = list(a)
	b = list(b)
	c = list(c)
	n = len(a)
	s = 'NO'
	for i in range(n):
		if c[i] == b[i]:
			temp = a[i]
			a[i] = c[i]
			c[i] = temp
		elif c[i] == a[i]:
			temp = b[i]
			b[i] = c[i]
			c[i] = temp
		else:
			temp = a[i]
			a[i] = c[i]
			c[i] = temp
	if a == b:
		s = 'YES'
	print(s)


t = int(input())
s = []
for ijjf in range(0, t):
	a = input()
	b = input()
	c = input()
	g = 0
	for i in range(0, len(a)):
		if a[i] == b[i] == c[i]:
			g += 1
		elif c[i] == a[i] and a[i] != b[i]:
			g += 1
		elif c[i] == b[i] and a[i] != b[i]:
			g += 1
	if g == len(a):
		s.append('YES')
	else:
		s.append('NO')
for i in s:
	print(i)


t = int(input())
for x in range(t):
	(a, b, c) = (input(), input(), input())
	t = True
	for x in range(len(a)):
		if a[x] != b[x]:
			if c[x] != a[x] and c[x] != b[x]:
				t = False
		elif c[x] != a[x]:
			t = False
	if t:
		print('YES')
	else:
		print('NO')


import sys
t = int(input())
for _ in range(t):
	ans = True
	a = input()
	b = input()
	c = input()
	for i in range(len(c)):
		if a[i] == b[i] and a[i] != c[i] or (a[i] != b[i] and a[i] != c[i] and (b[i] != c[i])):
			ans = False
	if ans:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(a, b, c) = (input(), input(), input())
	if all((k in i + j for (i, j, k) in zip(a, b, c))):
		print('YES')
	else:
		print('NO')


n = int(input())
ans = []
for i in range(n):
	a = input()
	b = input()
	c = input()
	s = 0
	for j in range(len(c)):
		if c[j] == a[j] or c[j] == b[j]:
			s += 1
	if s == len(c):
		ans.append('YES')
	else:
		ans.append('NO')
print(*ans, sep='\n')


n = int(input())
ans = []
for j in range(n):
	test = []
	a = list(input())
	b = list(input())
	c = list(input())
	length = len(a)
	zipped = list(zip(a, b))
	for x in range(length):
		if c[x] in zipped[x]:
			test.append(x)
	if len(test) == length:
		ans.append('YES')
	else:
		ans.append('NO')
for m in ans:
	print(m)


for i in range(int(input())):
	a = input()
	b = input()
	c = input()
	i = 0
	while i < len(c):
		x = c[i] == a[i]
		y = c[i] == b[i]
		if x == 1 and y == 0 or (y == 1 and x == 0) or (x == 1 and y == 1):
			i += 1
		else:
			break
	print('YES') if i == len(c) else print('NO')


import os
import operator
import sys
from io import BytesIO, IOBase

def inar():
	return [int(k) for k in input().split()]

def main():
	for _ in range(int(input())):
		a = input()
		b = input()
		c = input()
		dic = {}
		counter = 0
		for i in range(len(a)):
			if a[i] == c[i]:
				continue
			if b[i] == c[i]:
				continue
			counter = 1
			break
		if counter:
			print('NO')
		else:
			print('YES')
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()


Q = int(input())
for _ in range(Q):
	a = list(input())
	b = list(input())
	c = list(input())
	f = 0
	for i in range(len(a)):
		if b[i] != c[i] and a[i] != c[i]:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	s = [input() for __ in range(3)]
	if all((s[0][i] == s[2][i] or s[1][i] == s[2][i] for i in range(len(s[0])))):
		print('YES')
	else:
		print('NO')


t = int(input())
for ti in range(t):
	a = input()
	b = input()
	c = input()
	f = 1
	for i in range(len(a)):
		if c[i] in (a[i], b[i]):
			pass
		else:
			print('NO')
			f = 0
			break
	if f:
		print('YES')


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	fl = True
	for j in range(len(c)):
		if c[j] == a[j] or c[j] == b[j]:
			pass
		else:
			fl = False
			print('NO')
			break
	if fl:
		print('YES')


def run():
	n = int(input())
	for _ in range(n):
		a = input()
		b = input()
		c = input()
		l = len(a)
		TRUE = 'YES'
		FALSE = 'NO'
		can_swap = TRUE
		for i in range(l):
			if a[i] == b[i] and c[i] != a[i]:
				can_swap = FALSE
				break
			if a[i] != c[i] and b[i] != c[i] and (a[i] != b[i]):
				can_swap = FALSE
				break
		print(can_swap)
run()


t = int(input())
for _ in range(t):
	a = list(input())
	b = list(input())
	c = list(input())
	n = len(a)
	d = 0
	for i in range(n):
		if b[i] == c[i] or a[i] == c[i]:
			d += 1
	if d == n:
		print('YES')
	else:
		print('NO')


def ans(a, b, c):
	a = list(a)
	b = list(b)
	c = list(c)
	for i in range(len(a)):
		if a[i] == c[i]:
			b[i] = c[i]
		elif b[i] == c[i]:
			a[i] = c[i]
		elif a[i] == b[i]:
			b[i] = c[i]
	return 'YES' if ''.join(a) == ''.join(b) else 'NO'
T = int(input())
for i in range(T):
	a = input()
	b = input()
	c = input()
	print(ans(a, b, c))


from typing import List
import collections
import bisect
import itertools
import functools
from fractions import gcd
import heapq
from math import ceil, sqrt, floor
t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	possible = 'YES'
	for i in range(len(c)):
		if c[i] not in (a[i], b[i]):
			possible = 'NO'
			break
	print(possible)


import sys
from functools import reduce
from collections import Counter
import time
import datetime
from math import sqrt, gcd

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

def sip():
	return sys.stdin.readline()

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

def mips():
	return map(str, sys.stdin.readline().split())

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

def matip(n, m):
	lst = []
	for i in range(n):
		arr = lip()
		lst.append(arr)
	return lst

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

def minJumps(arr, n):
	jumps = [0 for i in range(n)]
	if n == 0 or arr[0] == 0:
		return float('inf')
	jumps[0] = 0
	for i in range(1, n):
		jumps[i] = float('inf')
		for j in range(i):
			if i <= j + arr[j] and jumps[j] != float('inf'):
				jumps[i] = min(jumps[i], jumps[j] + 1)
				break
	return jumps[n - 1]

def dic(arr):
	return Counter(arr)

def check_prime(n):
	if n < 2:
		return False
	for i in range(2, int(n ** 0.5) + 1, 2):
		if n % i == 0:
			return False
	return True
t = ip()
while t:
	t -= 1
	a = sip()
	b = sip()
	c = sip()
	flag = 0
	for i in range(len(a)):
		if a[i] == c[i]:
			swap = 0
		elif b[i] == c[i]:
			swap = 0
		else:
			flag = 1
	if flag == 0:
		print('YES')
	else:
		print('NO')


testCases = int(input())
for test in range(testCases):
	a = input()
	b = input()
	c = input()
	for index in range(len(c)):
		if c[index] != a[index] and c[index] != b[index]:
			print('NO')
			break
		if index == len(c) - 1:
			print('YES')


t = int(input())
for tt in range(t):
	a = input()
	b = input()
	c = input()
	(n, ok) = (len(a), 1)
	for i in range(n):
		if a[i] == c[i] or b[i] == c[i]:
			continue
		else:
			ok = 0
			break
	if ok == 1:
		print('YES')
	else:
		print('NO')


import sys
import math
import bisect

def main():
	for _ in range(int(input())):
		a = input()
		b = input()
		c = input()
		n = len(a)
		ans = True
		for i in range(n):
			if a[i] == c[i] or b[i] == c[i]:
				pass
			else:
				ans = False
				break
		if ans:
			print('YES')
		else:
			print('NO')
main()


numTestcases = int(input())
for i in range(numTestcases):
	a = input().strip()
	b = input().strip()
	c = input().strip()
	works = True
	for i in range(len(a)):
		if c[i] != a[i] and c[i] != b[i]:
			print('NO')
			works = False
			break
	if works:
		print('YES')


import sys
import math
import itertools
import functools
import collections
import operator

def ii():
	return int(input())

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

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

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
t = ii()
for _ in range(t):
	a = list(input())
	b = list(input())
	c = list(input())
	ans = 0
	for i in range(len(a)):
		if c[i] == a[i] or c[i] == b[i]:
			ans += 1
	if ans == len(a):
		print('YES')
	else:
		print('NO')


for i in range(0, int(input())):
	a = input()
	b = input()
	c = input()
	p = 0
	for j in range(0, len(a)):
		if a[j] != b[j] and (a[j] == c[j] or b[j] == c[j]) or (a[j] == b[j] and b[j] == c[j]):
			pass
		else:
			p = 1
			break
	print('YES' if p == 0 else 'NO')


T = int(input())
for t in range(T):
	a = input()
	b = input()
	c = input()
	count = 0
	for i in range(len(a)):
		if a[i] == c[i]:
			count += 1
		elif b[i] == c[i]:
			count += 1
	if count == len(a):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	ans = 'YES'
	a = input().strip()
	b = input().strip()
	c = input().strip()
	for i in range(len(a)):
		if not (c[i] == a[i] or c[i] == b[i]):
			ans = 'NO'
	print(ans)


import math, sys
from collections import Counter, defaultdict, deque
from sys import stdin, stdout
input = stdin.readline
lili = lambda : list(map(int, sys.stdin.readlines()))
li = lambda : list(map(int, input().split()))
I = lambda : int(input())
S = lambda : input().strip()
mod = 1000000007
for i in range(I()):
	a = S()
	b = S()
	c = S()
	f = 0
	for i in range(len(a)):
		if a[i] != c[i] and b[i] != c[i]:
			f = 1
			break
	if f:
		print('NO')
	else:
		print('YES')


import os.path
import sys
from math import *
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def inp():
	return sys.stdin.readline().strip()
for _ in range(int(inp())):
	a = inp()
	b = inp()
	c = inp()
	flg = 1
	for i in range(len(b)):
		if a[i] != b[i]:
			if a[i] != c[i] and b[i] != c[i]:
				flg = 0
		if a[i] == b[i]:
			if a[i] != c[i] and b[i] != c[i]:
				flg = 0
	if flg:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	s1 = input()
	s2 = input()
	s3 = input()
	x = 1
	for j in range(len(s1)):
		if not (s3[j] == s2[j] or s3[j] == s1[j]):
			x = 0
	if x:
		print('YES')
	else:
		print('NO')


def solve(A, B, C):
	for (a, b, c) in zip(A, B, C):
		if a != c and b != c:
			return 'NO'
	return 'YES'
n = int(input())
for _ in range(n):
	A = input()
	B = input()
	C = input()
	print(solve(A, B, C))


def rahul(word):
	return [char for char in word]
n = int(input())
r = 0
m = list()
while r < n:
	a = rahul(input())
	b = rahul(input())
	c = rahul(input())
	s = 0
	while s < len(a):
		if c[s] == b[s] or c[s] == a[s]:
			t = 'YES'
		else:
			t = 'NO'
			break
		s = s + 1
	m.append(t)
	r = r + 1
r = 0
while r < len(m):
	print(m[r])
	r = r + 1


T = int(input())
for i in range(T):
	A = str(input())
	B = str(input())
	C = str(input())
	f = 0
	for s in range(len(C)):
		if C[s] == A[s] or C[s] == B[s]:
			f = 0
		else:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


from math import *
import sys
sys.setrecursionlimit(10 ** 9)
t = int(input())
for y in range(t):
	a = input()
	b = input()
	c = input()
	n = len(a)
	for i in range(n):
		if a[i] == c[i] or b[i] == c[i]:
			continue
		print('NO')
		break
	else:
		print('YES')


from math import ceil
for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	okay = 0
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			okay += 1
	if okay == len(a):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	str1 = input()
	str2 = input()
	str3 = input()
	res = 'YES'
	for i in range(len(str1)):
		if str1[i] != str3[i] and str2[i] != str3[i]:
			res = 'NO'
	print(res)


import math, collections, sys

def case():
	a = input()
	b = input()
	c = input()
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			continue
		else:
			print('NO')
			return
	print('YES')
for _ in range(int(input())):
	case()


import math
import collections
t = int(input())
for _ in range(t):
	s1 = input()
	s2 = input()
	s3 = input()
	flag = 1
	for i in range(len(s1)):
		if s1[i] == s3[i] or s2[i] == s3[i]:
			continue
		else:
			flag = 0
			break
	if flag == 0:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	a = input()
	b = input()
	c = input()
	k = len(a)
	flag = 0
	listy = []
	for j in range(k):
		f = (a[j], b[j], c[j])
		sety = set(f)
		listy.append(len(sety))
	for i in listy:
		if i > 2:
			flag = 1
			break
	if a == b == c:
		flag = 0
	if flag == 0:
		for l in range(k):
			if a[l] == b[l] != c[l]:
				flag = 1
				break
	if flag == 1:
		print('NO')
	else:
		print('YES')


for _ in [0] * int(input()):
	a = list(input())
	b = list(input())
	c = list(input())
	s = ''
	k = True
	for i in range(len(a)):
		if b[i] == c[i]:
			s = a[i]
			a[i] = c[i]
			c[i] = s
			s = ''
		elif a[i] == c[i]:
			s = b[i]
			b[i] = c[i]
			c[i] = s
			s = ''
		elif a[i] == b[i]:
			k = False
	if a == b and k:
		print('YES')
	else:
		print('NO')


def three_strs(l, m, n):
	a = list(l)
	b = list(m)
	c = list(n)
	for i in range(len(c)):
		if c[i] == a[i]:
			k = c[i]
			c[i] = b[i]
			b[i] = k
		elif c[i] == b[i]:
			k = c[i]
			c[i] = a[i]
			a[i] = k
		else:
			k = c[i]
			c[i] = b[i]
			b[i] = k
	if a == b:
		print('YES')
	else:
		print('NO')
t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	three_strs(a, b, c)


n = int(input())
for g in range(n):
	a = list(map(str, input()))
	b = list(map(str, input()))
	c = list(map(str, input()))
	d = 0
	for i in range(len(a)):
		if ord(c[i]) == ord(a[i]) or ord(c[i]) == ord(b[i]):
			pass
		else:
			d = 1
			break
	if d == 1:
		print('NO')
	else:
		print('YES')


mod = 10 ** 9 + 7
import math
from bisect import bisect_left
from collections import Counter
from itertools import combinations

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

def fain():
	return map(float, input().split())

def f(x, y):
	return (x | y) - y
for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	n = len(a)
	poss = True
	for i in range(n):
		if a[i] == b[i]:
			if c[i] != a[i]:
				poss = False
				break
		elif a[i] != c[i] and b[i] != c[i]:
			poss = False
			break
	if poss:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	j = 0
	ans = []
	l = []
	q = []
	a = input()
	b = input()
	c = input()
	for k in range(len(a)):
		l.append(set((a[k], b[k], c[k])))
		q.append((a[k], b[k]))
	for i in range(len(l)):
		if len(l[i]) == 2 and q[i][0] != q[i][1] or len(l[i]) == 1:
			ans.append(1)
	if ans.count(1) == len(l):
		print('YES')
	else:
		print('NO')


test = int(input())
for i in range(0, test):
	a = input()
	b = input()
	c = input()
	k = 0
	for i in range(0, len(c)):
		if not a[i] == b[i]:
			if c[i] == a[i] or c[i] == b[i]:
				k = 0
			else:
				k = 1
				break
		elif not c[i] == a[i]:
			k = 1
			break
	if k == 0:
		print('YES')
	else:
		print('NO')


def swapfn(a, b, c):
	length = len(a)
	if a == c or b == c:
		return 1
	else:
		for i in range(length):
			if a[i] == b[i] == c[i] or (a[i] != b[i] and (a[i] == c[i] or b[i] == c[i])):
				continue
			else:
				return 0
		if i == length - 1:
			return 1
n = int(input())
for i in range(n):
	a = input()
	b = input()
	c = input()
	res = swapfn(a, b, c)
	if res == 1:
		print('YES', end='\n')
	else:
		print('NO', end='\n')


for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	l = len(a)
	ans = 1
	for i in range(l):
		if a[i] != c[i] and b[i] != c[i]:
			ans = 0
			break
	print('yes' if ans == 1 else 'no')


def CanBeUnified(a, b, c):
	for (num, let) in enumerate(c):
		if let not in [a[num], b[num]]:
			return False
	return True
tests = int(input())
for i in range(tests):
	(a, b, c) = (input(), input(), input())
	if CanBeUnified(a, b, c):
		print('YES')
	else:
		print('NO')


for _ in [0] * int(input()):
	a = input()
	b = input()
	c = input()
	u = [c[i] for i in range(len(c)) if b[i] != c[i] and a[i] != c[i]]
	if u != []:
		print('NO')
	else:
		print('YES')


from math import log
for _ in range(int(input())):
	a = input()
	b = input()
	c = input()
	flag = True
	for i in range(len(a)):
		if not (a[i] == c[i] or b[i] == c[i]):
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	A = input()
	B = input()
	C = input()
	N = len(A)
	FLAG = 0
	for i in range(N):
		x = A[i]
		y = B[i]
		z = C[i]
		if y == z or z == x:
			continue
		else:
			FLAG = 1
			break
	if FLAG == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	f1 = True
	for (i, j, k) in zip(a, b, c):
		if k != i and k != j:
			f1 = False
			break
	if f1:
		print('YES')
	else:
		print('NO')


from math import *
from collections import *
from itertools import *
from bisect import *
from heapq import *
from operator import *
from sys import *
setrecursionlimit(1000000)

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

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

def o():
	return int(input())

def r(x):
	return range(len(x))

def kl(con, x=0):
	if x == 0:
		print('Yes') if con else print('No')
	elif x == 1:
		print('yes') if con else print('no')
	elif x == 2:
		print('YES') if con else print('NO')
p = input
for _ in range(o()):
	(s1, s2, s3) = (p(), p(), p())
	for i in r(s1):
		if s3[i] not in [s1[i], s2[i]]:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	(a, b, c) = (input() for i in range(3))
	print('YES' if all((a[i] == c[i] or b[i] == c[i] for i in range(len(a)))) else 'No')


for ttt in range(int(input())):
	a = input()
	b = input()
	c = input()
	n = len(a)
	flag = 1
	for i in range(n):
		if a[i] == b[i] and (a[i] != c[i] or b[i] != c[i]):
			flag = 0
			break
		elif a[i] != b[i] and (not (a[i] == c[i] or b[i] == c[i])):
			flag = 0
			break
	if flag:
		print('yes')
	else:
		print('no')


from __future__ import division, print_function
import os, 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

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

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

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	for _ in range(ii()):
		a = si()
		b = si()
		c = si()
		f = [0] * 26
		ff = 1
		for i in range(len(a)):
			if a[i] == b[i]:
				if a[i] == c[i]:
					continue
				else:
					ff = 0
					break
			if a[i] == c[i]:
				continue
			if b[i] == c[i]:
				continue
			ff = 0
			break
		if ff:
			print('YES')
		else:
			print('NO')
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')
main()


from copy import copy
from math import *

def arr_float_inp():
	return [float(s) for s in input().split()]

def arr_int_inp():
	return [int(s) for s in input().split()]

def int_inp():
	return int(input())

def float_inp():
	return float(input())

def comp(a):
	return a[0]

def gcd(a, b):
	if b != 0:
		return gcd(b, a % b)
	else:
		return a
for _ in range(int_inp()):
	a = input()
	b = input()
	c = input()
	flag = True
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			continue
		else:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


N = int(input())
for _ in range(N):
	a = input()
	b = input()
	c = input()
	for (ai, bi, ci) in zip(a, b, c):
		if not (ai == ci or bi == ci):
			res = False
			break
	else:
		res = True
	if res:
		print('YES')
	else:
		print('NO')


inp = int(input())
ls = []
for i in range(3 * inp):
	s = input()
	ls.append(s)
stt = False
for i in range(inp):
	s = ls[3 * i:3 * i + 3]
	for k in range(len(s[0])):
		if s[0][k] == s[2][k] or s[1][k] == s[2][k]:
			stt = True
		else:
			stt = False
			break
	if stt == True:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = input()
	print('YES' if all(map(lambda x: x[0] in x[1], zip(c, zip(a, b)))) else 'NO')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

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

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def main():
	t = I()
	rr = []
	for _ in range(t):
		a = S()
		b = S()
		c = S()
		l = len(a)
		rr.append(IF(all((c[i] in [a[i], b[i]] for i in range(l))), 'YES', 'NO'))
	return JA(rr, '\n')
print(main())


for _ in range(int(input())):
	can_be_swapped = 'YES'
	a = input()
	b = input()
	c = input()
	for i in range(len(a)):
		if c[i] is not b[i] and c[i] is not a[i]:
			can_be_swapped = 'NO'
			break
	print(can_be_swapped)


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	d = 0
	x = 0
	for i in c:
		if i == a[x]:
			d = 1
		elif i == b[x]:
			d = 1
		else:
			d = 0
			break
		x += 1
	if d == 1:
		print('YES')
	else:
		print('NO')


import math
import sys
import itertools
import fractions
wtf = sys.stdin.read()
wtf = wtf.strip().split('\n')
for t in [wtf[i:i + 3] for i in range(1, len(wtf), 3)]:
	a = [x for x in t[0]]
	b = [x for x in t[1]]
	c = [x for x in t[2]]
	n = len(a)
	for i in range(n):
		if c[i] == b[i]:
			(a[i], c[i]) = (c[i], a[i])
		else:
			(b[i], c[i]) = (c[i], b[i])
	print('YES' if a == b else 'NO')


from sys import stdin
t = int(stdin.readline())
while t:
	A = input()
	B = input()
	C = input()
	(a, b, c) = (list(A), list(B), list(C))
	n = len(a)
	ans = 'YES'
	for i in range(n):
		if a[i] != b[i]:
			if c[i] == b[i]:
				a[i] = b[i]
			elif c[i] == a[i]:
				b[i] = a[i]
			else:
				ans = 'NO'
				break
		elif c[i] != a[i]:
			ans = 'NO'
			break
	print(ans)
	t -= 1


t = int(input())
for s in range(t):
	array1 = input()
	array2 = input()
	array3 = input()
	(a, b, c) = ([], [], [])
	add = 0
	for i in array1:
		a.append(i)
		add += 1
	for i in array2:
		b.append(i)
	for i in array3:
		c.append(i)
	flag = 0
	for i in range(add):
		if a[i] != c[i] and b[i] != c[i]:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	a = input()
	b = input()
	c = input()
	lst1 = list()
	lst2 = list()
	lst3 = list()
	for i in range(len(a)):
		lst1.append(a[i])
		lst2.append(b[i])
		lst3.append(c[i])
	for i in range(len(a)):
		if lst1[i] == lst3[i] and lst2[i] != lst3[i]:
			lst2[i] = lst3[i]
		elif lst2[i] == lst3[i] and lst1[i] != lst3[i]:
			lst1[i] = lst3[i]
		else:
			lst2[i] = lst3[i]
	if lst1 == lst2:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	x = True
	for i in range(len(c)):
		if not (a[i] == c[i] or b[i] == c[i]):
			print('NO')
			x = False
			break
	if x:
		print('YES')


for _ in range(int(input())):
	(a, b, c) = (input(), input(), input())
	for (ch_a, ch_b, ch_c) in zip(a, b, c):
		if ch_c != ch_a and ch_c != ch_b:
			print('NO')
			break
	else:
		print('YES')


def func(a, b, c):
	for i in range(len(a)):
		if not (a[i] == c[i] or b[i] == c[i]):
			return 'NO'
	else:
		return 'YES'
t = int(input())
l = []
for j in range(t):
	a = input()
	b = input()
	c = input()
	l.append(func(a, b, c))
for j in range(t):
	print(l[j])


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)

def in_int():
	return int(input())

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

def in_str():
	s = input()
	return list(s[:len(s) - 1])

def in_ints():
	return map(int, input().split())
n = in_int()
while n > 0:
	n -= 1
	ans = True
	a = in_str()
	b = in_str()
	c = in_str()
	for i in range(len(a)):
		if a[i] == c[i] or b[i] == c[i]:
			continue
		ans = False
		break
	if ans:
		print('YES')
	else:
		print('NO')


def main():
	T = int(input())
	for t in range(T):
		a = input()
		b = input()
		c = input()
		n = len(a)
		poss = True
		for i in range(n):
			if a[i] == c[i] or b[i] == c[i]:
				pass
			else:
				poss = False
		print('YES' if poss else 'NO')
main()


n = int(input())
for _ in range(n):
	res1 = list(input())
	res2 = list(input())
	res3 = list(input())
	flag = False
	for i in range(len(res1)):
		if res1[i] == res3[i] or res2[i] == res3[i]:
			flag = False
		elif res1[i] == res2[i] and res1[i] == res3[i]:
			flag = False
		else:
			flag = True
			break
	if flag:
		print('NO')
	else:
		print('YES')


for t in range(int(input())):
	(a, b, c) = (input(), input(), input())
	anser = 'YES'
	for i in range(len(a)):
		if not (c[i] == a[i] or c[i] == b[i]):
			anser = 'NO'
			break
	print(anser)


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = input()
	fl = 0
	for j in range(len(a)):
		if a[j] == b[j]:
			if c[j] == a[j]:
				pass
			else:
				fl = 1
				break
		elif a[j] == c[j] or b[j] == c[j]:
			pass
		else:
			fl = 1
			break
	if fl == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	a = list(str(input()))
	b = list(str(input()))
	c = list(str(input()))
	for j in range(len(a)):
		if a[j] != b[j]:
			if c[j] == a[j] or c[j] == b[j]:
				continue
			else:
				print('NO')
				break
		elif c[j] != a[j]:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for _ in range(t):
	x = input()
	y = input()
	z = input()
	n = len(x)
	f = 0
	for i in range(n):
		if x[i] != z[i] and y[i] != z[i]:
			print('NO')
			f = 1
			break
	if f == 0:
		print('YES')


for _ in range(int(input())):
	s1 = input()
	s2 = input()
	s3 = input()
	for i in range(len(s1)):
		if s3[i] != s1[i] and s3[i] != s2[i]:
			print('NO')
			break
	else:
		print('YES')


tcases = int(input())
result = list()
for i in range(tcases):
	a = input()
	b = input()
	c = input()
	size = len(a)
	flag = 0
	t = 0
	for j in range(size):
		if b[j] == c[j] or a[j] == c[j]:
			t += 1
	if t == size:
		result.append('YES')
	else:
		result.append('NO')
for i in result:
	print(i)