#include <bits/stdc++.h>
using namespace std;
const int inf = 2e9;
const long long INF = 4e17;
const int mod = 1e9 + 7;
const double eps = 1e-9;
map<double, int> mp;
struct data {
  double x;
  int a, b, c;
} arr[200010];
int main() {
  int m;
  scanf("%d", &m);
  getchar();
  for (int i = 0; i < m; i++) {
    char s[20];
    scanf(" %s", s);
    int len = strlen(s), ptr, a = 0, b = 0, c = 0;
    for (ptr = 1; ptr < len; ptr++) {
      if (s[ptr] == '+') break;
      a = a * 10 + s[ptr] - '0';
    }
    ptr++;
    for (; ptr < len; ptr++) {
      if (s[ptr] == ')') break;
      b = b * 10 + s[ptr] - '0';
    }
    ptr += 2;
    for (; ptr < len; ptr++) c = c * 10 + s[ptr] - '0';
    arr[i].a = a, arr[i].b = b, arr[i].c = c;
  }
  for (int i = 0; i < m; i++) {
    arr[i].x = (arr[i].a + arr[i].b) / (double)(arr[i].c);
    mp[arr[i].x]++;
  }
  for (int i = 0; i < m; i++) {
    printf("%d ", mp[arr[i].x]);
  }
  return 0;
}
