while 1: a=[],[] for x in input():min(a,key=sum)[:]+=x, print`a`.replace(' ','')