r=raw_input x=r().split();i=1 while 1:print-~(`i`in x)*(r()+"\n"),;i+=1