#include <bits/stdc++.h>
using namespace std;
vector<long long> g[1001];
map<int, float> f;
map<float, int> y;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  float a, b, c;
  char x;
  for (long long i = 0; i < n; ++i) {
    cin >> x;
    cin >> a;
    cin >> x;
    cin >> b;
    cin >> x;
    cin >> x;
    cin >> c;
    f[i] = (a + b) / c;
    y[(a + b) / c]++;
  }
  for (long long i = 0; i < n; ++i) cout << y[f[i]] << " ";
  return 0;
}
