#include <iostream> #include <vector> #include <algorithm> using namespace std; const int MAX = 3; typedef struct { int idx; int sum; int weightedSum; }Vote; bool cmp(Vote a, Vote b) { if (a.sum > b.sum) { return true; } if (a.sum == b.sum) { if (a.weightedSum > b.weightedSum) { return true; } } return false; } int main(void) { ios_base::sync_with_stdio(0); cin.tie(0); int N; cin >> N; vector<Vote> candidates(3); // 인덱스 부여 for (int i = 0; i < 3; i++) { candidates[i].idx = i + 1; } for (int i = 0; i < N; i++) { for (int j=0; j<3; j++) { int weight; cin >> weight; candidates[j].sum += weight; switch (weight) { case 2: weight *= 10; break; case 3: weight *= 100; break; } candidates[j].weightedSum += weight; } } sort(candidates.begin(), candidates.end(), cmp); if (candidates[0].weightedSum == candidates[1].weightedSum) { cout << 0 << " " << candidates[0].sum << "\n"; return 0; } cout << candidates[0].idx << " " << candidates[0].sum << "\n"; return 0; }