python题解

n = int(input())
res = 0
m = list(map(int, input().split()))
l, r = list(map(int, input().split()))
for i in range(1, n):
    if m[i] == l:
        if m[i - 1] == r:
            res = 1
    if m[i] == r:
        if m[i - 1] == l:
            res = 1

if res:
    print("Yes")
else:
    print("No")