x1 = int(input())
dic = {}
while True:
try:
line = input()
x2 = line.split()
key = int(x2[0])
value = int(x2[1])
if key in dic:
dic[key] += value
else:
dic[key] = value
except:
break
for k,v in sorted(dic.items()):
print(k,v) 


京公网安备 11010502036488号