a=[] while 1:a+=[x[len(a)]for x in a]+raw_input().split(),;print' '.join(a[-1])