#include <bits/stdc++.h>
using namespace std;
const int l = 200000 + 5;
struct p {
  int a, b, c;
} mmp[l];
map<pair<int, int>, int> ss;
pair<int, int> t;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  int T, x, y;
  scanf("%d", &T);
  for (int i = 0; i < T; i++) {
    scanf(" (%d+%d)/%d", &x, &y, &mmp[i].b);
    mmp[i].a = x + y;
    mmp[i].c = gcd(mmp[i].a, mmp[i].b);
    mmp[i].a /= mmp[i].c;
    mmp[i].b /= mmp[i].c;
    t = make_pair(mmp[i].a, mmp[i].b);
    if (!ss.count(t))
      ss.insert(pair<pair<int, int>, int>(t, 1));
    else
      ss[t]++;
  }
  for (int i = 0; i < T; i++) {
    i != 0 ? putchar(' ') : i = i;
    t = make_pair(mmp[i].a, mmp[i].b);
    cout << ss[t];
  }
  putchar('\n');
  return 0;
}
