#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  long double tmp, tmp2, tmp3, ind;
  map<long double, int> mp;
  cin >> n;
  string arr[n], s;
  long double arr2[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    s = arr[i], tmp = 0, tmp2 = 0, tmp3 = 0;
    ind = 1;
    for (ind; s[ind] != '+'; ind++) {
      tmp *= 10, tmp += (s[ind] - '0');
    }
    ind++;
    for (ind; s[ind] != ')'; ind++) {
      tmp2 *= 10, tmp2 += (s[ind] - '0');
    }
    ind += 2;
    for (ind; ind < s.size(); ind++) {
      tmp3 *= 10, tmp3 += (s[ind] - '0');
    }
    arr2[i] = (tmp + tmp2) / tmp3;
    mp[(tmp + tmp2) / tmp3]++;
  }
  for (int i = 0; i < n; i++) cout << mp[arr2[i]] << " ";
  return 0;
}
