N = int(input())
_set = set(map(int, input().split()))
M = int(input())
lst = list(map(int, input().split()))
ans = []
for v in lst:
if v in _set:
ans.append(1)
else:
ans.append(0)
print(*ans)
# 옛날 구대기 코드
from sys import stdin
answer = []
N = int(stdin.readline())
nums = {i: True for i in map(int, stdin.readline().split())}
M = int(stdin.readline())
for i in map(int, stdin.readline().split()):
answer.append(1 if nums.get(i) else 0)
print(*answer)