#include <bits/stdc++.h>
using namespace std;
class Debugger {
 public:
  Debugger(const std::string& _separator = ", ")
      : first(true), separator(_separator) {}
  template <typename ObjectType>
  Debugger& operator,(const ObjectType& v) {
    if (!first) cerr << separator;
    cerr << v;
    first = false;
    return *this;
  }
  ~Debugger() { cerr << "\n"; }

 private:
  bool first;
  string separator;
};
template <typename T1, typename T2>
inline ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
inline ostream& operator<<(ostream& os, const vector<T>& v) {
  bool first = true;
  os << "[";
  for (unsigned long long i = 0; i < v.size(); i++) {
    if (!first) os << ", ";
    os << v[i];
    first = false;
  }
  return os << "]";
}
template <typename T>
inline ostream& operator<<(ostream& os, const set<T>& v) {
  bool first = true;
  os << "[";
  for (typename set<T>::const_iterator ii = v.begin(); ii != v.end(); ++ii) {
    if (!first) os << ", ";
    os << *ii;
    first = false;
  }
  return os << "]";
}
template <typename T1, typename T2>
inline ostream& operator<<(ostream& os, const map<T1, T2>& v) {
  bool first = true;
  os << "[";
  for (typename map<T1, T2>::const_iterator ii = v.begin(); ii != v.end();
       ++ii) {
    if (!first) os << ", ";
    os << *ii;
    first = false;
  }
  return os << "]";
}
long long n;
string stroka[300000];
map<long double, long long> used;
long double res(string stroka) {
  long long numberone = (stroka[1] - '0');
  long long i;
  long long numbertwo;
  for (i = 2; i < stroka.size(); i++) {
    if (!isdigit(stroka[i]))
      break;
    else
      numberone = numberone * 10 + (stroka[i] - '0');
  }
  i++;
  numbertwo = (stroka[i] - '0');
  i++;
  for (; i < stroka.size(); i++) {
    if (!isdigit(stroka[i]))
      break;
    else
      numbertwo = numbertwo * 10 + (stroka[i] - '0');
  }
  i++;
  i++;
  long long numberthree = (stroka[i] - '0');
  i++;
  for (; i < stroka.size(); i++) {
    if (!isdigit(stroka[i]))
      break;
    else
      numberthree = numberthree * 10 + (stroka[i] - '0');
  }
  long double ans =
      (long double)(numberone + numbertwo) / (long double)numberthree;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  ;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> stroka[i];
    used[res(stroka[i])]++;
  }
  for (long long i = 1; i <= n; i++) {
    cout << used[res(stroka[i])] << " ";
  }
  cout << "\n";
  return 0;
}
