#include <bits/stdc++.h>
using namespace std;
struct eth {
  int a, b;
  bool operator<(const eth &other) const { return a * other.b < b * other.a; }
  bool operator==(const eth &other) const { return a * other.b == b * other.a; }
};
int N;
map<eth, int> qtt;
eth arr[200009];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N;
  int a, b, c;
  char d;
  for (int i = 0; i < N; ++i) {
    cin >> d >> a >> d >> b >> d >> d >> c;
    arr[i] = eth{a + b, c};
    qtt[eth{a + b, c}]++;
  }
  for (int i = 0; i < N; ++i) {
    cout << qtt[arr[i]] << " \n"[i == N - 1];
  }
}
