#include <iostream>
#include <string>
using namespace std;
const int MAX_VALUE = 10000;
void countHours(string line, int totalHours[]) {
int x, y;
sscanf(&line[0], "%*s %d %*s %*s %d", &x, &y);
totalHours[x] += y;
}
int findDiligent(int totalHours[]) {
int numWorker, maxHours = 0;
for (int i = 1; i < MAX_VALUE; ++i) {
if (maxHours < totalHours[i]) {
numWorker = i;
maxHours = totalHours[i];
}
}
return numWorker;
}
int main() {
int n, totalHours[MAX_VALUE + 1] = {0};
string line;
cin >> n;
getline(cin, line);
for (int i = 1; i <= n; ++i) {
getline(cin, line);
countHours(line, totalHours);
}
cout << findDiligent(totalHours);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IE1BWF9WQUxVRSA9IDEwMDAwOwoKdm9pZCBjb3VudEhvdXJzKHN0cmluZyBsaW5lLCBpbnQgdG90YWxIb3Vyc1tdKSB7CiAgICBpbnQgeCwgeTsKICAgIHNzY2FuZigmbGluZVswXSwgIiUqcyAlZCAlKnMgJSpzICVkIiwgJngsICZ5KTsKICAgIHRvdGFsSG91cnNbeF0gKz0geTsKfQoKaW50IGZpbmREaWxpZ2VudChpbnQgdG90YWxIb3Vyc1tdKSB7CiAgICBpbnQgbnVtV29ya2VyLCBtYXhIb3VycyA9IDA7CiAgICBmb3IgKGludCBpID0gMTsgaSA8IE1BWF9WQUxVRTsgKytpKSB7CiAgICAgICAgaWYgKG1heEhvdXJzIDwgdG90YWxIb3Vyc1tpXSkgewogICAgICAgICAgICBudW1Xb3JrZXIgPSBpOwogICAgICAgICAgICBtYXhIb3VycyA9IHRvdGFsSG91cnNbaV07CiAgICAgICAgfQogICAgfQogICAgcmV0dXJuIG51bVdvcmtlcjsKfQoKaW50IG1haW4oKSB7CiAgICBpbnQgbiwgdG90YWxIb3Vyc1tNQVhfVkFMVUUgKyAxXSA9IHswfTsKICAgIHN0cmluZyBsaW5lOwogICAgY2luID4+IG47CiAgICBnZXRsaW5lKGNpbiwgbGluZSk7CiAgICBmb3IgKGludCBpID0gMTsgaSA8PSBuOyArK2kpIHsKICAgICAgICBnZXRsaW5lKGNpbiwgbGluZSk7CiAgICAgICAgY291bnRIb3VycyhsaW5lLCB0b3RhbEhvdXJzKTsKICAgIH0KICAgIGNvdXQgPDwgZmluZERpbGlnZW50KHRvdGFsSG91cnMpOwogICAgcmV0dXJuIDA7Cn0g
NgpNdW5jaXRvcnVsIDQgYSBtdW5jaXQgNCBvcmUKTXVuY2l0b3J1bCAyIGEgbXVuY2l0IDUgb3JlCk11bmNpdG9ydWwgNCBhIG11bmNpdCAxMCBvcmUKTXVuY2l0b3J1bCAzIGEgbXVuY2l0IDE1IG9yZQpNdW5jaXRvcnVsIDkgYSBtdW5jaXQgNjkgb3JlCk11bmNpdG9ydWwgMSBhIG11bmNpdCA3MCBvcmUKCg==
6
Muncitorul 4 a muncit 4 ore
Muncitorul 2 a muncit 5 ore
Muncitorul 4 a muncit 10 ore
Muncitorul 3 a muncit 15 ore
Muncitorul 9 a muncit 69 ore
Muncitorul 1 a muncit 70 ore