#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int score[10001][7]={};//第0项语文 第1项数学 第2项英语 第3项三科总分 第4项语数总分 第5项语数最高 第6项排名
int t[10001][3]={};
for(int i=0;i<n;i++){
cin>>score[i][0]>>score[i][1]>>score[i][2];
t[i][0]=score[i][0];
t[i][1]=score[i][1];
t[i][2]=score[i][2];
score[i][3]=score[i][0]+score[i][1]+score[i][2];
score[i][4]=score[i][0]+score[i][1];
score[i][5]=max(score[i][0],score[i][1]);
}
for(int i=0;i<n-1;i++){
for(int j=0;j<n-1;j++){
if(score[j][3]<score[j+1][3]){
swap(score[j][0],score[j+1][0]);
swap(score[j][1],score[j+1][1]);
swap(score[j][2],score[j+1][2]);
swap(score[j][3],score[j+1][3]);
swap(score[j][4],score[j+1][4]);
swap(score[j][5],score[j+1][5]);
}
else if(score[j][3]==score[j+1][3]){
if(score[j][4]<score[j+1][4]){
swap(score[j][0],score[j+1][0]);
swap(score[j][1],score[j+1][1]);
swap(score[j][2],score[j+1][2]);
swap(score[j][3],score[j+1][3]);
swap(score[j][4],score[j+1][4]);
swap(score[j][5],score[j+1][5]);
}
else if(score[j][4]==score[j+1][4]){
if(score[j][5]<score[j+1][5]){
swap(score[j][0],score[j+1][0]);
swap(score[j][1],score[j+1][1]);
swap(score[j][2],score[j+1][2]);
swap(score[j][3],score[j+1][3]);
swap(score[j][4],score[j+1][4]);
swap(score[j][5],score[j+1][5]);
}
}
}
}
}
int p=2;
score[0][6]=1;
for(int i=1;i<n;i++){
if(score[i][3]!=score[i-1][3]||score[i][4]!=score[i-1][4]||score[i][5]!=score[i-1][5]){
p=i+1;
score[i][6]=p;
}
else{
score[i][6]=p;
}
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(t[i][0]==score[j][0]&&t[i][1]==score[j][1]&&t[i][2]==score[j][2]){
cout<<score[j][6]<<endl;
break;
}
}
}
return 0;
}