#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 9;
const double PI = 2 * acos(0.0);
const double eps = 1e-9;
const int NPOS = -1;
const int N = 1e5 + 5;
const int MOD = 1e9 + 7;
template <class T>
inline T mod(T a, T b) {
  return (a % b + b) % b;
}
int m, n, a, b;
map<double, int> freq;
vector<pair<int, pair<int, int>>> v;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> m;
  char c;
  for (int i = 0; i < m; ++i) {
    cin >> c >> a >> c >> b >> c >> c >> n;
    v.push_back(make_pair(n, make_pair(a, b)));
    ++freq[double(a + b) / n];
  }
  for (int i = 0; i < m; ++i)
    cout << freq[double(v[i].second.first + v[i].second.second) / v[i].first]
         << ' ';
  return 0;
}
