#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ld = long double;
void solve();
int32_t main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  solve();
  return 0;
}
void solve() {
  int64_t _;
  cin >> _;
  double a[_];
  map<double, int64_t> mp;
  for (int64_t i = 0; i < _; i++) {
    string s;
    cin >> s;
    double f = 0, x = 0, y = 0, z = 0, c = 1;
    int64_t n = s.length();
    for (int64_t i = n - 1; i > 0; i--) {
      if (s[i] == '/') {
        f = 1;
        i--;
        c = 1;
      } else if (s[i] == '+') {
        f = 2;
        c = 1;
      } else if (f == 0) {
        int64_t val = int64_t(s[i]) - int64_t('0');
        x += val * c;
        c *= 10;
      } else if (f == 1) {
        int64_t val = int64_t(s[i]) - int64_t('0');
        y += val * c;
        c *= 10;
      } else if (f == 2) {
        int64_t val = int64_t(s[i]) - int64_t('0');
        z += val * c;
        c *= 10;
      }
    }
    a[i] = (y + z) / x;
    mp[a[i]]++;
  }
  for (int64_t i = 0; i < _; i++) {
    cout << mp[a[i]] << ' ';
  }
  return;
}
