#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  long long m = 0;
  cin >> m;
  map<double, long long> we;
  vector<double> v;
  while (m--) {
    char c1, c2, c3, c4;
    long long n1, n2, n3;
    cin >> c1 >> n1 >> c2 >> n2 >> c3 >> c4 >> n3;
    double d = (double)(n1 + n2) / n3;
    we[d]++;
    v.push_back(d);
  }
  for (auto u : v) {
    if (we[u] > 1)
      cout << we[u] << " ";
    else
      cout << "1"
           << " ";
  }
  return 0;
}
