p=' ' t=eval("[p]*201,"*30) y=20;x=-1 for e in raw_input():y-=cmp(e,p);x+=1;t[y][x]=p=e for r in t: e=`r`[2::5].rstrip() if e:print e