#include <bits/stdc++.h>
using namespace std;
map<double, int> mp;
vector<double> v;
int main() {
  char s[20];
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    double a = 0, b = 0, c = 0;
    int j = 0;
    while (s[++j] != '+') {
      a = a * 10 + (s[j] - '0');
    }
    while (s[++j] != ')') {
      b = b * 10 + (s[j] - '0');
    }
    j++;
    while (s[++j] != '\0') {
      c = c * 10 + (s[j] - '0');
    }
    a = (a + b) / c;
    mp[a]++;
    v.push_back(a);
  }
  for (int i = 0; i < v.size(); i++) {
    cout << mp[v[i]] << " ";
  }
  return 0;
}
