newton/solutions/spell_check.py

17 lines
274 B
Python
Raw Normal View History

2025-01-11 11:41:29 +00:00
from itertools import permutations
t = int(input())
perms = [''.join(x) for x in permutations("Timur", 5)]
for _ in range(t):
n = int(input())
s = input()
if n != 5:
print("NO")
elif s in perms:
print("YES")
else:
print("NO")