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: interview

Starter code:

Solutions:
# cook your dish here
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")

# cook your dish here
t=int(input())
for _ in range(t):
 s=input()
 if ( "SE" in s or "EC" in s or "SC" in s):
  print("no")
 else:
  print("yes")

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

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')


# cook your dish here
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")

# cook your dish here
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")
   
  
 
   


# cook your dish here
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")

# cook your dish here
for i in range(int(input())):
 s=input()
 print("no" if("SC" in s or "SE" in s or "EC" in s) else "yes")

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

# cook your dish here
for t 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())):
 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())):
 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")


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))

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

#Driver code starts here
t = int(input())
for _ in range(t):
 s = input()
 chefdailyRoutine(s)

# cook your dish here
for t 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")

# cook your dish here
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")


# cook your dish here
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)

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')

T= int(input())
for i in range(T):
 s= input()
 count= 0
 for j in range(1, len(s)):
  if len(s)== 1:
   print("yes")
  elif 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')

# cook your dish here
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")

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

# cook your dish here
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

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")

# cook your dish here
# cook your dish here
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")