Chef's daily routine is very simple. He starts his day with cooking food, then he eats the food and finally proceeds for sleeping thus ending his day. Chef carries a robot as his personal assistant whose job is to log the activities of Chef at various instants during the day. Today it recorded activities that Chef was doing at N different instants. These instances are recorded in chronological order (in increasing order of time). This log is provided to you in form of a string s of length N, consisting of characters 'C', 'E' and 'S'. If s[i] = 'C', then it means that at the i-th instant Chef was cooking, 'E' denoting he was eating and 'S' means he was sleeping.
You have to tell whether the record log made by the robot could possibly be correct or not. 

-----Input-----
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
The only line of each test case contains string s.

-----Output-----
For each test case, output a single line containing "yes" or "no" (without quotes) accordingly.

-----Constraints-----
- 1 ≤ T ≤ 20
- 1 ≤ N ≤ 105

-----Subtasks-----
- Subtask #1 (40 points) : 1 ≤ N ≤ 100
- Subtask #2 (60 points) : original constraints

-----Example-----
Input:
5
CES
CS
CCC
SC
ECCC

Output:
yes
yes
yes
no
no

-----Explanation-----
Example case 1. "CES" can correspond to a possible record of activities of Chef. He starts the day with cooking, then eating and then sleeping.
Example case 2. "CS" can also correspond to a possible record of activities of Chef. He starts the day with cooking, then eating and then sleeping. Robot recorded his cooking and sleeping in order. He might not have recorded his eating activity.
Example case 4. "SC" can not correspond to Chef's activities. Here it means that Chef slept first, then he cooked the food, which is impossible for Chef to do on some particular day.

Difficulty: EASY

Solutions:
t = int(input())
for z in range(t):
	s = input()
	if 'EC' in s:
		print('no')
	elif 'SC' in s or 'SE' in s:
		print('no')
	else:
		print('yes')


l = ['C', 'E', 'S']
for t in range(int(input())):
	a = input().upper()
	flag = 0
	for i in range(1, len(a)):
		if a[i] < a[i - 1]:
			flag = 1
			print('no')
			break
	if flag == 0:
		print('yes')


t = int(input())
for i in range(t):
	s = input()
	if s.count('SE') or s.count('SC') or s.count('EC'):
		print('no')
	else:
		print('yes')


for i in range(int(input())):
	s = input()
	m = ''
	for i in range(len(s) - 1):
		if s[i] == s[i + 1]:
			continue
		else:
			m += s[i]
	m += s[-1]
	if m == 'CES' or m == 'C' or m == 'E' or (m == 'S') or (m == 'CE') or (m == 'ES') or (m == 'CS'):
		print('yes')
	else:
		print('no')


t = int(input())
for i in range(t):
	s = input()
	activies_set = set()
	ans = 'yes'
	for j in range(len(s)):
		if s[j] == 'C':
			if 'E' in activies_set or 'S' in activies_set:
				ans = 'no'
				break
			activies_set.add('C')
		elif s[j] == 'E':
			if 'S' in activies_set:
				ans = 'no'
				break
			activies_set.add('E')
		elif s[j] == 'S':
			activies_set.add('S')
	print(ans)


test = int(input())
for i in range(test):
	string = input()
	List = list(string)
	if List == sorted(List):
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	s = input()
	m = ''
	ind = 0
	for i in s:
		if i >= m:
			m = i
		else:
			ind = 1
			break
	if ind == 1:
		print('no')
	else:
		print('yes')


for _ in range(int(input())):
	s = input().strip()
	flag = True
	i = 0
	n = len(s)
	visit = set()
	while i < len(s):
		if s[i] == 'E' and (not 'E' in visit):
			j = i + 1
			while j < len(s) and s[j] != 'C':
				j += 1
			if j != n:
				flag = False
				break
			visit.add('E')
		if s[i] == 'S' and (not 'S' in visit):
			j = i + 1
			while j < len(s) and s[j] != 'C' and (s[j] != 'E'):
				j += 1
			if j != n:
				flag = False
				break
			visit.add('S')
		i += 1
	if flag:
		print('yes')
	else:
		print('no')


def chefdailyRoutine(s):
	flag = 1
	for i in range(1, len(s)):
		if ord(s[i]) < ord(s[i - 1]):
			flag = 0
			break
	if flag == 1:
		print('yes')
	else:
		print('no')
	return
t = int(input())
for _ in range(t):
	s = input()
	chefdailyRoutine(s)


for _ in range(int(input())):
	s = input()
	f = 0
	for i in range(1, len(s)):
		if s[i] < s[i - 1]:
			f = 1
			print('no')
			break
	if f == 0:
		print('yes')


for t in range(int(input())):
	ls = list(input())
	flag1 = 0
	for i in range(1, len(ls)):
		if ord(ls[i]) >= ord(ls[i - 1]):
			continue
		else:
			flag1 = 1
			break
	if flag1 == 0:
		print('yes')
	else:
		print('no')


T = int(input())
for i in range(T):
	s = input()
	x = ['C', 'E', 'S']
	flag = 0
	for i in range(len(s) - 1):
		routine_index = x.index(s[i])
		if x.index(s[i + 1]) >= routine_index:
			flag = 1
		else:
			flag = 0
			break
	if flag == 1:
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	a = input()
	a = list(a)
	b = sorted(a)
	if b == a:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	s = list(input().lower())
	n = len(s)
	if n == 1:
		if s[0] == 'c':
			print('yes')
		else:
			print('no')
	else:
		for i in range(n - 1):
			if ord(s[i]) > ord(s[i + 1]):
				print('no')
				break
		else:
			print('yes')


for _ in range(int(input())):
	s = input()
	a = []
	for i in range(len(s)):
		a += [s[i]]
	if a == sorted(a):
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	s = input()
	c = 1
	for i in range(len(s) - 1):
		if s[i + 1] == 'E' and s[i] == 'S':
			c = 0
			break
		elif s[i + 1] == 'C' and s[i] == 'S':
			c = 0
			break
		elif s[i + 1] == 'C' and s[i] == 'E':
			c = 0
			break
	if c:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	s = input()
	final = s[0]
	prev = s[0]
	for _ in s:
		if _ != prev:
			final += _
			prev = _
	if _ != prev:
		final += _
	if 'C' == final or 'E' == final or 'S' == final or ('CE' == final) or ('CS' == final) or ('ES' == final) or ('CES' == final):
		print('yes')
	else:
		print('no')


import math
for i in range(int(input())):
	s = input()
	s = list(s)
	if s == sorted(s):
		print('yes')
	else:
		print('no')


t = int(input())
for i in range(t):
	s = str(input())
	if list(s) == sorted(s):
		print('yes')
	else:
		print('no')


n = int(input())
for ni in range(n):
	s = input()
	x = 1
	for i in range(len(s) - 1):
		if s[i] == 'S' and (s[i + 1] == 'C' or s[i + 1] == 'E'):
			x = 0
			print('no')
			break
		elif s[i] == 'E' and s[i + 1] == 'C':
			x = 0
			print('no')
			break
	if x == 1:
		print('yes')


t = int(input())
for _ in range(t):
	s = input()
	k = len(s)
	count = 0
	for i in range(k - 1):
		if s[i] == 'C':
			if s[i + 1] == 'E' or s[i + 1] == 'S' or s[i + 1] == 'C':
				count += 1
		elif s[i] == 'E':
			if s[i + 1] == 'S' or s[i + 1] == 'E':
				count += 1
		elif s[i] == 'S':
			if s[i + 1] == 'S':
				count += 1
	if count == k - 1:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	s = input()
	flag = True
	for i in range(len(s) - 1):
		if s[i] == 'E' and s[i + 1] == 'C':
			flag = False
			break
		elif s[i] == 'S' and (s[i + 1] == 'C' or s[i + 1] == 'E'):
			flag = False
			break
	if flag:
		print('yes')
	else:
		print('no')


n = int(input())
while n:
	ls = input()
	flag1 = 0
	for i in range(1, len(ls)):
		if ord(ls[i]) >= ord(ls[i - 1]):
			continue
		else:
			flag1 = 1
			break
	if flag1 == 0:
		print('yes')
	else:
		print('no')
	n = n - 1


n = int(input())
c = 0
for i in range(n):
	s = input()
	x = list(s)
	l = list(s)
	l.sort()
	k = 0
	c = 0
	for j in x:
		if j == l[k]:
			c = c + 1
			k = k + 1
	if c == len(s):
		print('yes')
	else:
		print('no')


T = int(input())
while T > 0:
	S = input()
	ans = True
	for i in range(len(S) - 1):
		if S[i] == 'E':
			if S[i + 1] == 'C':
				ans = False
				break
		elif S[i] == 'S':
			if S[i + 1] == 'C' or S[i + 1] == 'E':
				ans = False
				break
	if ans:
		print('yes')
	else:
		print('no')
	T -= 1


for _ in range(int(input())):
	n = input()
	m = set()
	flag = True
	for i in n:
		if i == 'C':
			if 'E' in m or 'S' in m:
				flag = False
				break
			m.add(i)
		elif i == 'E':
			if 'S' in m:
				flag = False
				break
			m.add(i)
		else:
			m.add(i)
	if flag:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	s = input()
	if s.count('SE') or s.count('SC') or s.count('EC'):
		print('no')
	else:
		print('yes')


T = int(input())
for i in range(T):
	s = input().upper()
	count = 0
	for j in range(len(s) - 1):
		if ord(s[j]) <= ord(s[j + 1]):
			count += 1
		else:
			count -= 1
	if count == len(s) - 1:
		print('yes')
	else:
		print('no')


for tc in range(int(input())):
	s = input()
	last = 'C'
	ans = 'yes'
	for i in s:
		if last == 'C':
			last = i
		if last == 'E':
			if i != 'E' and i != 'S':
				ans = 'no'
				break
			else:
				last = i
		if last == 'S':
			if i != 'S':
				ans = 'no'
				break
			else:
				last = i
	print(ans)


t = int(input())
for i in range(t):
	s = input()
	flag = 0
	for i in range(len(s) - 1):
		if s[i] == 'E':
			if s[i + 1] == 'C':
				flag = 1
				break
		if s[i] == 'S':
			if s[i + 1] == 'C' or s[i + 1] == 'E':
				flag = 1
				break
	if flag == 0:
		print('yes')
	else:
		print('no')


tests = int(input())
for i in range(tests):
	string = input()
	activities_set = set()
	ans = 'yes'
	for j in range(len(string)):
		if string[j] == 'C':
			if 'E' in activities_set or 'S' in activities_set:
				ans = 'no'
				break
			activities_set.add('C')
		elif string[j] == 'E':
			if 'S' in activities_set:
				ans = 'no'
				break
			activities_set.add('E')
		elif string[j] == 'S':
			activities_set.add('S')
	print(ans)


for i in range(int(input())):
	n = input()
	if 'EC' in n:
		print('no')
	elif 'SC' in n or 'SE' in n:
		print('no')
	else:
		print('yes')


for t in range(int(input())):
	s = input()
	a = [*s]
	b = sorted(a)
	if a == b:
		print('yes')
	else:
		print('no')


t = int(input())
for i in range(t):
	st = input()
	(C, E, S) = (1, 2, 3)
	flag = 1
	for i in range(1, len(st)):
		if st[i - 1] > st[i]:
			flag = 0
	if flag:
		print('yes')
	else:
		print('no')


t = int(input())
log_order = {'C': 1, 'E': 2, 'S': 3}
for _ in range(t):
	log = list(input())
	break_check = 999
	for entry_index in range(len(log)):
		if entry_index + 1 < len(log):
			if log_order[log[entry_index]] > log_order[log[entry_index + 1]]:
				break_check = 0
				print('no')
				break
	if break_check == 999:
		print('yes')


for _ in range(int(input())):
	s = input()
	l = []
	for i in range(1, len(s)):
		if s[i - 1] <= s[i]:
			continue
		else:
			print('no')
			break
	else:
		print('yes')


for _ in range(int(input())):
	s = input()
	b = list(s)
	print('yes' if b == sorted(b) else 'no')


n = int(input())
for _ in range(n):
	s = input()
	flag = 0
	for i in range(len(s) - 1):
		if s[i:i + 2] == 'EC' or s[i:i + 2] == 'SC' or s[i:i + 2] == 'SE':
			flag = 1
			break
	if flag == 0:
		print('yes')
	else:
		print('no')


t = int(input())
for _ in range(0, t):
	s = input()
	k = 0
	n = len(s)
	for i in range(0, n - 1):
		if s[i] == 'S':
			if s[i + 1] == 'C' or s[i + 1] == 'E':
				print('no')
				k = 1
				break
		if s[i] == 'E':
			if s[i + 1] == 'C':
				print('no')
				k = 1
				break
	if k == 0:
		print('yes')


t = int(input())
for _ in range(t):
	st = input()
	(C, E, S) = (1, 2, 3)
	flag = True
	for i in range(1, len(st)):
		if st[i - 1] > st[i]:
			flag = False
	if flag:
		print('yes')
	else:
		print('no')


a = int(input())
for i in range(a):
	b = input()
	if 'SC' in b or 'SE' in b or 'EC' in b:
		print('no')
	else:
		print('yes')


for _ in range(int(input())):
	s = ''
	x = input()
	y = list(x)
	y.sort()
	for i in y:
		s += i
	if s == x:
		print('yes')
	else:
		print('no')


def routne(s):
	flag = 0
	for i in range(len(s) - 1):
		if ord(s[i]) > ord(s[i + 1]):
			flag = 0
			return 'no'
		else:
			flag = 1
	if flag == 1:
		return 'yes'
	else:
		return 'no'
for i in range(int(input())):
	a = input()
	print(routne(a))


t = int(input())
for k in range(t):
	a = list(input())
	b = sorted(a)
	if b == a:
		print('yes')
	else:
		print('no')


a = ['C', 'E', 'S']
for x in range(int(input())):
	s = input()
	S = list(s)
	Error = False
	for x in range(len(S) - 1):
		if x == 0:
			if a.index(S[x]) > a.index(S[x + 1]):
				Error = True
		else:
			if a.index(S[x - 1]) > a.index(S[x]):
				Error = True
			if a.index(S[x]) > a.index(S[x + 1]):
				Error = True
	if Error:
		print('no')
	else:
		print('yes')


T = int(input())
for i in range(T):
	s = input()
	count = 0
	for j in range(1, len(s)):
		if s[j] == 'C' and s[j - 1] == 'C':
			count += 1
		elif s[j] == 'E':
			if s[j - 1] == 'C' or s[j - 1] == 'E':
				count += 1
		elif s[j] == 'S':
			if s[j - 1] == 'E' or s[j - 1] == 'C' or s[j - 1] == 'S':
				count += 1
	if count == len(s) - 1:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	S = input()
	activities = ['C', 'E', 'S']
	for i in S:
		if i not in activities:
			print('no')
			break
		while i != activities[0]:
			del activities[0]
	else:
		print('yes')


t = input()
for c in range(0, int(t)):
	s = input()
	state = ''
	for x in s:
		if state != '':
			if state == 'S' and x != 'S':
				state = 'B'
				break
			if state == 'E' and x == 'C':
				state = 'B'
				break
		state = x
	if state != 'B':
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	s = input()
	s = s.lower()
	c = 0
	for i in range(len(s) - 1):
		if s[i] == 'e' and s[i + 1] == 'c':
			c += 1
		elif s[i] == 's' and s[i + 1] == 'c':
			c += 1
		elif s[i] == 's' and s[i + 1] == 'e':
			c += 1
	if c == 0:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	s = input()
	ans = 'yes'
	for i in range(1, len(s)):
		if s[i] < s[i - 1]:
			ans = 'no'
			break
	print(ans)


t = int(input())
for i in range(t):
	s = input().upper()
	c = 0
	for i in range(len(s) - 1):
		if ord(s[i]) <= ord(s[i + 1]):
			c += 1
		else:
			c -= 1
	if c == len(s) - 1:
		print('yes')
	else:
		print('no')


def chef_activity(s):
	n = len(s)
	flag = 0
	if n == 1:
		return 'yes'
	for i in range(1, n):
		if s[i] < s[i - 1]:
			return 'no'
	return 'yes'
t = int(input())
for i in range(t):
	s = input()
	print(chef_activity(s))


for _ in range(int(input())):
	s = input()
	n = len(s)
	ans = 'yes'
	st = 'CES'
	if n == 1:
		print(ans)
		continue
	elif n == 2:
		for i in range(0, 1):
			curr = s[i]
			if curr == 'C' and (s[i + 1] == 'C' or s[i + 1] == 'E' or s[i + 1] == 'S'):
				continue
			elif curr == 'E' and (s[i + 1] == 'E' or s[i + 1] == 'S'):
				continue
			elif curr == 'S' and s[i + 1] == 'S':
				continue
			else:
				ans = 'no'
				break
	else:
		for i in range(0, n - 2):
			curr = s[i]
			if curr == 'C' and (s[i + 1] == 'C' or s[i + 1] == 'E' or s[i + 1] == 'S'):
				continue
			elif curr == 'E' and (s[i + 1] == 'E' or s[i + 1] == 'S'):
				continue
			elif curr == 'S' and s[i + 1] == 'S':
				continue
			else:
				ans = 'no'
				break
	print(ans)


for _ in range(int(input())):
	S = input().strip()
	if 'SC' in S or 'EC' in S or 'SE' in S:
		print('no')
	else:
		print('yes')


t = int(input())
for _ in range(t):
	s = list(input())
	k = sorted(s)
	if k == s:
		print('yes')
	else:
		print('no')