Python
import sys
s = int(sys.stdin.readline().rstrip())
s_list = list(map(int, sys.stdin.readline().rstrip().split()))
d = int(sys.stdin.readline().rstrip())
d_list = list(map(int, sys.stdin.readline().rstrip().split()))
noHave = (set(d_list)-set(s_list))
answer = [1]*d
for i in range(len(d_list)):
if d_list[i] in noHave:
answer[i] = 0
print(*answer)