• + 0 comments
    # Enter your code here. Read input from STDIN. Print output to STDOUT
    from collections import deque
    if __name__ == '__main__':
        T = int(input())
        for _ in range(T):
            n = int(input())
            cube = deque(map(int,input().split()))
            ans = True
            last = max(cube)
            
            while cube:
                if cube[0] >= cube[-1]:
                    current = cube.popleft()
                else:
                    current = cube.pop()
                    
                if last is None or current <= last:
                    last = current
                else:
                    ans = False
                    break
            print("Yes" if ans else "No")