#include <bits/stdc++.h>
using namespace std;
const int maxn = 2 * 1e5 + 5;
int main() {
  int n;
  scanf("%d\n", &n);
  map<double, int> str;
  double p[maxn];
  str.clear();
  for (int i = 0; i < n; i++) {
    int a, b, c;
    scanf("(%d+%d)/%d\n", &a, &b, &c);
    p[i] = (double)(a + b) / c;
    str[p[i]]++;
  }
  for (int i = 0; i < n; i++) printf("%d ", str[p[i]]);
  return 0;
}
