n = int(eval(input()))

stair = input().split(' ')



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

  if (int(stair[i]) < int(stair[i+1])):

    stair[i+1] = int(stair[i+1]) - 1



  if (int(stair[i]) > int(stair[i+1])):

    print("No")

    exit()





print("Yes")

n = int(eval(input()))

stair = input().split(' ')



stair[0] = int(stair[0]) - 1

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

  if (int(stair[i]) < int(stair[i+1])):

    stair[i+1] = int(stair[i+1]) - 1



  if (int(stair[i]) > int(stair[i+1])):

    print("No")

    exit()

print("Yes")



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

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

+stair[0] = int(stair[0]) - 1