#include <bits/stdc++.h>
using namespace std;
map<double, int> m;
double vis[200020];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    char c1, c2, c3, c4;
    int a, b, c;
    cin >> c1 >> a >> c2 >> b >> c3 >> c4 >> c;
    vis[i] = ((double)(a + b)) / c * 1.0;
    m[vis[i]]++;
  }
  for (int i = 0; i < n; i++) cout << m[vis[i]] << " ";
  cout << endl;
  return 0;
}
