https://www.acmicpc.net/problem/1920
n = int(input())
n_list = list(map(int, input().split()))
m = int(input())
m_list = list(map(int, input().split()))
n_set = set(n_list)
for i in range(m):
if m_list[i] in n_set:
print(1)
else:
print(0)
n = int(input())
array = set(map(int, input().split()))
m = int(input())
x = list(map(int, input().split()))
for i in x:
if i not in array:
print('0')
else:
print('1')