m@main=do{a<-g;g>>=putStrLn.f.zipWith(++)a;m} g=fmap words getLine f(x:y)=show(fst$dropWhile((/=x).snd)(zip[1..]y)!!0)++' ':x