#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (!b) return a;
  return gcd(b, a % b);
}
map<pair<int, int>, int> m;
vector<pair<int, int> > v;
int main() {
  int a, b, c;
  string s;
  int n;
  scanf("%d", &n);
  while (n--) {
    cin >> s;
    for (int i = 0; i < s.size(); i++)
      if (s[i] < '0' || s[i] > '9') s[i] = ' ';
    stringstream second;
    second << s;
    second >> a >> b >> c;
    int up = a + b;
    int gg = gcd(up, c);
    up /= gg;
    c /= gg;
    v.push_back(make_pair(up, c));
    m[make_pair(up, c)]++;
  }
  for (int i = 0; i < v.size(); i++) printf("%d ", m[v[i]]);
  return 0;
}
