#include <bits/stdc++.h>
using namespace std;
map<double, int> cnt;
int n;
double x[200005];
int main() {
  {
    n = 0;
    char ch = 0;
    while (!isdigit(ch)) ch = getchar();
    while (isdigit(ch)) n = (n << 1) + (n << 3) + (ch ^ 48), ch = getchar();
  };
  for (int i = 1; i <= n; i++) {
    int a, b, c;
    {
      a = 0;
      char ch = 0;
      while (!isdigit(ch)) ch = getchar();
      while (isdigit(ch)) a = (a << 1) + (a << 3) + (ch ^ 48), ch = getchar();
    };
    {
      b = 0;
      char ch = 0;
      while (!isdigit(ch)) ch = getchar();
      while (isdigit(ch)) b = (b << 1) + (b << 3) + (ch ^ 48), ch = getchar();
    };
    {
      c = 0;
      char ch = 0;
      while (!isdigit(ch)) ch = getchar();
      while (isdigit(ch)) c = (c << 1) + (c << 3) + (ch ^ 48), ch = getchar();
    };
    x[i] = 1.0 * (a + b) / c;
    cnt[x[i]]++;
  }
  for (int i = 1; i <= n; i++) printf("%d ", cnt[x[i]]);
}
