Help me in solving RATINGINPRAC problem

My issue

Help me out with this

My code

# cook your dish here
t=int(input())
for i in range(t):
    x=int(input())
    y=list(map(int,input().split()))
    n=0
    if (y[n]<=y[n+1]):
        for i in range(x):
            n=n+1
        print("yes")
    else:
        print ("no")

    
        
            

Learning course: Arrays using Python
Problem Link: CodeChef: Practical coding for everyone

@madhusuja2004
Your logic is not right.
Plzz refer the following solution for better understanding of logic and implementation.

def xd(l):
    n=len(l)
    for i in range(1,n):
        if l[i]<l[i-1]:
            return "No"
    return "YES"
test_cases=int(input())
for i in range(test_cases):
    n=int(input())
    l=list(map(int,input().split()))
    res=xd(l)
    print(res)