var line='' var arr=[] var res={}
while(line=readline()){ arr=line.split(' ') if(arr[1]){
if(res[arr[0]]!==undefined){
res[arr[0]]+=parseInt(arr[1])
}
else{ res[arr[0]]=parseInt(arr[1]) }
}
} res for(let key in res){ console.log(key+' '+res[key]) }