#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long a = 0;
  int b = 1, c;
  while (((c = fgetc(stdin)) > '9' || c < '0') && c != '-')
    ;
  if (c == '-') b = -1, c = fgetc(stdin);
  while (c >= '0' && c <= '9') a = a * 10 + c - '0', c = fgetc(stdin);
  return a * b;
}
char s[105];
int a[200005], b[200005], c[200005];
map<double, int> cnt;
int main() {
  int n;
  n = read();
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    sscanf(s, "(%d+%d)/%d", a + i, b + i, c + i);
    cnt[(double)(a[i] + b[i]) / c[i]]++;
  }
  for (int i = 0; i < n; i++) {
    printf("%d%c", cnt[(double)(a[i] + b[i]) / c[i]], " \n"[i + 1 == n]);
  }
  return 0;
}
