r=raw_input;a=r().split() while 1:print-~a.index(r())