#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 100;
int n;
int x, y, z, g;
int a[N], b[N];
char str[100];
map<pair<int, int>, int> m;
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void fun() {
  int len = strlen(str);
  int i = 1;
  x = y = z = 0;
  while ('0' <= str[i] && str[i] <= '9') x = x * 10 + str[i++] - '0';
  i++;
  while ('0' <= str[i] && str[i] <= '9') y = y * 10 + str[i++] - '0';
  i += 2;
  while (i < len && '0' <= str[i] && str[i] <= '9') z = z * 10 + str[i++] - '0';
}
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 0; i < n; i++) {
      scanf("%s", str);
      fun();
      g = gcd(x + y, z);
      a[i] = (x + y) / g;
      b[i] = z / g;
      m[make_pair(a[i], b[i])]++;
    }
    for (int i = 0; i < n; i++) {
      if (i) putchar(' ');
      printf("%d", m[make_pair(a[i], b[i])]);
    }
    puts("");
  }
  return 0;
}
