#include <bits/stdc++.h>
using namespace std;
map<double, long long> cnt;
string p[300005];
double solve(string s) {
  double t = 0;
  if (s[2] == '+') {
    t += (double)s[1] - 48;
    if (s[4] == ')') {
      t += (double)s[3] - 48;
    } else {
      t += ((double)s[3] - 48) * 10 + (double)s[4] - 48;
    }
  } else {
    t += ((double)s[1] - 48) * 10 + (double)s[2] - 48;
    if (s[5] == ')') {
      t += (double)s[4] - 48;
    } else {
      t += ((double)s[4] - 48) * 10 + (double)s[5] - 48;
    }
  }
  if (s[s.length() - 2] == '/') {
    t /= (double)s[s.length() - 1] - 48;
  } else {
    t /= ((double)s[s.length() - 2] - 48) * 10 +
         ((double)s[s.length() - 1] - 48);
  }
  return t;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  double m;
  cin >> m;
  for (long long i = 0; i < m; i++) {
    string s;
    cin >> s;
    p[i] = s;
    cnt[solve(s)]++;
  }
  for (long long i = 0; i < m; i++) {
    cout << cnt[solve(p[i])] << ' ';
  }
  return 0;
}
