#include<bits/stdc++.h>
using namespace std;
struct node{
int a,b,c,f,ab,mab;
int tot,rank;
bool ifcp;
}a[100010];
bool cmp(node x,node y){
if(x.f>y.f) return true;
else if(x.f<y.f) return false;
else{
if(x.ab>y.ab){
return true;
}else if(x.ab<y.ab) return false;
else{
if(x.mab>y.mab){
return true;
}else if(x.mab<y.mab) return false;
else {
x.ifcp=true;
y.ifcp=true;
}
}
}
}
bool cmp2(node x,node y){
if(x.tot<y.tot) return true;
return false;
}
int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++) a[i].ifcp=false;
for(int i=1;i<=n;i++) {
cin>>a[i].a>>a[i].b>>a[i].c;
a[i].f=a[i].a+a[i].b+a[i].c;
a[i].tot=i;
a[i].ab=a[i].a+a[i].b;
a[i].mab=max(a[i].a,a[i].b);
}
sort(a+1,a+1+n,cmp);
for(int i=1,id=1;i<=n;i++) {
if(a[i-1].ifcp==false){
a[i].rank=id++;
}else{
a[i].rank=a[i-1].rank;
id++;
}
}
sort(a+1,a+1+n,cmp2);
for(int i=1;i<=n;i++){
cout<<a[i].rank<<'\n';
}
return 0;
}