#include <bits/stdc++.h>
using namespace std;
int const N = (int)2e6 + 1, INF = (int)1e9 + 1, MOD = (int)1e9 + 7;
long long mypow(long long a, long long b) {
  long long rv = 1;
  while (b) {
    if (b % 2) rv = rv * a;
    a = a * a;
    b /= 2;
  }
  return rv;
}
bool a1, b1, used[N];
long long n, m, ans, cur, k, p;
string second;
vector<pair<pair<int, int>, int> > v;
map<double, int> ma;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    string second;
    int a, b, c;
    cin >> second;
    a = second[1] - 48;
    if (second[2] != '+') {
      a *= 10;
      a += second[2] - 48;
      b = second[4] - 48;
      if (second[5] != ')') {
        b *= 10;
        b += second[5] - 48;
        c = second[8] - 48;
        if (9 == second.size() - 1) {
          c *= 10;
          c += second[9] - 48;
        }
      } else {
        c = second[7] - 48;
        if (8 == second.size() - 1) {
          c *= 10;
          c += second[8] - 48;
        }
      }
    } else {
      b = second[3] - 48;
      if (second[4] != ')') {
        b *= 10;
        b += second[4] - 48;
        c = second[7] - 48;
        if (8 == second.size() - 1) {
          c *= 10;
          c += second[8] - 48;
        }
      } else {
        c = second[6] - 48;
        if (7 == second.size() - 1) {
          c *= 10;
          c += second[7] - 48;
        }
      }
    }
    v.push_back({{a, b}, c});
    ma[(double)(a + b) / c]++;
  }
  for (auto i : v)
    cout << ma[(double)(i.first.first + i.first.second) / i.second] << " ";
  return 0;
}
