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