f = False
n = int(input())
for i in range(n):
a = int(input())
if a == 0:
f = True
if f:
print('yes')
else:
print('no')
f = False
n = int(input())
for i in range(n):
a = int(input())
if a == 0:
f = True
if f:
print('yes')
else:
print('no')