Help me in solving HAPPYSTR problem

My issue

the code give in solution i didn’t understand why did he use return inside for loop

My code

# cook your dish here
def vow(x):
    return x=='a' or x=='e' or x=='i' or x=='o' or x=='u'
def sol():
    for i in range(0,n-2):
        if vow(s[i]) and vow(s[i+1]) and vow(s[i+2]):
            print("Happy")
            return
    print("Sad")
t=int(input())    
while t>0:
    s=input()
    n=len(s)
    t-=1        
    sol()   

Learning course: Strings using Python
Problem Link: Chef and Happy String Practice Problem in - CodeChef

@harshini_18
here plzz refer the following code

t = int(input())

while t > 0:
    s = input()
    hpy = False
    v = {"a", "e", "i", "o", "u"}
    for i in range(len(s) -2):
        if s[i] in v and s[i+1] in v and s[i+2] in v:
            hpy = True
            break
            
    # Your code goes here
    t -= 1
    if hpy:
        print("Happy")
    else:
        print("Sad")