#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m1, n1, n2, nl, m, i, j, sum = 0, p[3];
  vector<double> lp;
  map<double, int> mp;
  cin >> n;
  string s;
  getchar();
  for (j = 0; j < n; j++) {
    getchar();
    getline(cin, s);
    n1 = 0;
    for (i = 0; i < s.length(); i++) {
      if (s[i] >= '0' && s[i] <= '9') {
        sum = 0;
        while (s[i] >= '0' && s[i] <= '9') {
          sum *= 10;
          sum += s[i] - '0';
          i++;
        }
        p[n1] = sum;
        n1++;
      }
    }
    double k = (p[0] + p[1]) / (p[2] * 1.0);
    mp[k]++;
    lp.push_back(k);
  }
  for (int i = 0; i < lp.size(); i++) cout << mp[lp[i]] << " ";
  return 0;
}
