#include <bits/stdc++.h>
using namespace std;
map<double, long long int> m1, m2;
map<long long int, long long int>::iterator itr, itr1, itr2;
double num[200005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  for (long long int i = 1; i <= n; i++) {
    string str;
    cin >> str;
    vector<long long int> v1;
    long long int pos = 1;
    while (str[pos] != '+') {
      v1.push_back(str[pos] - '0');
      pos++;
    }
    vector<long long int> v2;
    pos++;
    while (str[pos] != ')') {
      v2.push_back(str[pos] - '0');
      pos++;
    }
    pos += 2;
    vector<long long int> v3;
    while (pos < str.size()) {
      v3.push_back(str[pos] - '0');
      pos++;
    }
    double a = 0, b = 0, c = 0;
    if (v1.size() == 2)
      a = 10 * v1[0] + v1[1];
    else
      a = v1[0];
    if (v2.size() == 2)
      b = 10 * v2[0] + v2[1];
    else
      b = v2[0];
    if (v3.size() == 2)
      c = 10 * v3[0] + v3[1];
    else
      c = v3[0];
    double ans = 1.0 * (a + b) / (c * 1.0);
    m1[ans]++;
    num[i] = ans;
  }
  for (long long int i = 1; i <= n; i++) cout << m1[num[i]] << " ";
  cout << endl;
  return 0;
}
