def check(n):
n=n.lower()
for i in range(len(n)):
if n[i]=='.':
return check(n[i+1:])
elif n[i]=='t':
return False
elif n=='t' or n=='h':
return False
else:
k=i+1
for m in range(k,len(n)):
if n[m]=='h':
return False
elif n[m]=='t':
return check(n[(m+1):])
return True
for x in range(int(input())):
p=input()
s=input()
if check(s):
print("Valid")
else:
print("Invalid")
can anyone tell me where did i go wrong with this code.
Thanks in advance:-]
here is the problem link: