n = int(eval(input()))

hn = [int(num) for num in input().split()]



max_num = 0

for i in range(n):

    if hn[i] < max_num - 1  :

        print("No")

        exit()

    max_num = max(max_num, hn[i])

print("Yes")
n = int(eval(input()))

hn = [int(num) for num in input().split()]



for i in range(n-1,0,-1):

  if hn[i-1] > hn[i]:

    hn[i-1] -= 1

    if hn[i-1] > hn[i]:

      print("No")

      exit()

            

print("Yes")
n = int(eval(input()))
hn = [int(num) for num in input().split()]
max_num = 0
for i in range(n):
    if hn[i] < max_num - 1:
        print("No")
        exit()
    max_num = max(max_num, hn[i])
print("Yes")

n = int(eval(input()))
hn = [int(num) for num in input().split()]
for i in range(n - 1, 0, -1):
    if hn[i - 1] > hn[i]:
        hn[i - 1] -= 1
        if hn[i - 1] > hn[i]:
            print("No")
            exit()
print("Yes")

-max_num = 0 -for i in range(n): -    if hn[i] < max_num - 1: -        print("No") -        exit() -    max_num = max(max_num, hn[i]) +for i in range(n - 1, 0, -1): +    if hn[i - 1] > hn[i]: +        hn[i - 1] -= 1 +        if hn[i - 1] > hn[i]: +            print("No") +            exit()