#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
const int NMax = 1e2 + 5;
const ll inf_ll = 1e18 + 5;
const int inf_int = 1e9 + 5;
const int mod = 100003;
using zint = int;
void getABC(char* sir, int& a, int& b, int& c) {
  ++sir;
  a = 0;
  while (isdigit(*sir)) {
    a = a * 10 + *sir - '0';
    ++sir;
  }
  ++sir;
  b = 0;
  while (isdigit(*sir)) {
    b = b * 10 + *sir - '0';
    ++sir;
  }
  ++sir;
  ++sir;
  c = 0;
  while (*sir != 0 && isdigit(*sir)) {
    c = c * 10 + *sir - '0';
    ++sir;
  }
}
int euclid(int a, int b) { return b ? euclid(b, a % b) : a; }
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  char sir[100];
  map<pair<int, int>, int> make_pair;
  vector<pair<int, int>> v(N + 1);
  for (int i = 1; i <= N; ++i) {
    cin >> sir;
    int a, b, c;
    getABC(sir, a, b, c);
    int top = a + b;
    int gcd = euclid(top, c);
    top /= gcd;
    c /= gcd;
    make_pair[{top, c}]++;
    v[i] = {top, c};
  }
  for (int i = 1; i <= N; ++i) {
    cout << make_pair[v[i]] << ' ';
  }
  return 0;
}
