#include <bits/stdc++.h>
using namespace std;
map<double, int> vau;
int main() {
  int m;
  cin >> m;
  vector<double> vau2;
  for (int i = 1; i <= m; i++) {
    double a, b, c;
    char q, w, e, r;
    cin >> q >> a >> w >> b >> e >> r >> c;
    double val = (a + b) / c;
    vau[val]++;
    vau2.push_back(val);
  }
  for (int i = 1; i <= m; i++) {
    cout << vau[vau2[i - 1]] << " ";
  }
  cout << endl;
  return 0;
}
