import re
def Main():
patt=re.compile(r'^(\?+)M(\?+)E(\?+)$')
n=int(input())
while n>0:
n-=1
s=input()
res=patt.match(s)
if (res is not None) and (len(res.group(1))+len(res.group(2)))==len(res.group(3)):
print("theorem")
else:
print("no-theorem")
if __name__=="__main__":
Main()
def Main():
patt=re.compile(r'^(\?+)M(\?+)E(\?+)$')
n=int(input())
while n>0:
n-=1
s=input()
res=patt.match(s)
if (res is not None) and (len(res.group(1))+len(res.group(2)))==len(res.group(3)):
print("theorem")
else:
print("no-theorem")
if __name__=="__main__":
Main()
Comments
Post a Comment