def find(n, s, a, t): for i in t: tag = 0 for j in s: if j == i: print('YES') tag = 1 break if not tag: print('NO') n = int(input()) s = list(map(int, input().split())) a = int(input()) t = list(map(int, input().split())) find(n, s, a, t)
def find(n, s, a, t): for i in t: tag = 0 for j in s: if j == i: print('YES') tag = 1 break if not tag: print('NO') n = int(input()) s = list(map(int, input().split())) a = int(input()) t = list(map(int, input().split())) find(n, s, a, t)