a=[input()] for s in a:a+=s[1:]or 0in map(print,sorted(a)),