#include <bits/stdc++.h>
int32_t gcd(int32_t a, int32_t b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int32_t n;
  std::cin >> n;
  std::map<std::pair<int32_t, int32_t>, int32_t> res_to_num;
  std::pair<int32_t, int32_t>* ordered = new std::pair<int32_t, int32_t>[n];
  for (int32_t i = 0; i < n; i++) {
    std::string expr;
    std::cin >> expr;
    int32_t plus_pos = 0;
    int32_t closing_pos = 0;
    for (int32_t j = 0; j < expr.size(); j++) {
      if (expr[j] == '+') plus_pos = j;
      if (expr[j] == ')') closing_pos = j;
    }
    int32_t a = std::stoi(expr.substr(1, plus_pos));
    int32_t b = std::stoi(expr.substr(plus_pos + 1, closing_pos - plus_pos));
    int32_t c = std::stoi(expr.substr(closing_pos + 2));
    int32_t sum = a + b;
    int32_t gcd_ = gcd(sum, c);
    sum /= gcd_;
    c /= gcd_;
    res_to_num[{sum, c}]++;
    ordered[i] = {sum, c};
  }
  for (int32_t i = 0; i < n; i++) std::cout << res_to_num[ordered[i]] << " ";
  return 0;
}
