var j:word;s,t,u,v:string=^`;begin readln(t);repeat inc(j);str(j,u);readln(s);if pos(v+u+v,v+t+v)>0then s:=s+^j+s;writeln(s)until 1=0end.