#include <bits/stdc++.h>
using namespace std;
int read() {
  char ch = getchar();
  int x = 0, f = 1;
  for (; ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') f = -1;
  for (; ch >= '0' && ch <= '9'; ch = getchar())
    x = (x << 1) + (x << 3) - '0' + ch;
  return x * f;
}
struct data {
  int x, y;
  bool operator<(data b) const { return x * b.y < y * b.x; }
} x[220000];
map<data, int> mp;
int m;
int a, b, c;
int main() {
  scanf("%d", &m);
  for (int i = 1; i <= m; ++i) {
    a = read();
    b = read();
    c = read();
    x[i].x = a + b;
    x[i].y = c;
    ++mp[x[i]];
  }
  for (int i = 1; i <= m; ++i) printf("%d ", mp[x[i]]);
  puts("");
  return 0;
}
