#include <bits/stdc++.h>
using namespace std;
map<float, int> mp;
float cnt[200005];
int main() {
  int m;
  cin >> m;
  for (int i = 1; i <= m; i++) {
    char s1, s2, s3, s4;
    int a, b, c;
    cin >> s1 >> a >> s2 >> b >> s3 >> s4 >> c;
    cnt[i] = (((a + b) * 1.0) / c);
    mp[cnt[i]]++;
  }
  for (int i = 1; i <= m; i++) {
    if (i == m)
      cout << mp[cnt[i]] << endl;
    else
      cout << mp[cnt[i]] << " ";
  }
}
