N = int(eval(input()))

lst_H = list(map(int, input().split()))

lst_H = lst_H[::-1]



ans = "Yes"

for i in range(N - 1):

    if lst_H[i] + 1 == lst_H[i + 1]:

        lst_H[i + 1] -= 1

    elif lst_H[i] >= lst_H[i + 1]:

        continue

    else:

        ans = "No"

        break

print(ans)

N = int(eval(input()))

lst_H = list(map(int, input().split()))





ans = "Yes"

lst_H[0] -= 1

for i in range(1, N):

    if lst_H[i - 1] < lst_H[i]:

        lst_H[i] -= 1

    elif lst_H[i - 1] == lst_H[i]:

        continue

    else:

        ans = "No"

        break

print(ans)
N = int(eval(input()))
lst_H = list(map(int, input().split()))
lst_H = lst_H[::-1]
ans = "Yes"
for i in range(N - 1):
    if lst_H[i] + 1 == lst_H[i + 1]:
        lst_H[i + 1] -= 1
    elif lst_H[i] >= lst_H[i + 1]:
        continue
    else:
        ans = "No"
        break
print(ans)

N = int(eval(input()))
lst_H = list(map(int, input().split()))
ans = "Yes"
lst_H[0] -= 1
for i in range(1, N):
    if lst_H[i - 1] < lst_H[i]:
        lst_H[i] -= 1
    elif lst_H[i - 1] == lst_H[i]:
        continue
    else:
        ans = "No"
        break
print(ans)

-lst_H = lst_H[::-1] -for i in range(N - 1): -    if lst_H[i] + 1 == lst_H[i + 1]: -        lst_H[i + 1] -= 1 -    elif lst_H[i] >= lst_H[i + 1]: +lst_H[0] -= 1 +for i in range(1, N): +    if lst_H[i - 1] < lst_H[i]: +        lst_H[i] -= 1 +    elif lst_H[i - 1] == lst_H[i]: