#include <stdio.h> int main(){ // 初始化数组 int arr[10000]; for (int i=0;i<10000;i++){arr[i]=0;} int N; int a,b,c; if (scanf("%d",&N)!=EOF){ for (int j=0;j<N;j++){ if (scanf("%d-%d %d",&a,&b,&c)!=EOF){ arr[a] = arr[a] + c; } } int max=0; for (int j=0;j<10000;j++){if (arr[j]>max){max=arr[j];}} for (int j=0;j<10000;j++){ if (arr[j]==max){ printf("%d %d",j,max); }} } return 0; }