def my_func(data):
res = dict()
pairs = data[1:]
for i in pairs:
ind, ind_value = i.split(" ")
if ind not in res:
res[ind] = ind_value
else:
res[ind] = str(int(res[ind]) + int(ind_value))
temp = sorted(res.items(), key=lambda x :int(x[0]), reverse=False)
for key, value in temp:
print(f"{key} {value}")
data = []
while True:
try:
data.append(input())
except (EOFError, KeyboardInterrupt):
break
my_func(data)



京公网安备 11010502036488号