l=dict([i.split()for i in open(0).readlines()[1:]]) for i in sorted(l.keys()):print(i,l[i])