#include <bits/stdc++.h>
using namespace std;
double pie = 3.14159265358979323846;
long long int M = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int T, n, i, j, k = 0, m, j1, co = 0, check, mi, l, sum;
  long long int ans = 0;
  cin >> T;
  double a[T];
  map<double, long long int> ma;
  for (i = 0; i < T; i++) {
    string s, s1, s2, s3;
    cin >> s;
    n = s.length();
    long long int x;
    for (j = 1; j < n; j++) {
      if (isdigit(s[j])) {
        s1.push_back(s[j]);
      } else {
        x = j + 1;
        break;
      }
    }
    for (j = x; j < n; j++) {
      if (isdigit(s[j])) {
        s2.push_back(s[j]);
      } else {
        x = j + 2;
        break;
      }
    }
    for (j = x; j < n; j++) {
      if (isdigit(s[j])) {
        s3.push_back(s[j]);
      } else
        break;
    }
    double x1, x2, x3;
    x1 = stod(s1);
    x2 = stod(s2);
    x3 = stod(s3);
    a[i] = ((double)x1 + x2) / x3;
    ma[a[i]]++;
  }
  for (i = 0; i < T; i++) {
    cout << ma[a[i]] << " ";
  }
  cout << endl;
}
