#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &x) {
  char c;
  bool nega = 0;
  while ((!isdigit(c = getchar())) && (c != '-'))
    ;
  if (c == '-') {
    nega = 1;
    c = getchar();
  }
  x = c - 48;
  while (isdigit(c = getchar())) x = x * 10 + c - 48;
  if (nega) x = -x;
}
template <typename T>
inline void writep(T x) {
  if (x > 9) writep(x / 10);
  putchar(x % 10 + 48);
}
template <typename T>
inline void write(T x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  writep(x);
}
template <typename T>
inline void writeln(T x) {
  write(x);
  putchar('\n');
}
class rational {
 public:
  long long a, b;
  int id;
  void input(int id) {
    this->id = id;
    int a, b, c;
    read(a);
    read(b);
    read(c);
    this->a = a + b;
    this->b = c;
  }
} r[200001];
int ans[200001];
int n;
int main() {
  read(n);
  for (int i = (1); i <= (n); i++) r[i].input(i);
  sort(r + 1, r + n + 1,
       [](rational A, rational B) { return A.a * B.b < A.b * B.a; });
  for (int i = (1); i <= (n); i++) {
    int j = i;
    while ((j + 1 <= n) && (r[i].a * r[j + 1].b == r[i].b * r[j + 1].a)) j++;
    for (int k = (i); k <= (j); k++) ans[r[k].id] = j - i + 1;
    i = j;
  }
  for (int i = (1); i <= (n); i++) {
    write(ans[i]);
    putchar(" \n"[i == n]);
  }
}
