#include <bits/stdc++.h>
using namespace std;
string s[200100];
map<float, int> mp;
void make_number(string s1, int *a, int *b, int *c) {
  int i;
  int n1 = s1.length();
  bool ok = 0;
  for (i = 0; s1[i] != '/'; i++) {
    if (s1[i] == '+') ok = 1;
    if (!ok) {
      if (s1[i] >= '0' && s1[i] <= '9') *a = (*a) * 10 + s1[i] - '0';
    } else {
      if (s1[i] >= '0' && s1[i] <= '9') *b = (*b) * 10 + s1[i] - '0';
    }
  }
  for (int j = i + 1; j < n1; j++)
    if (s1[j] >= '0' && s1[j] <= '9') *c = (*c) * 10 + s1[j] - '0';
}
int main() {
  int n, x, y, z;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
    x = z = y = 0;
    make_number(s[i], &x, &y, &z);
    mp[(((x + y) * 1.0) / z)]++;
  }
  for (int i = 1; i <= n; i++) {
    x = y = z = 0;
    make_number(s[i], &x, &y, &z);
    cout << mp[(((x + y) * 1.0) / z)] << " ";
  }
  return 0;
}
