#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long RandInt(long long min, long long max) {
  if (max < min) swap(min, max);
  random_device rd;
  mt19937 mt(rd());
  uniform_int_distribution<long long> dist(min, max);
  return dist(mt);
}
const long long maxn = 3e5, mod = 1e9 + 7, inf = 1e18;
const long double eps = 1e-9, pi = 3.141592653589793238462643;
long long n;
pair<long long, long long> cnt[maxn];
long long gcd(long long a, long long b) {
  while (b) {
    long long c = a % b;
    a = b;
    b = c;
  }
  return a;
}
pair<long long, long long> get(string &s) {
  long long a = 0, b = 0, c;
  long long last = 1;
  a += (s[last++] - '0');
  if (s[last] == '+') {
    ++last;
  } else {
    a *= 10;
    a += (s[last++] - '0');
    last++;
  }
  b = (s[last++] - '0');
  if (s[last] == ')') {
    ++last;
  } else {
    b *= 10;
    b += (s[last++] - '0');
    ++last;
  }
  ++last;
  c = (s[last++] - '0');
  if (last != s.size()) {
    c *= 10;
    c += (s[last] - '0');
  }
  a += b;
  return make_pair(a, c);
}
map<pair<long long, long long>, long long> have;
void solve() {
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    string s;
    cin >> s;
    cnt[i] = get(s);
    long long dd = gcd(cnt[i].first, cnt[i].second);
    cnt[i].first /= dd;
    cnt[i].second /= dd;
    if (have.find(make_pair(cnt[i].first, cnt[i].second)) == have.end()) {
      have[make_pair(cnt[i].first, cnt[i].second)] = 1;
    } else {
      have[make_pair(cnt[i].first, cnt[i].second)]++;
    }
  }
  for (long long i = 0; i < n; ++i) {
    cout << have[make_pair(cnt[i].first, cnt[i].second)] << " ";
  }
}
signed main() {
  srand(time(0));
  cout.precision(10);
  cout << fixed;
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
