p=[] P=p.pop while 1: for c in raw_input():exec'p+=[%s]'%['c','c+P()+" "','P(-2)+P()+c'][ord(c)%3] print P()