#include <stdio.h> int main(void) { int array[500] = { 0 }; int num1, num2, length; scanf("%d", &length); for (int i = 0; i < length; i++) { scanf("%d %d", &num1, &num2); array[num1] += num2; } for (int i = 0; i < 500; i++) if(array[i]) printf("%d %d\r\n", i, array[i]); return 0; }