------Read problems statements in Hindi,
Mandarin chinese
, Russian and Vietnamese as well. ------ 

Chef likes to play with cards a lot. Today, he's playing a game with three cards. Each card has a letter written on the top face and another (possibly identical) letter written on the bottom face. Chef can arbitrarily reorder the cards and/or flip any of the cards in any way he wishes (in particular, he can leave the cards as they were). He wants to do it in such a way that the letters on the top faces of the cards, read left to right, would spell out the name of his favorite friend Bob.

Determine whether it is possible for Chef to spell "bob" with these cards.

------  Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first line of each test case contains a single string with length $3$ denoting the characters written on the top faces of the first, second and third card.
The second line contains a single string with length $3$ denoting the characters written on the bottom faces of the first, second and third card.

------  Output ------
For each test case, print a single line containing the string "yes" (without quotes) if Chef can spell "bob" or "no" (without quotes) if he cannot.

------  Constraints ------
$1 ≤ T ≤ 20,000$
each string contains only lowercase English letters

------  Subtasks ------
Subtask #1 (100 points): original constraints

----- Sample Input 1 ------ 
3

bob

rob

dbc

ocb

boc

obc
----- Sample Output 1 ------ 
yes

yes

no
----- explanation 1 ------ 
Example case 1: The top faces of the cards already spell out "bob".

Example case 2: Chef can rearrange the cards in the following way to spell "bob": the second card non-flipped, the first card flipped and the third card flipped.

Example case 3: There is no way for Chef to spell out "bob".

Difficulty: EASY
Tags: Complete search
Skill types: Complete search

Starter code:

Solutions:
for i in range(int(input())):
	a = input()
	b = input()
	if (a[0] == 'b' or b[0] == 'b') and (a[1] == 'o' or b[1] == 'o') and (a[2] == 'b' or b[2] == 'b'):
		print('yes')
	elif (a[0] == 'o' or b[0] == 'o') and (a[1] == 'b' or b[1] == 'b') and (a[2] == 'b' or b[2] == 'b'):
		print('yes')
	elif (a[0] == 'b' or b[0] == 'b') and (a[1] == 'b' or b[1] == 'b') and (a[2] == 'o' or b[2] == 'o'):
		print('yes')
	else:
		print('no')


t = int(input())
for _ in range(0, t):
	a = input()
	c = input()
	if (a[0] == 'b' or c[0] == 'b') and (a[1] == 'o' or c[1] == 'o') and (a[2] == 'b' or c[2] == 'b'):
		print('yes')
	elif (a[0] == 'o' or c[0] == 'o') and (a[1] == 'b' or c[1] == 'b') and (a[2] == 'b' or c[2] == 'b'):
		print('yes')
	elif (a[0] == 'b' or c[0] == 'b') and (a[1] == 'b' or c[1] == 'b') and (a[2] == 'o' or c[2] == 'o'):
		print('yes')
	else:
		print('no')


t = int(input())
for i in range(t):
	x = list(input())
	y = list(input())
	if (x[0] == 'b' or y[0] == 'b') and (x[1] == 'o' or y[1] == 'o') and (x[2] == 'b' or y[2] == 'b'):
		print('yes')
	elif (x[0] == 'o' or y[0] == 'o') and (x[1] == 'b' or y[1] == 'b') and (x[2] == 'b' or y[2] == 'b'):
		print('yes')
	elif (x[0] == 'b' or y[0] == 'b') and (x[1] == 'b' or y[1] == 'b') and (x[2] == 'o' or y[2] == 'o'):
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	s1 = input()
	s2 = input()
	ans = 'yes'
	char_set = {'b', 'o'}
	d = {'b': 0, 'o': 0, 'w': 0}
	for i in range(3):
		if {s1[i], s2[i]} == char_set:
			d['w'] += 1
		elif 'o' in {s1[i], s2[i]}:
			d['o'] += 1
		elif 'b' in {s1[i], s2[i]}:
			d['b'] += 1
	c = 2
	ans = 'yes'
	for i in ['b', 'o']:
		if d[i] < c:
			d['w'] -= c - d[i]
			if d['w'] < 0:
				ans = 'no'
				break
		c -= 1
	print(ans)


t = int(input())
for i in range(t):
	s1 = input()
	s2 = input()
	if (s1[0] == 'b' or s2[0] == 'b') and (s1[1] == 'o' or s2[1] == 'o') and (s1[2] == 'b' or s2[2] == 'b'):
		print('yes')
	elif (s1[0] == 'o' or s2[0] == 'o') and (s1[1] == 'b' or s2[1] == 'b') and (s1[2] == 'b' or s2[2] == 'b'):
		print('yes')
	elif (s1[0] == 'b' or s2[0] == 'b') and (s1[1] == 'b' or s2[1] == 'b') and (s1[2] == 'o' or s2[2] == 'o'):
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	s1 = input()
	s2 = input()
	a = s1[0] + s2[0]
	b = s1[1] + s2[1]
	c = s1[2] + s2[2]
	a1 = a.count('o')
	a2 = a.count('b')
	a3 = b.count('o')
	a4 = b.count('b')
	a5 = c.count('o')
	a6 = c.count('b')
	if (('b' in a or 'o' in a) and ('b' in b or 'o' in b) and ('b' in c or 'o' in c)) and (a2 > 0 and a4 > 0 and (a5 > 0) or (a4 > 0 and a6 > 0 and (a1 > 0)) or (a2 > 0 and a6 > 0 and (a3 > 0))):
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	l1 = input()
	l2 = input()
	if (l1[0] == 'b' or l2[0] == 'b') and (l1[1] == 'o' or l2[1] == 'o') and (l1[2] == 'b' or l2[2] == 'b'):
		print('yes')
	elif (l1[0] == 'o' or l2[0] == 'o') and (l1[1] == 'b' or l2[1] == 'b') and (l1[2] == 'b' or l2[2] == 'b'):
		print('yes')
	elif (l1[0] == 'b' or l2[0] == 'b') and (l1[1] == 'b' or l2[1] == 'b') and (l1[2] == 'o' or l2[2] == 'o'):
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	s1 = input()
	s2 = input()
	(x, yy, z) = (0, 0, 0)
	if s1[0] == 'b' or s2[0] == 'b':
		x += 1
	if s1[1] == 'o' or s2[1] == 'o':
		x += 1
	if s1[2] == 'b' or s2[2] == 'b':
		x += 1
	if s1[0] == 'o' or s2[0] == 'o':
		yy += 1
	if s1[1] == 'b' or s2[1] == 'b':
		yy += 1
	if s1[2] == 'b' or s2[2] == 'b':
		yy += 1
	if s1[0] == 'b' or s2[0] == 'b':
		z += 1
	if s1[1] == 'b' or s2[1] == 'b':
		z += 1
	if s1[2] == 'o' or s2[2] == 'o':
		z += 1
	if x == 3 or yy == 3 or z == 3:
		print('yes')
	else:
		print('no')


k = int(input(''))
while k != 0:
	top = list(input(''))
	bottom = list(input(''))
	f = [top, bottom]
	x_or = 0
	o_or = 0
	b_or = 0
	for i in range(3):
		if (f[0][i] == 'b' or f[0][i] == 'o') and (f[1][i] == 'b' or f[1][i] == 'o') and (f[1][i] != f[0][i]):
			x_or += 1
		elif f[0][i] == 'b' or f[1][i] == 'b':
			b_or += 1
		elif f[0][i] == 'o' or f[1][i] == 'o':
			o_or += 1
	if b_or == 2 and o_or == 1:
		print('yes')
	elif b_or == 1 and o_or == 1 and (x_or == 1):
		print('yes')
	elif b_or == 0 and o_or == 1 and (x_or == 2):
		print('yes')
	elif b_or == 2 and o_or == 0 and (x_or == 1):
		print('yes')
	elif b_or == 1 and o_or == 0 and (x_or == 2):
		print('yes')
	elif b_or == 0 and o_or == 0 and (x_or == 3):
		print('yes')
	else:
		print('no')
	k -= 1


def solve():
	s1 = input()
	s2 = input()
	if s1[0] == 'o' or s2[0] == 'o':
		if (s1[1] == 'b' or s2[1] == 'b') and (s1[2] == 'b' or s2[2] == 'b'):
			return 'yes'
	if s1[1] == 'o' or s2[1] == 'o':
		if (s1[0] == 'b' or s2[0] == 'b') and (s1[2] == 'b' or s2[2] == 'b'):
			return 'yes'
	if s1[2] == 'o' or s2[2] == 'o':
		if (s1[0] == 'b' or s2[0] == 'b') and (s1[1] == 'b' or s2[1] == 'b'):
			return 'yes'
	return 'no'
t = int(input())
for _ in range(t):
	temp = solve()
	print(temp)


for i in range(int(input())):
	s1 = input()
	s2 = input()
	(x, y, z) = (0, 0, 0)
	if s1[0] == 'b' or s2[0] == 'b':
		x += 1
	if s1[1] == 'o' or s2[1] == 'o':
		x += 1
	if s1[2] == 'b' or s2[2] == 'b':
		x += 1
	if s1[0] == 'b' or s2[0] == 'b':
		y += 1
	if s1[1] == 'b' or s2[1] == 'b':
		y += 1
	if s1[2] == 'o' or s2[2] == 'o':
		y += 1
	if s1[0] == 'o' or s2[0] == 'o':
		z += 1
	if s1[1] == 'b' or s2[1] == 'b':
		z += 1
	if s1[2] == 'b' or s2[2] == 'b':
		z += 1
	if x == 3 or y == 3 or z == 3:
		print('yes')
	else:
		print('no')


a = int(input())
for i in range(a):
	b = input()
	c = input()
	if b == 'bob' or c == 'bob':
		print('yes')
	else:
		b = list(b)
		c = list(c)
		c1 = 0
		c2 = 0
		c3 = 0
		if b[0] == 'b' or c[0] == 'b':
			c1 += 1
		if b[1] == 'o' or c[1] == 'o':
			c1 += 1
		if b[2] == 'b' or c[2] == 'b':
			c1 += 1
		if b[0] == 'b' or c[0] == 'b':
			c2 += 1
		if b[1] == 'b' or c[1] == 'b':
			c2 += 1
		if b[2] == 'o' or c[2] == 'o':
			c2 += 1
		if b[0] == 'o' or c[0] == 'o':
			c3 += 1
		if b[1] == 'b' or c[1] == 'b':
			c3 += 1
		if b[2] == 'b' or c[2] == 'b':
			c3 += 1
		if c1 == 3 or c2 == 3 or c3 == 3:
			print('yes')
		else:
			print('no')


t = int(input())
for _ in range(t):
	top = input()
	bot = input()
	if top == 'bob' or bot == 'bob':
		print('yes')
	else:
		top = list(top)
		bot = list(bot)
		c1 = 0
		c2 = 0
		c3 = 0
		if top[0] == 'b' or bot[0] == 'b':
			c1 += 1
		if top[1] == 'o' or bot[1] == 'o':
			c1 += 1
		if top[2] == 'b' or bot[2] == 'b':
			c1 += 1
		if top[0] == 'b' or bot[0] == 'b':
			c2 += 1
		if top[1] == 'b' or bot[1] == 'b':
			c2 += 1
		if top[2] == 'o' or bot[2] == 'o':
			c2 += 1
		if top[0] == 'o' or bot[0] == 'o':
			c3 += 1
		if top[1] == 'b' or bot[1] == 'b':
			c3 += 1
		if top[2] == 'b' or bot[2] == 'b':
			c3 += 1
		if c1 == 3 or c2 == 3 or c3 == 3:
			print('yes')
		else:
			print('no')


t = int(input())
for i in range(t):
	s = input()
	t = input()
	cntb = 0
	cnto = 0
	flag = [0, 0, 0]
	for j in range(3):
		if s[j] == 'b' or t[j] == 'b':
			cntb += 1
			flag[j] = 1
	abo = 0
	if cntb <= 1:
		print('no')
	elif cntb == 2:
		for j in range(3):
			if flag[j] == 0:
				if s[j] == 'o' or t[j] == 'o':
					print('yes')
				else:
					print('no')
				break
	else:
		for j in range(3):
			if s[j] == 'o' or t[j] == 'o':
				abo = 1
		if abo == 1:
			print('yes')
		else:
			print('no')


def ob_str(c1, c2):
	code = '_box'
	res = 0
	if c1 == 'b' or c2 == 'b':
		res += 1
	if c1 == 'o' or c2 == 'o':
		res += 2
	return code[res]
for _ in range(int(input())):
	top = input()
	bot = input()
	pool = ''
	for i in range(3):
		pool += ob_str(top[i], bot[i])
	missing = max(0, 2 - pool.count('b'))
	missing += max(0, 1 - pool.count('o'))
	if pool.count('x') - missing < 0:
		print('no')
	else:
		print('yes')


T = int(input())
for _ in range(T):
	TOP = input()
	BOT = input()
	if (TOP[0] == 'o' or BOT[0] == 'o') and (TOP[1] == 'b' or BOT[1] == 'b') and (TOP[2] == 'b' or BOT[2] == 'b'):
		print('yes')
	elif (TOP[1] == 'o' or BOT[1] == 'o') and (TOP[2] == 'b' or BOT[2] == 'b') and (TOP[0] == 'b' or BOT[0] == 'b'):
		print('yes')
	elif (TOP[2] == 'o' or BOT[2] == 'o') and (TOP[1] == 'b' or BOT[1] == 'b') and (TOP[0] == 'b' or BOT[0] == 'b'):
		print('yes')
	else:
		print('no')


t = int(input())
for i in range(t):
	top_cards = str(input())
	bottom_cards = str(input())
	if (top_cards[0] == 'b' or bottom_cards[0] == 'b') and (top_cards[1] == 'o' or bottom_cards[1] == 'o') and (top_cards[2] == 'b' or bottom_cards[2] == 'b'):
		print('yes')
	elif (top_cards[0] == 'b' or bottom_cards[0] == 'b') and (top_cards[1] == 'b' or bottom_cards[1] == 'b') and (top_cards[2] == 'o' or bottom_cards[2] == 'o'):
		print('yes')
	elif (top_cards[0] == 'o' or bottom_cards[0] == 'o') and (top_cards[1] == 'b' or bottom_cards[1] == 'b') and (top_cards[2] == 'b' or bottom_cards[2] == 'b'):
		print('yes')
	else:
		print('no')


t = int(input())
for i in range(t):
	s1 = input()
	s2 = input()
	inds = set()
	ls = []
	for i in range(3):
		if s1[i] == 'b' or s2[i] == 'b':
			inds.add(i)
			ls.append('b')
		if s1[i] == 'o' or s2[i] == 'o':
			inds.add(i)
			ls.append('o')
	if len(inds) == 3 and ls.count('b') >= 2 and (ls.count('o') >= 1):
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	tf = input()
	bf = input()
	flag = False
	for i in range(len(tf)):
		if tf[i] == 'o' or bf[i] == 'o':
			count = 0
			for j in range(len(bf)):
				if i != j:
					if tf[j] == 'b' or bf[j] == 'b':
						count += 1
			if count == 2:
				flag = True
				break
	if flag:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(top, bot) = (input(), input())
	flag = False
	for i in range(3):
		if top[i] == 'o' or bot[i] == 'o':
			b_count = 0
			for j in range(3):
				if i != j and (top[j] == 'b' or bot[j] == 'b'):
					b_count += 1
			if b_count == 2:
				flag = True
	if flag:
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	s1 = input()
	s2 = input()
	temp = False
	for i in range(len(s1)):
		if s1[i] == 'o' or s2[i] == 'o':
			count = 0
			for j in range(len(s1)):
				if i != j:
					if s1[j] == 'b' or s2[j] == 'b':
						count += 1
			if count == 2:
				temp = True
	if temp:
		print('yes')
	else:
		print('no')


t = int(input())
for _ in range(t):
	front = input()
	back = input()
	if (front[0] == 'o' or back[0] == 'o') and (front[1] == 'b' or back[1] == 'b') and (front[2] == 'b' or back[2] == 'b'):
		print('yes')
	elif (front[1] == 'o' or back[1] == 'o') and (front[2] == 'b' or back[2] == 'b') and (front[0] == 'b' or back[0] == 'b'):
		print('yes')
	elif (front[2] == 'o' or back[2] == 'o') and (front[1] == 'b' or back[1] == 'b') and (front[0] == 'b' or back[0] == 'b'):
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	j = list(input())
	k = list(input())
	ls = []
	ans = 'no'
	for i in range(3):
		if i == 0:
			ls.append(j[0])
			ls.append(k[0])
		elif i == 1:
			d = []
			for l in range(len(ls)):
				d.append(ls[l] + j[i])
				d.append(ls[l] + k[i])
			ls = d
		else:
			d = []
			for l in range(len(ls)):
				if ls[l] + k[i] == 'obb' or ls[l] + k[i] == 'bob' or ls[l] + k[i] == 'bbo':
					ans = 'yes'
				if ls[l] + j[i] == 'obb' or ls[l] + j[i] == 'bob' or ls[l] + j[i] == 'bbo':
					ans = 'yes'
	print(ans)


for T in range(int(input())):
	top = input()
	bottom = input()
	b = 0
	o = 0
	c = 0
	for i in range(3):
		if top[i] == 'b' and bottom[i] == 'o':
			c += 1
			continue
		elif top[i] == 'o' and bottom[i] == 'b':
			c += 1
			continue
		if top[i] == 'b' or bottom[i] == 'b':
			b += 1
		elif top[i] == 'o' or bottom[i] == 'o':
			o += 1
	if b == 2 and o == 1:
		print('yes')
	elif b == 2 and o == 0 and (c == 1):
		print('yes')
	elif b == 1 and o == 1 and (c == 1):
		print('yes')
	elif b == 0 and o == 1 and (c == 2):
		print('yes')
	elif b == 1 and o == 0 and (c == 2):
		print('yes')
	elif b == 0 and o == 0 and (c == 3):
		print('yes')
	else:
		print('no')


def fun():
	s1 = input()
	s2 = input()
	for i in (s1[0], s2[0]):
		for j in (s1[1], s2[1]):
			for k in (s1[2], s2[2]):
				if i + j + k in {'bob', 'obb', 'bbo'}:
					return 'yes'
	return 'no'
T = int(input())
for i in range(T):
	print(fun())


for _ in range(int(input())):
	topface = input().strip()
	botface = input().strip()
	b = [0] * 3
	o = [0] * 3
	for i in range(3):
		if topface[i] is 'b' or botface[i] is 'b':
			b[i] = 1
		if botface[i] is 'o' or topface[i] is 'o':
			o[i] = 1
	cb = b.count(1)
	if cb < 2:
		print('no')
	elif cb == 2:
		i = b.index(0)
		if o[i] == 1:
			print('yes')
		else:
			print('no')
	elif 1 in o:
		print('yes')
	else:
		print('no')


for T in range(int(input())):
	top = input()
	bottom = input()
	b = [0, 0, 0]
	o = [0, 0, 0]
	for i in range(3):
		if 'b' in (top[i], bottom[i]):
			b[i] = 1
		if 'o' in (top[i], bottom[i]):
			o[i] = 1
	bs = sum(b)
	if bs < 2:
		print('no')
	elif bs == 2:
		ind = b.index(0)
		if o[ind] == 1:
			print('yes')
		else:
			print('no')
	elif 1 in o:
		print('yes')
	else:
		print('no')


T = int(input())
for k in range(T):
	s = input()
	t = input()
	ok = False
	for i in range(3):
		if s[i] == 'o' or t[i] == 'o':
			cnt = 0
			for j in range(3):
				if j != i:
					if s[j] == 'b' or t[j] == 'b':
						cnt += 1
			if cnt == 2:
				ok = True
	print('yes' if ok else 'no')


t = input()
for c in range(0, int(t)):
	a = input()
	b = input()
	e = 0
	s1 = [a[0], b[0]]
	s2 = [a[1], b[1]]
	s3 = [a[2], b[2]]
	if 'o' in s1 and 'b' in s2 and ('b' in s3):
		e = 9
	elif 'o' in s2 and 'b' in s1 and ('b' in s3):
		e = 9
	elif 'o' in s3 and 'b' in s2 and ('b' in s1):
		e = 9
	if e == 9:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	s1 = input()
	s2 = input()
	if (s1[0] == 'b' or s2[0] == 'b') and (s1[1] == 'b' or s2[1] == 'b') and (s1[2] == 'o' or s2[2] == 'o') or ((s1[0] == 'b' or s2[0] == 'b') and (s1[1] == 'o' or s2[1] == 'o') and (s1[2] == 'b' or s2[2] == 'b')) or ((s1[0] == 'o' or s2[0] == 'o') and (s1[1] == 'b' or s2[1] == 'b') and (s1[2] == 'b' or s2[2] == 'b')):
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	upper = input().strip()
	lower = input().strip()
	for ind in [[0, 1, 2], [1, 2, 0], [2, 1, 0]]:
		(i, j, k) = ind
		if (upper[i] == 'o' or lower[i] == 'o') and (upper[j] == 'b' or lower[j] == 'b') and (upper[k] == 'b' or lower[k] == 'b'):
			print('yes')
			break
	else:
		print('no')


for _ in range(int(input())):
	S1 = str(input())
	S2 = str(input())
	if (S1[0] == 'b' or S2[0] == 'b') and (S1[1] == 'o' or S2[1] == 'o') and (S1[2] == 'b' or S2[2] == 'b') or ((S1[0] == 'b' or S2[0] == 'b') and (S1[1] == 'b' or S2[1] == 'b') and (S1[2] == 'o' or S2[2] == 'o')) or ((S1[0] == 'o' or S2[0] == 'o') and (S1[1] == 'b' or S2[1] == 'b') and (S1[2] == 'b' or S2[2] == 'b')):
		print('yes')
	else:
		print('no')


t = int(input())
for i in range(0, t):
	s1 = input()
	s2 = input()
	s3 = ''
	ok = False
	for i in range(0, 3):
		if s1[i] == 'o' or s2[i] == 'o':
			cnt = 0
			for j in range(0, 3):
				if j != i:
					if s1[j] == 'b' or s2[j] == 'b':
						cnt += 1
			if cnt == 2:
				ok = True
	if ok:
		print('yes')
		ok = False
	else:
		print('no')


T = int(input())
for _ in range(T):
	su = input()
	sb = input()
	s = []
	flag = False
	s.append(su)
	s.append(sb)
	bcount = 0
	ocount = 0
	possible = []
	for x in range(3):
		if su[x] == 'o' or sb[x] == 'o':
			count = 0
			for y in range(3):
				if y != x:
					if su[y] == 'b' or sb[y] == 'b':
						count += 1
			if count == 2:
				flag = True
				break
	if flag:
		print('yes')
	else:
		print('no')


T = int(input())
for tc in range(T):
	top = str(input())
	bot = str(input())
	flag = False
	for i in range(3):
		if top[i] == 'o' or bot[i] == 'o':
			count = 0
			for j in range(3):
				if j != i:
					if top[j] == 'b' or bot[j] == 'b':
						count += 1
			if count == 2:
				flag = True
				break
	if flag:
		print('yes')
	else:
		print('no')


T = int(input())
for k in range(T):
	A = input()
	V = input()
	s = 'no'
	for i in range(3):
		if A[i] == 'o' or V[i] == 'o':
			cent = 0
			for j in range(3):
				if j != i:
					if A[j] == 'b' or V[j] == 'b':
						cent += 1
						if cent == 2:
							s = 'yes'
	print(s)