#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
using namespace std;
char ch[110];
int n, X[200010], second[200010];
map<int, int> mp[200010];
int gcd(int a, int b) {
  while (a) {
    int c = a;
    a = b % a;
    b = c;
  }
  return b;
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    int x, y, z;
    scanf("(%d+%d)/%d\n", &x, &y, &z);
    X[i] = x + y;
    second[i] = z;
    long long GCD = gcd(X[i], second[i]);
    X[i] /= GCD;
    second[i] /= GCD;
    mp[X[i]][second[i]]++;
  }
  for (int i = 1; i <= n; i++) cout << mp[X[i]][second[i]] << " ";
  return 0;
}
