#include <bits/stdc++.h>
using namespace std;
class Val {
 public:
  int indx;
  int value;
  Val(int indx, int value) {
    this->indx = indx;
    this->value = value;
  }
  bool operator<=(const Val& rhs) const { return value <= rhs.value; }
};
map<double, int> vau;
int main() {
  int m;
  cin >> m;
  vector<double> vau2;
  for (int i = 1; i <= m; i++) {
    double a, b, c;
    char q, w, e, r;
    cin >> q >> a >> w >> b >> e >> r >> c;
    double val = (a + b) / c;
    vau[val]++;
    vau2.push_back(val);
  }
  for (int i = 1; i <= m; i++) {
    cout << vau[vau2[i - 1]] << " ";
  }
  cout << endl;
  return 0;
}
