Your Name Is Mine

Any help would be appreciated. Cannot seem to spot some corner cases. Thanks in advance.

#print '42'
n = int(raw_input())
i = 0
while i < n:
	tc = raw_input().split()
	a = tc[0]
	b = tc[1]
	bb = []
	#print a, b
	if a == b:
		print "YES"
		if len(a) > len(b):
			tmp = b
			b = a
			a = tmp
		for x in b:
			if x not in a:
				b = filter(lambda a: a != x, b)
		#print a
		#print b
		if a in b:
			print "YES"
			print "NO"
	i += 1
#print a

Hi @neithan,

You should also ideally add question link, so others can find it.

Hi @neithan,

Please try reading the editorial for the problem.

It would be helpful.