#include <bits/stdc++.h>
using namespace std;
const long long maxn = 0x3f3f3f3f;
long long m;
double D[200100];
map<double, long long> mp;
int main() {
  long long i, j, k;
  scanf("%I64d", &m);
  string s;
  for (i = 1; i <= m; ++i) {
    cin >> s;
    s = s + '#';
    long long len = s.length();
    long long a = 0;
    j = 1;
    while (s[j] >= '0' && s[j] <= '9') {
      a = a * 10 + s[j] - '0';
      ++j;
    }
    long long b = 0;
    ++j;
    while (s[j] >= '0' && s[j] <= '9') {
      b = b * 10 + s[j] - '0';
      ++j;
    }
    ++j;
    ++j;
    long long c = 0;
    while (s[j] >= '0' && s[j] <= '9') {
      c = c * 10 + s[j] - '0';
      ++j;
    }
    D[i] = ((a + b) * 1.0) / (c * 1.0);
    ++mp[D[i]];
  }
  for (i = 1; i <= m; ++i) {
    cout << mp[D[i]] << ' ';
  }
  cout << endl;
  return 0;
}
