#include <bits/stdc++.h>
using namespace std;
const int MAX = 200005;
int n;
double a, b, c;
double B[MAX];
map<double, int> mmp;
int main() {
  cin >> n;
  getchar();
  for (int i = 1; i <= n; ++i) {
    scanf("(%lf+%lf)/%lf", &a, &b, &c);
    getchar();
    B[i] = (a + b) / c;
    mmp[B[i]] = 0;
  }
  for (int i = 1; i <= n; ++i) {
    int cnt = 0;
    if (mmp[B[i]]) {
      printf("%d ", mmp[B[i]]);
      continue;
    }
    for (int j = 1; j <= n; ++j)
      if (B[i] == B[j]) cnt++;
    mmp[B[i]] = cnt;
    printf("%d ", cnt);
  }
  return 0;
}
