#include <bits/stdc++.h>
using namespace std;
string s;
pair<int, int> x[200001];
int v[4], nr, n;
bool ecifra(char c) { return (c >= '0' && c <= '9'); }
int frq[201][101];
int cmmdc(int a, int b) {
  int t;
  while (b) {
    t = a % b;
    a = b;
    b = t;
  }
  return a;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> s;
    nr = 0;
    v[1] = v[2] = v[3] = 0;
    for (int i = 1; i < s.size(); i++) {
      if (ecifra(s[i]) && !ecifra(s[i - 1])) {
        nr++;
        v[nr] = v[nr] * 10 + s[i] - 48;
      } else if (ecifra(s[i]))
        v[nr] = v[nr] * 10 + s[i] - 48;
    }
    x[i].first = v[1] + v[2];
    x[i].second = v[3];
    int gcd = cmmdc(x[i].first, x[i].second);
    x[i].first /= gcd;
    x[i].second /= gcd;
    frq[x[i].first][x[i].second]++;
  }
  for (int i = 1; i <= n; i++) cout << frq[x[i].first][x[i].second] << " ";
}
