#include <bits/stdc++.h>
using namespace std;
int n, Smax, p;
vector<pair<double, int> > a;
vector<int> rez;
int main() {
  char c[101];
  cin >> n;
  a = vector<pair<double, int> >(n + 2);
  rez = vector<int>(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> c;
    int l = strlen(c), nr1, nr2, nr3, ok1, ok2;
    nr1 = nr2 = nr3 = ok1 = ok2 = 0;
    for (int j = 1; j < l; j++) {
      if (c[j] >= '0' && c[j] <= '9') {
        if (ok1 == 0)
          nr1 = nr1 * 10 + c[j] - '0';
        else if (ok2 == 0)
          nr2 = nr2 * 10 + c[j] - '0';
        else
          nr3 = nr3 * 10 + c[j] - '0';
      } else if (c[j] == '+')
        ok1 = 1;
      else if (c[j] == '/')
        ok2 = 1;
    }
    a[i].first = 1.00 * (nr1 + nr2) / nr3;
    a[i].second = i;
  }
  sort(a.begin() + 1, a.end() - 1);
  a[n + 1].first = -1;
  int l = 1;
  for (int i = 2; i <= n + 1; i++) {
    if (a[i].first == a[i - 1].first)
      l++;
    else {
      for (int j = i - l; j < i; j++) rez[a[j].second] = l;
      l = 1;
    }
  }
  for (int i = 1; i <= n; i++) cout << rez[i] << ' ';
  return 0;
}
