import sys
if __name__=="__main__":
inputSlice=list(sys.stdin)
count_=int(inputSlice[0])
map={}
for i in range(count_):
thisItemSlice=inputSlice[i+1].split(" ")
key=thisItemSlice[0]
map[key]=map.get(key,0)+int(thisItemSlice[1])
items=sorted([item for item in map.items()],key=lambda item:int(item[0]))
for item in items:
print(item[0],item[1])

京公网安备 11010502036488号