#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}
int main() {
  long long int n;
  cin >> n;
  long long int i, j;
  long long int num[n];
  long long int den[n];
  long long int arr[500][500];
  for (i = 0; i < 500; i++) {
    for (j = 0; j < 500; j++) arr[i][j] = 0;
  }
  for (i = 0; i < n; i++) {
    char temp1;
    cin >> temp1;
    long long int a, b;
    cin >> a;
    char temp2;
    cin >> temp2;
    cin >> b;
    num[i] = a + b;
    char temp3;
    cin >> temp3;
    char temp4;
    cin >> temp4;
    cin >> den[i];
    long long int x = gcd(num[i], den[i]);
    num[i] = num[i] / x;
    den[i] = den[i] / x;
    arr[num[i]][den[i]]++;
  }
  for (i = 0; i < n; i++) {
    cout << arr[num[i]][den[i]] << " ";
  }
}
