#include <bits/stdc++.h>
using namespace std;
template <typename _Tp>
inline _Tp read(_Tp& x) {
  char c11 = getchar(), ob = 0;
  x = 0;
  while (c11 ^ '-' && !isdigit(c11)) c11 = getchar();
  if (c11 == '-') c11 = getchar(), ob = 1;
  while (isdigit(c11)) x = x * 10 + c11 - '0', c11 = getchar();
  if (ob) x = -x;
  return x;
}
double num[200005];
map<double, int> mp;
int main() {
  int n;
  scanf("%d", &n);
  int a, b, c;
  for (int i = 1; i <= n; i++) {
    read(a);
    read(b);
    read(c);
    num[i] = (double)(a + b) / c;
    mp[num[i]]++;
  }
  for (int i = 1; i <= n; i++) {
    printf("%d%c", mp[num[i]], i == n ? '\n' : ' ');
  }
  return 0;
}
