#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &r) {
  static char c;
  r = 0;
  int f = 1;
  for (c = getchar(); c < '0' || c > '9'; c = getchar())
    if (c == '-') f = -1;
  for (; c >= '0' && c <= '9';
       r = (r << 1) + (r << 3) + (c ^ 48), c = getchar())
    ;
  r *= f;
}
const int N = 2e5 + 105;
double a[N];
int main() {
  int n;
  scanf("%d", &n);
  map<double, int> ma;
  char c;
  double x = 0, y = 0, z = 0;
  for (int i = 1; i <= n; ++i) {
    getchar();
    scanf("%c%lf%c%lf%c%c%lf", &c, &x, &c, &y, &c, &c, &z);
    a[i] = (x + y) / z;
    ma[a[i]]++;
  }
  for (int i = 1; i <= n; ++i) {
    cout << ma[a[i]] << " ";
  }
}
