#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, c;
  double arr[200005];
  map<double, int> mp;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    getchar();
    scanf("(%d+%d)/%d", &a, &b, &c);
    arr[i] = (double)(a + b) / (double)c;
    mp[arr[i]]++;
  }
  for (int i = 0; i < n - 1; i++) {
    printf("%d ", mp[arr[i]]);
  }
  printf("%d\n", mp[arr[n - 1]]);
  return 0;
}
