#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
long long int Max(long long int a, long long int b, long long int c) {
  return max(a, max(c, b));
}
void solve() {
  int N;
  cin >> N;
  unordered_map<double, int> mp;
  vector<double> store(N);
  for (int i = 0; i < N; i++) {
    string st;
    cin >> st;
    int j = 1;
    int A, B, C;
    string T = "";
    while (st[j] != '+') {
      T += st[j];
      j++;
    }
    A = stoi(T);
    j++;
    T = "";
    while (st[j] != ')') {
      T += st[j];
      j++;
    }
    B = stoi(T);
    j += 2;
    T = "";
    while (j < st.length()) {
      T += st[j];
      j++;
    }
    C = stoi(T);
    double value = (A * (1.0) + B * (1.0)) / C;
    mp[value]++;
    store[i] = value;
  }
  for (int i = 0; i < N; i++) {
    cout << mp[store[i]] << ' ';
  }
  cout << endl;
}
int main() {
  bool test = false;
  if (test) {
    int tt;
    cin >> tt;
    while (tt > 0) {
      solve();
      tt--;
    }
  } else {
    solve();
  }
  return 0;
}
