#include <bits/stdc++.h>
using namespace std;
map<double, long long> mp;
double a[200001];
int main() {
  long long n;
  scanf("%lld", &n);
  long long i;
  double j, k, l, temp;
  for (i = 0; i < n; i++) {
    char c;
    cin >> c >> j;
    cin >> c >> k;
    cin >> c;
    cin >> c >> l;
    temp = (j + k) / l;
    a[i] = temp;
    mp[temp]++;
  }
  for (i = 0; i < n; i++) cout << mp[a[i]] << " ";
  return 0;
}
