#include <bits/stdc++.h>
using namespace std;
int main() {
  map<float, int> mp;
  int m;
  cin >> m;
  float ck[m];
  for (int i = 0; i < m; i++) {
    char c1, c2, c3, c4;
    float a, b, c;
    cin >> c1 >> a >> c2 >> b >> c3 >> c4 >> c;
    ck[i] = (a + b + 0.0) / (c + 0.0);
    mp[ck[i]]++;
  }
  for (int i = 0; i < m; i++) {
    cout << mp[ck[i]] << '\n';
  }
  return 0;
}
