a,*s=open(0) i=1 for t in s:print(t*-~(str(i)in a.split()),end='');i+=1