#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  long double tp, temp, temp2, div;
  vector<long double> v;
  map<long double, long long int> mp;
  string in;
  double storage;
  cin >> t;
  while (t--) {
    cin >> in;
    storage = 0;
    temp = -1;
    temp2 = -1;
    for (int a1 = 0; a1 < in.size(); a1++) {
      if (isdigit(in[a1])) {
        storage *= 10;
        storage += in[a1] - '0';
      } else {
        if (storage != 0) {
          if (temp == -1) {
            temp = storage;
            storage = 0;
            continue;
          } else if (temp2 == -1) {
            temp2 = storage;
            storage = 0;
            continue;
          }
        }
      }
    }
    div = storage;
    tp = (temp + temp2) / div;
    v.push_back(tp);
    mp[tp]++;
  }
  for (int a1 = 0; a1 < v.size(); a1++) {
    if (a1 != v.size() - 1)
      cout << mp[v[a1]] << " ";
    else
      cout << mp[v[a1]] << endl;
  }
}
