var s,t:string(999)=^j;begin repeat readln(t);t:=t+^j;insert(t,s,pos(t,s)+ord(pos(t,s)=0)*length(s))until eof;write(s)end.