#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  float a, b, c;
  char ch1, ch2, ch3, ch4;
  cin >> n;
  vector<float> res(n);
  vector<long long> sum(n, 0);
  map<float, long long> mapec;
  for (long long i = 0; i < n; ++i) {
    cin >> ch1 >> a >> ch2 >> b >> ch3 >> ch4 >> c;
    res[i] = (a + b) / c;
    ++mapec[res[i]];
  }
  for (long long i = 0; i < n; ++i) cout << mapec[res[i]] << " ";
}
