Read problems statements in mandarin chinese, russian and vietnamese as well. 

	Chef wants to prepare a Cook-Off contest with 5 problems chosen from a set of N problems. He has marked the difficulty of each problem within a range identified by one of the following strings: "cakewalk", "simple", "easy", "easy-medium", "medium", "medium-hard", "hard". According to this page, a Cook-Off contest must have problems of the following difficulties:

	exactly one "cakewalk";
	exactly one "simple";
	exactly one "easy";
	one "easy-medium" or one "medium";
	one "medium-hard" or one "hard".

	Given the information about the N problems, can you advise Chef if it's possible to pick 5 problems and form a valid Cook-Off contest?
------ 
	Input ------ 

	The first line of input contains one integer T denoting the number of test cases.
	T test cases follow.
	The first line of each test case contains a single integer N.
	Then N lines follow; the i-th line contains a single string s_{i}, denoting the difficulty of the i-th problem.

------ 
	Output ------ 

	For each test case, output "Yes" if it's possible to pick 5 problems and form a valid Cook-Off contest; otherwise, output "No".

------ 
	Constraints ------ 

	$1 ≤ T ≤ 100000$
	$5 ≤ N ≤ 100000$
	$sum of N in all test cases ≤ 600000$
	$s_{i} can only be one of the following strings:
$"cakewalk"$
$"simple"$
$"easy"$
$"easy-medium"$
$"medium"$
$"medium-hard"$
$"hard"$$

	Subtask #1 (11 points):

	$N = 5$

	Subtask #2 (27 points):

	$5 ≤ N ≤ 15$
	$T ≤ 100$

	Subtask #3 (62 points):

	$original constraints$

----- Sample Input 1 ------ 
3
5
easy
medium
medium-hard
simple
cakewalk
7
simple
simple
medium
medium
easy-medium
cakewalk
easy
7
cakewalk
simple
easy
easy-medium
medium
medium-hard
hard
----- Sample Output 1 ------ 
Yes
No
Yes
----- explanation 1 ------ 

	Example case 2: There are neither problems of "medium-hard" level nor "hard" level, so it's impossible to form a Cook-Off contest.

Source: codechef | Difficulty: EASY
Tags: Implementation


Solutions:
for t in range(int(input())):
	n = int(input())
	cc = 0
	cs = 0
	ce = 0
	cm = 0
	ch = 0
	for i in range(n):
		p = input()
		if p == 'easy':
			ce += 1
		elif p == 'cakewalk':
			cc += 1
		elif p == 'simple':
			cs += 1
		elif p == 'easy-medium' or p == 'medium':
			cm += 1
		elif p == 'medium-hard' or p == 'hard':
			ch += 1
	if cc >= 1 and cs >= 1 and (ce >= 1) and (cm >= 1) and (ch >= 1):
		print('Yes')
	else:
		print('No')


exactOneP = ['cakewalk', 'simple', 'easy']
p1 = ['easy-medium', 'medium']
p2 = ['medium-hard', 'hard']
for _ in range(int(input())):
	n = int(input())
	probList = []
	for i in range(n):
		probList.append(input())
	st = 'Yes'
	for i in exactOneP:
		if i not in probList:
			st = 'No'
			break
	if p1[0] not in probList and p1[1] not in probList:
		st = 'No'
	if p2[0] not in probList and p2[1] not in probList:
		st = 'No'
	print(st)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	s = Counter()
	for i in range(n):
		s.update((input(),))
	if s['cakewalk'] >= 1 and s['simple'] >= 1 and (s['easy'] >= 1):
		if s['easy-medium'] >= 1 or s['medium'] >= 1:
			if s['medium-hard'] >= 1 or s['hard'] >= 1:
				print('Yes')
				continue
	print('No')


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	for i in range(n):
		s = str(input())
		if s == 'cakewalk':
			l.append(1)
		elif s == 'simple':
			l.append(2)
		elif s == 'easy':
			l.append(3)
		elif s == 'easy-medium' or s == 'medium':
			l.append(4)
		elif s == 'medium-hard' or s == 'hard':
			l.append(5)
	l = set(l)
	l = list(l)
	if sum(l) == 15:
		print('Yes')
	else:
		print('No')


T = int(input())
for t in range(T):
	counts = {'cakewalk': 0, 'simple': 0, 'easy': 0, 'easy-medium': 0, 'medium': 0, 'medium-hard': 0, 'hard': 0}
	arr = []
	a = int(input())
	for i in range(a):
		b = input()
		arr.append(b)
	for items in arr:
		counts[items] += 1
	if counts['cakewalk'] >= 1 and counts['simple'] >= 1 and (counts['easy'] >= 1) and (counts['easy-medium'] >= 1 or counts['medium'] >= 1) and (counts['medium-hard'] >= 1 or counts['hard'] >= 1):
		print('Yes')
	else:
		print('No')


for _____cases_____ in range(int(input())):
	N = int(input())
	level = {'cakewalk': 1, 'simple': 1, 'easy': 1, 'easy-medium': 1, 'medium': 1, 'medium-hard': 1, 'hard': 1}
	for i in range(N):
		level[input()] += 1
	if level['cakewalk'] > 1 and level['simple'] > 1 and (level['easy'] > 1) and (level['easy-medium'] > 1 or level['medium'] > 1) and (level['medium-hard'] > 1 or level['hard'] > 1):
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		l.append(input())
	(c, s, e) = ('cakewalk', 'simple', 'easy')
	(em, m, mh, h) = ('easy-medium', 'medium', 'medium-hard', 'hard')
	if l.count(c) >= 1 and l.count(s) >= 1 and (l.count(e) >= 1) and (l.count(mh) >= 1 or l.count(h) >= 1) and (l.count(em) >= 1 or l.count(m) >= 1):
		print('Yes')
	else:
		print('No')


t = int(input())
l = []
for i in range(t):
	a = 0
	b = 0
	c = 0
	d = 0
	e = 0
	n = int(input())
	for j in range(n):
		r = input()
		if r == 'cakewalk':
			a = a + 1
		elif r == 'simple':
			b = b + 1
		elif r == 'easy':
			c = c + 1
		elif r == 'easy-medium' or r == 'medium':
			d = d + 1
		elif r == 'medium-hard' or r == 'hard':
			e = e + 1
	if a != 0 and b != 0 and (c != 0) and (d != 0) and (e != 0):
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	x = int(input())
	a = {'cakewalk': 0, 'simple': 0, 'easy': 0, 'easy-medium': 0, 'medium': 0, 'medium-hard': 0, 'hard': 0}
	for i in range(x):
		a[input()] += 1
	if a['cakewalk'] > 0 and a['simple'] > 0 and (a['easy'] > 0) and (a['easy-medium'] > 0 or a['medium'] > 0) and (a['medium-hard'] > 0 or a['hard'] > 0):
		print('Yes')
	else:
		print('No')


T = int(input())
for z in range(T):
	N = int(input())
	a = b = c = d = e = 0
	for i in range(N):
		string = input()
		if string == 'cakewalk':
			a += 1
		elif string == 'simple':
			b += 1
		elif string == 'easy':
			c += 1
		elif string == 'easy-medium' or string == 'medium':
			d += 1
		elif string == 'medium-hard' or string == 'hard':
			e += 1
	if a != 0 and b != 0 and (c != 0) and (d != 0) and (e != 0):
		print('Yes')
	else:
		print('No')


l2 = ['cakewalk', 'simple', 'easy', 'medium', 'hard']
l2.sort()
for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		a = input()
		if a == 'easy-medium':
			a = 'medium'
		elif a == 'medium-hard':
			a = 'hard'
		l.append(a)
	l = set(l)
	l = list(l)
	l.sort()
	if l == l2:
		print('Yes')
	else:
		print('No')


from collections import Counter
T = int(input())
for i in range(T):
	N = int(input())
	a = [str(input()) for i in range(N)]
	x = 'No'
	if 'cakewalk' in a and 'easy' in a and ('simple' in a):
		if 'medium' in a or 'easy-medium' in a:
			if 'medium-hard' in a or 'hard' in a:
				x = 'Yes'
	print(x)


from collections import Counter
t = int(input())
for abcd in range(t):
	n = int(input())
	arr = [str(input()) for jjj in range(n)]
	ans = 'No'
	if 'cakewalk' in arr and 'easy' in arr and ('simple' in arr):
		if 'medium' in arr or 'easy-medium' in arr:
			if 'medium-hard' in arr or 'hard' in arr:
				ans = 'Yes'
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	(c, s, e, em, m, mh, h) = (0, 0, 0, 0, 0, 0, 0)
	for j in range(n):
		x = input()
		if x == 'cakewalk':
			c += 1
		elif x == 'simple':
			s += 1
		elif x == 'easy':
			e += 1
		elif x == 'easy-medium':
			em += 1
		elif x == 'medium':
			m += 1
		elif x == 'medium-hard':
			mh += 1
		else:
			h += 1
	if c != 0 and s != 0 and (e != 0) and (em != 0 or m != 0) and (mh != 0 or h != 0):
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	d = {'cakewalk': 0, 'simple': 0, 'easy': 0, 'easy-medium': 0, 'medium': 0, 'medium-hard': 0, 'hard': 0}
	for i in range(n):
		d[input()] += 1
	if d['cakewalk'] > 0 and d['simple'] > 0 and (d['easy'] > 0) and (d['easy-medium'] > 0 or d['medium'] > 0) and (d['medium-hard'] > 0 or d['hard'] > 0):
		print('Yes')
	else:
		print('No')


t = int(input(''))
while t > 0:
	n = int(input(''))
	(c, s, e, m, h) = (0, 0, 0, 0, 0)
	for i in range(n):
		st = input('')
		if st == 'cakewalk':
			c += 1
		elif st == 'simple':
			s += 1
		elif st == 'easy':
			e += 1
		elif st == 'easy-medium' or st == 'medium':
			m += 1
		elif st == 'medium-hard' or st == 'hard':
			h += 1
	if c != 0 and s != 0 and (e != 0) and (m != 0) and (h != 0):
		print('Yes')
	else:
		print('No')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	lis = []
	for i in range(n):
		lis.append(str(input()))
	a = lis.count('cakewalk')
	b = lis.count('simple')
	c = lis.count('easy')
	d = lis.count('easy-medium') + lis.count('medium')
	e = lis.count('medium-hard') + lis.count('hard')
	if a != 0 and b != 0 and (c != 0) and (d != 0) and (e != 0):
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	arr = []
	for i in range(n):
		s = input()
		arr.append(s)
	c1 = arr.count('cakewalk')
	c2 = arr.count('simple')
	c3 = arr.count('easy')
	c4 = arr.count('easy-medium')
	c5 = arr.count('medium')
	c6 = arr.count('medium-hard')
	c7 = arr.count('hard')
	if c1 >= 1 and c2 >= 1 and (c3 >= 1) and (c4 >= 1 or c5 >= 1) and (c6 >= 1 or c7 >= 1):
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	l = []
	for i in range(int(input())):
		l.append(input())
	if 'easy' in l and 'cakewalk' in l and ('simple' in l):
		if 'easy-medium' in l or 'medium' in l:
			if 'medium-hard' in l or 'hard' in l:
				print('Yes')
			else:
				print('No')
		else:
			print('No')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	lst = []
	for i in range(n):
		x = input()
		lst.append(x)
	if lst.count('cakewalk') >= 1 and lst.count('simple') >= 1 and (lst.count('easy') >= 1) and (lst.count('easy-medium') >= 1 or lst.count('medium') >= 1) and (lst.count('medium-hard') >= 1 or lst.count('hard') >= 1):
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	n = int(input())
	s = []
	for i in range(n):
		a = input()
		s.append(a)
	if s.count('cakewalk') > 0 and s.count('simple') > 0 and (s.count('easy') > 0) and (s.count('easy-medium') > 0 or s.count('medium') > 0) and (s.count('medium-hard') > 0 or s.count('hard') > 0):
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	l = list((input() for q in range(n)))
	flag = 0
	if 'cakewalk' not in l or 'easy' not in l or 'simple' not in l:
		flag = 1
	if 'easy-medium' not in l and 'medium' not in l:
		flag = 1
	if 'medium-hard' not in l and 'hard' not in l:
		flag = 1
	print('Yes' if flag == 0 else 'No')


for _ in range(int(input())):
	dif = set()
	for __ in range(int(input())):
		dif.add(input())
	if 'cakewalk' in dif and 'simple' in dif and ('easy' in dif) and ('easy-medium' in dif or 'medium' in dif) and ('medium-hard' in dif or 'hard' in dif):
		print('Yes')
	else:
		print('No')


T = int(input())
for _ in range(T):
	ppr = {'cakewalk': 2, 'simple': 3, 'easy': 5, 'easy-medium': 7, 'medium': 11, 'medium-hard': 13, 'hard': 17}
	res = 1
	for _ in range(int(input())):
		qstn = input()
		res = res * ppr[qstn]
	if res % 2730 == 0 or res % 4290 == 0 or res % 3570 == 0 or (res % 5610 == 0):
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	k = int(input())
	c = [0] * 7
	for i in range(k):
		n = input()
		if n == 'cakewalk':
			c[0] += 1
		if n == 'simple':
			c[1] += 1
		if n == 'easy':
			c[2] += 1
		if n == 'easy-medium':
			c[3] += 1
		if n == 'medium':
			c[4] += 1
		if n == 'medium-hard':
			c[5] += 1
		if n == 'hard':
			c[6] += 1
	if c[0] >= 1 and c[1] >= 1 and (c[2] >= 1) and (c[3] >= 1 or c[4] >= 1) and (c[5] >= 1 or c[6] >= 1):
		print('Yes')
	else:
		print('No')


T = int(input())
for _ in range(T):
	n = int(input())
	l1 = {'cakewalk', 'simple', 'easy', 'medium', 'hard'}
	p = set()
	for _ in range(n):
		s = input().strip('')
		if 'hard' in s:
			p.add('hard')
		elif 'medium' in s:
			p.add('medium')
		else:
			p.add(s)
	if len(l1) == len(p):
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	l = []
	for j in range(int(input())):
		s = input()
		if s == 'easy-medium':
			l.append('medium')
		elif s == 'medium-hard':
			l.append('hard')
		else:
			l.append(s)
	se = set(l)
	if len(se) == 5:
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	l = []
	for j in range(int(input())):
		l.append(input())
	d = 0
	if l.count('cakewalk') >= 1 and l.count('simple') >= 1 and (l.count('easy') >= 1):
		d += 1
	if l.count('easy-medium') >= 1 or l.count('medium') >= 1:
		d += 1
	if l.count('medium-hard') >= 1 or l.count('hard') >= 1:
		d += 1
	if d == 3:
		print('Yes')
	else:
		print('No')


contest = {'cakewalk', 'simple', 'easy', 'medium', 'hard'}
for _ in range(int(input())):
	N = int(input())
	given = set()
	for i in range(N):
		cat = input().strip()
		if 'hard' in cat:
			given.add('hard')
		elif 'medium' in cat:
			given.add('medium')
		else:
			given.add(cat)
	if len(contest - given) == 0:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	t = int(input())
	l = []
	for i in range(t):
		s = input()
		if s == 'cakewalk':
			if 1 not in l:
				l.append(1)
		elif s == 'simple':
			if 2 not in l:
				l.append(2)
		elif s == 'easy':
			if 3 not in l:
				l.append(3)
		elif s == 'easy-medium' or s == 'medium':
			if 4 not in l:
				l.append(4)
		elif s == 'medium-hard' or s == 'hard':
			if 5 not in l:
				l.append(5)
	if len(l) == 5:
		print('Yes')
	else:
		print('No')


t = int(input())
while t > 0:
	x = int(input())
	l = []
	for i in range(x):
		l.append(input())
	if 'cakewalk' in l:
		if 'simple' in l:
			if 'easy' in l:
				if 'easy-medium' in l or 'medium' in l:
					if 'medium-hard' in l or 'hard' in l:
						print('Yes')
					else:
						print('No')
				else:
					print('No')
			else:
				print('No')
		else:
			print('No')
	else:
		print('No')
	t -= 1


for _ in range(int(input())):
	a = int(input())
	b = []
	for i in range(a):
		c = input()
		b.append(c)
	if 'cakewalk' in b and 'simple' in b and ('easy' in b) and ('easy-medium' in b or 'medium' in b) and ('medium-hard' in b or 'hard' in b):
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	n = int(input())
	strings = []
	c = 0
	for i in range(n):
		s = input()
		strings.append(s)
	if 'cakewalk' in strings and 'simple' in strings and ('easy' in strings) and ('easy-medium' in strings or 'medium' in strings) and ('medium-hard' in strings or 'hard' in strings):
		print('Yes')
	else:
		print('No')


t = int(input())
while t:
	n = int(input())
	(cakewalk, simple, easy, midium, hard) = (0, 0, 0, 0, 0)
	cnt = 0
	for i in range(n):
		x = input()
		if x == 'cakewalk':
			cakewalk += 1
		elif x == 'simple':
			simple += 1
		elif x == 'easy':
			easy += 1
		elif x in ['easy-medium', 'medium']:
			midium += 1
		elif x in ['medium-hard', 'hard']:
			hard += 1
	print('Yes' if cakewalk >= 1 and simple >= 1 and (easy >= 1) and (midium >= 1) and (hard >= 1) else 'No')
	t -= 1


T = int(input())
for i in range(T):
	N = int(input())
	strings = []
	for j in range(N):
		S = input()
		strings.append(S)
	if 'cakewalk' in strings and 'simple' in strings and ('easy' in strings) and ('easy-medium' in strings or 'medium' in strings) and ('medium-hard' in strings or 'hard' in strings):
		print('Yes')
	else:
		print('No')


T = int(input())
for t in range(T):
	N = int(input())
	tests = list()
	for n in range(N):
		tests.append(input()[-1])
	if tests.count('k') == 0 or tests.count('e') == 0 or tests.count('y') == 0 or (tests.count('m') == 0) or (tests.count('d') == 0):
		print('No')
	else:
		print('Yes')


for _ in range(int(input())):
	n = int(input())
	l = []
	for _ in range(n):
		l.append(input())
	a = l.count('cakewalk')
	b = l.count('simple')
	c = l.count('easy')
	d = l.count('easy-medium')
	e = l.count('medium')
	f = l.count('medium-hard')
	g = l.count('hard')
	if a >= 1 and b >= 1 and (c >= 1) and (d >= 1 or e >= 1) and (f >= 1 or g >= 1):
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	n = int(input())
	a = set()
	for j in range(n):
		a.add(input())
	if 'cakewalk' in a and 'easy' in a and ('simple' in a):
		if 'medium' in a or 'easy-medium' in a:
			if 'hard' in a or 'medium-hard' in a:
				print('Yes')
			else:
				print('No')
		else:
			print('No')
	else:
		print('No')