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