#pragma GCC optimize(2, 3, "Ofast", "inline")
#include <bits/stdc++.h>\
#define endl '\n'
using namespace std;
vector<vector<string>> Hash_t(101,vector<string>(8));
unsigned int BKDRHash(string str)
{
unsigned int seed = 131; // 31 131 1313 13131 131313等质数
unsigned int hash = 0;
for(int i=0;i<str.size();i++)
{
hash = hash * seed + (str[i]);
}
return (hash & 0x7FFFFFFF);
}
void work()
{
int n;
cin>>n;
string s;
for(int i=0;i<n;i++)
{
for(int j=0;j<8;j++)
{
cin>>s;
// int index=BKDRHash(s);
Hash_t[i][j]=s;
}
}
for(int i=0;i<n;i++)
{
int cnt=1;
for(int j=0;j<i;j++)
{
bool is_same=true;
for(int m=0;m<8;m++)
{
if(Hash_t[i][m]!=Hash_t[j][m])
{
is_same=false;
break;
}
}
if(is_same)
{
cnt+=1;
}
}
cout<<cnt<<endl;
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
work();
return 0;
}