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