#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  map<double, int> mp2;
  map<string, double> mp1;
  vector<string> S;
  while (n--) {
    string x;
    cin >> x;
    S.push_back(x);
    int plus = 0, end = 0;
    double a, b, c;
    for (int i = 1; i < x.size(); i++) {
      if (x[i] == '+') plus = i;
      if (x[i] == ')') end = i;
    }
    a = stod(x.substr(1, plus - 1));
    b = stod(x.substr(plus + 1, end - plus - 1));
    c = stod(x.substr(end + 2, x.size() - end + 2));
    mp1[x] = (a + b) / c;
    mp2[(a + b) / c]++;
  }
  for (auto i : S) {
    cout << mp2[mp1[i]] << " ";
  }
  return 0;
}
