# @Author YoungMinKim
# baekjoon

import sys
a= int(sys.stdin.readline())
X = list(map(int,sys.stdin.readline().split()))
b = int(sys.stdin.readline())
Y = list(map(int,sys.stdin.readline().split()))
dic = {}
for i in X:
    dic[i] = True
for i in Y:
    if i in dic:
        print(1,end=' ')
    else:
        print(0,end=' ')

ce1a471af5d0da8568c43732363a2045ff251258
<mask token>

<mask token>
for i in X:
    dic[i] = True
for i in Y:
    if i in dic:
        print(1, end=' ')
    else:
        print(0, end=' ')

<mask token>
a = int(sys.stdin.readline())
X = list(map(int, sys.stdin.readline().split()))
b = int(sys.stdin.readline())
Y = list(map(int, sys.stdin.readline().split()))
dic = {}
for i in X:
    dic[i] = True
for i in Y:
    if i in dic:
        print(1, end=' ')
    else:
        print(0, end=' ')

import sys
a = int(sys.stdin.readline())
X = list(map(int, sys.stdin.readline().split()))
b = int(sys.stdin.readline())
Y = list(map(int, sys.stdin.readline().split()))
dic = {}
for i in X:
    dic[i] = True
for i in Y:
    if i in dic:
        print(1, end=' ')
    else:
        print(0, end=' ')

# @Author YoungMinKim
# baekjoon

import sys
a= int(sys.stdin.readline())
X = list(map(int,sys.stdin.readline().split()))
b = int(sys.stdin.readline())
Y = list(map(int,sys.stdin.readline().split()))
dic = {}
for i in X:
    dic[i] = True
for i in Y:
    if i in dic:
        print(1,end=' ')
    else:
        print(0,end=' ')
