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