#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  getchar();
  vector<double> v;
  map<double, int> mp;
  for (int i = 0; i < n; i++) {
    char d;
    double a, b, c;
    scanf("%c%lf%c%lf%c%c%lf", &d, &a, &d, &b, &d, &d, &c);
    getchar();
    v.push_back((a + b) / c);
    mp[v[i]]++;
  }
  for (auto it = v.begin(); it != v.end(); it++) {
    printf("%d ", mp.find(*it)->second);
  }
  printf("\n");
  return 0;
}
