while True: try: n = int(input()) a = [] for i in range(n): a.append(list(map(int,input().split()))) b = [] for i in a: b.append(i[0]) c = [] for i in sorted(list(set(b))): value = 0 for j in a: if i == j[0]: value+=j[1] c.append([str(i),str(value)]) print(' '.join([str(i),str(value)])) except: brea...