#ifdef LOCAL
    #define _GLIBCXX_DEBUG
    #define __clock__
#else
    #pragma GCC optimize("Ofast")
#endif
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<ll>;
using VV = vector<VI>;
using VS = vector<string>;
using PII = pair<ll, ll>;

// tourist set
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << '\n'; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
// tourist set end

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,b) FOR(i, 0, b)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<'\n'
#define p2(s, t) cout << (s) << " " << (t) << '\n'
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << '\n'
#define SZ(x) ((int)(x).size())
#define SORT(A) sort(ALL(A))
#define RSORT(A) sort(ALL(A), greater<ll>())
#define MP make_pair
#define p_yes() p("Yes")
#define p_no() p("No")
#define possible() p("Possible")
#define impossible() p("Impossible")

ll SUM(VI& V){
  return accumulate(ALL(V), 0LL);
}

ll MIN(VI& V){return *min_element(ALL(V));}
ll MAX(VI& V){return *max_element(ALL(V));}

void print_vector(VI& V){
  ll n = V.size();
  rep(i, n){
    if(i) cout << ' ';
    cout << V[i];
  }
  cout << endl;
}

ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

// long double
using ld = long double;
#define EPS (1e-14)
#define equals(a,b) (fabs((a)-(b)) < EPS)

int popcount(ll t){
    return __builtin_popcountll(t);
}

void no(){p_no(); exit(0);}
void yes(){p_yes(); exit(0);}

const ll mod = 1e9 + 7;
// const ll mod = 998244353;
const ll inf = 1e18;
const double PI = acos(-1);

// [a/b] (繰り上げ)
ll ceil_div(ll a, ll b){
  return (a+b-1)/b;
}

// snuke's mint
// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
// const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

//#include <atcoder/dsu>
//using namespace atcoder; // 忘れがち

// 構文解析セット
// 参考 https://gist.github.com/draftcode/1357281
struct MyParser{
    typedef string::const_iterator State;
    class ParseError {};

    // 外からはこれを使う
    ll parse(string s){
        State it = s.begin();
        ll ans = expression(it);
        return ans;
    }
    ll number(State &begin) {
        ll ret = 0;
        while (isdigit(*begin)) {
            ret *= 10;
            ret += *begin - '0';
            begin++;
        }
        return ret;
    }
    ll factor(State &begin) {
        if (*begin == '(') {
            begin++; // '('を飛ばす。
            ll ret = expression(begin);
            begin++; // ')'を飛ばす。
            return ret;
        } else {
            return number(begin);
        }
    }
    ll term(State &begin) {
        ll ret = factor(begin);
        for (;;) {
            if (*begin == '*') {
                begin++;
                ret *= factor(begin);
            } else if (*begin == '/') {
                begin++;
                ret /= factor(begin);
            } else {
                break;
            }
        }
        return ret;
    }
    ll expression(State &begin) {
        ll ret = term(begin);
        for (;;) {
            if (*begin == '+') {
                begin++;
                ret += term(begin);
            } else if (*begin == '-') {
                begin++;
                ret -= term(begin);
            } else {
                break;
            }
        }
        return ret;
    }
};
// 構文解析セットおわり
auto pa = MyParser();

ll f(string s){
  return pa.parse(s);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    // input
    ll N;
    cin>>N;

    map<ll,VI> mp;
    rep(i,N){
      string s;cin>>s;
      ll v = f(s);
      mp[v].push_back(i);
    }

    VI Ans(N);
    for(auto pa : mp){
      VI V = pa.second;
      for(ll idx : V){
        Ans[idx] = V.size();
      }
    }
    print_vector(Ans);

    return 0;
}


#ifdef LOCAL
    #define _GLIBCXX_DEBUG
    #define __clock__
#else
    #pragma GCC optimize("Ofast")
#endif
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<ll>;
using VV = vector<VI>;
using VS = vector<string>;
using PII = pair<ll, ll>;

// tourist set
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << '\n'; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
// tourist set end

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,b) FOR(i, 0, b)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<'\n'
#define p2(s, t) cout << (s) << " " << (t) << '\n'
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << '\n'
#define SZ(x) ((int)(x).size())
#define SORT(A) sort(ALL(A))
#define RSORT(A) sort(ALL(A), greater<ll>())
#define MP make_pair
#define p_yes() p("Yes")
#define p_no() p("No")
#define possible() p("Possible")
#define impossible() p("Impossible")

ll SUM(VI& V){
  return accumulate(ALL(V), 0LL);
}

ll MIN(VI& V){return *min_element(ALL(V));}
ll MAX(VI& V){return *max_element(ALL(V));}

void print_vector(VI& V){
  ll n = V.size();
  rep(i, n){
    if(i) cout << ' ';
    cout << V[i];
  }
  cout << endl;
}

ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

// long double
using ld = long double;
#define EPS (1e-14)
#define equals(a,b) (fabs((a)-(b)) < EPS)

int popcount(ll t){
    return __builtin_popcountll(t);
}

void no(){p_no(); exit(0);}
void yes(){p_yes(); exit(0);}

const ll mod = 1e9 + 7;
// const ll mod = 998244353;
const ll inf = 1e18;
const double PI = acos(-1);

// [a/b] (繰り上げ)
ll ceil_div(ll a, ll b){
  return (a+b-1)/b;
}

// snuke's mint
// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
// const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

vector<string> split_str(string s, char c){
    vector<string> ret;
    stringstream ss;
    FOR(i, 0, s.size()){
        if(s[i]==c){
            ret.push_back(ss.str());
            ss.str("");
            ss.clear();
        }else{
            ss << s[i];
        }
    }
    ret.push_back(ss.str());
    return ret;
}

string remove_paren(string s){
  stringstream ss;
  for(char c : s){
    if(c=='(')continue;
    if(c==')')continue;
    ss<<c;
  }
  return ss.str();
}

ll string_to_ll(string s){
  return atoll(s.c_str());
}

PII f(string s){
  auto sep = split_str(s, '/');
  ll mother = string_to_ll(sep[1]); // 分母
  string t = remove_paren(sep[0]);
  auto sep2 = split_str(t,'+');
  ll a = string_to_ll(sep2[0]);
  ll b = string_to_ll(sep2[1]);
  ll v = a+b;
  ll g = gcd(mother,v);
  v /= g;
  mother /= g;
  return {v,mother};
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    // input
    ll N;
    cin>>N;

    map<PII,VI> mp;
    rep(i,N){
      string s;cin>>s;
      auto v = f(s);
      mp[v].push_back(i);
    }

    VI Ans(N);
    for(auto pa : mp){
      VI V = pa.second;
      for(ll idx : V){
        Ans[idx] = V.size();
      }
    }
    print_vector(Ans);

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define rep(i,a,b) for(int i=int(a);i<=int(b);++i)
#define nrep(i,a,b) for(int i=int(a);i>=int(b);--i)
#define trv(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define watch(x) cout<<"\n"<<#x<<" is "<<x<<"\n"
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define pb push_back
#define mt make_tuple
#define eb emplace_back
#define all(A) A.begin(),A.end()
#define chkbit(s, b) (s & (1<<b))
#define mset(A,val) memset(A,val,sizeof(A))
#define leadzero(a) __builtin_clz(a) // count leading zeroes
#define trailzero(a) __builtin_ctz(a) // count trailing zeroes
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<pi> vpi;
typedef vector<string> vs;
typedef vector<vi> vvi;
const int mod=1e9+7;
const int mxN = 1e5+5;
const string ln = "\n";

double parse(string s){
    string a,b,c;
    int i=1;
    a = s[i];
    i++;
    if(s[i] !='+') {
        a = a+s[i];
        i++;
    }
    i++;
    b = s[i];
    i++;
    if(s[i] != ')') {
        b += s[i];
        i++;
    }
    i+=2;
    c = s[i];
    i++;
    if(i < s.length()) {
        c += s[i];
        i++;
    }
    //return 1;
    return double(stoi(a)+stoi(b))/double(stoi(c));
}

void solve(){
	int m;cin>>m;
    string s;
    vs ps(m);
    map<float,int> mp;
    vi a(200,0);
    rep(i,0,m-1){
        cin>>s;
        mp[parse(s)]++;
        ps[i]=s;
    }
    rep(i,0,m-1){
        cout<<mp[parse(ps[i])]<<" ";
    }
    cout<<ln;
}

int main(){
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
}
/*input

*/


#include<bits/stdc++.h>
using namespace std;

#define rep(i,a,b) for(int i=int(a);i<=int(b);++i)
#define nrep(i,a,b) for(int i=int(a);i>=int(b);--i)
#define trv(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define watch(x) cout<<"\n"<<#x<<" is "<<x<<"\n"
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define pb push_back
#define mt make_tuple
#define eb emplace_back
#define all(A) A.begin(),A.end()
#define chkbit(s, b) (s & (1<<b))
#define mset(A,val) memset(A,val,sizeof(A))
#define leadzero(a) __builtin_clz(a) // count leading zeroes
#define trailzero(a) __builtin_ctz(a) // count trailing zeroes
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<pi> vpi;
typedef vector<string> vs;
typedef vector<vi> vvi;
const int mod=1e9+7;
const int mxN = 1e5+5;
const string ln = "\n";

int parse(string s){
    string a,b,c;
    int i=1;
    a = s[i];
    i++;
    if(s[i] !='+') {
        a = a+s[i];
        i++;
    }
    i++;
    b = s[i];
    i++;
    if(s[i] != ')') {
        b += s[i];
        i++;
    }
    i+=2;
    c = s[i];
    i++;
    if(i < s.length()) {
        c += s[i];
        i++;
    }
    //return 1;
    return (stoi(a)+stoi(b))/stoi(c);
}

void solve(){
	int m;cin>>m;
    string s;
    vs ps(m);
    vi a(200,0);
    rep(i,0,m-1){
        cin>>s;
        a[parse(s)]++;
        ps[i]=s;
    }
    rep(i,0,m-1){
        cout<<a[parse(ps[i])]<<" ";
    }
    cout<<ln;
}

int main(){
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
}
/*input
4
(98+99)/97
(26+4)/10
(12+33)/15
(5+1)/7
*/


#include <bits/stdc++.h>
using  namespace std;
const int N=2*10e5+10;
char a , b , b1 ;
int  a1 ,b2 , c;
map <int , double> m1;
map <double , int > m2;
int n;
int main() {
scanf("%d",&n);
for(int j=0; j<n ;++j){
   cin>>a>>a1>>b>>b2>>b1;
   cin>>a>>c;
   double ans=((double)((a1+b2)))/c;
   m1[j] = ans;
   ++m2[ans] ;
  // cout << ans<<" ";
}

for(int i=0; i < n ;++i)
    printf("%d ", m2[m1[i]]);
  return 0;
}


#include <bits/stdc++.h>
using  namespace std;
const int N=2*10e5+10;
char a , b , b1 ;
long long  a1 ,b2 , c;
map <int , double> m1;
map <double , int > m2;
int n;
int main() {
scanf("%d",&n);
for(int j=0; j<n ;++j){
   cin>>a>>a1>>b>>b2>>b1;
   cin>>a>>c;
   double ans=(double)(a1+b2)/c;
   m2[j] = ans;
   m1[ans] ++ ;
}
for(int i=0; i < n ;++i)
     cout<<m1[m2[i]]<<" ";

  return 0;
}


#include <bits/stdc++.h>
using  namespace std;
const int N=2*10e5+10;
char a , b , b1 ;
long long  a1 ,b2 , c;
int fre[N];
vector<int>ve;
int n;
int main() {
scanf("%d",&n);
for(int j=0; j<n ;++j){
   cin>>a>>a1>>b>>b2>>b1;
   cin>>a>>c;
   int ans=(a1+b2)/c;
   fre[ans]++;
   ve.push_back(ans);
}
for(int i=0; i < n ;++i)
     cout<<fre[ve[i]]<<" ";

  return 0;
}


#include <bits/stdc++.h>
using  namespace std;
const int N=2*10e6+10;
char a , b , b1 ;
long long  a1 ,b2 , c;
long long fre[N];
vector<long long>ve;
int n;
int main() {
scanf("%d",&n);
for(int j=0; j<n ;++j){
   cin>>a>>a1>>b>>b2>>b1;
   cin>>a>>c;
   //cout<<a1<<" "<<b2<<" "<<c<<endl;
   long long ans=round((double)(a1+b2)/c);
   fre[ans]++;
   ve.push_back(ans);
}
for(int i=0; i < n ;++i)
     cout<<fre[ve[i]]<<" ";

  return 0;
}


#include <bits/stdc++.h>
using  namespace std;
const int N=2*10e6+10;
char a , b , b1 ;
long long  a1 ,b2 , c;
long long fre[N];
vector<long long>ve;
int n;
int main() {
scanf("%d",&n);
for(int j=0; j<n ;++j){
   cin>>a>>a1>>b>>b2>>b1;
   cin>>a>>c;
   //cout<<a1<<" "<<b2<<" "<<c<<endl;
   long long ans=(a1+b2)/c;
   fre[ans]++;
   ve.push_back(ans);
}
for(int i=0; i < n ;++i)
     cout<<fre[ve[i]]<<" ";

  return 0;
}


#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<stack>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
int m;
char c;
int ans[200005];
int fz[200005],fm[200005];
int gcd(int a,int b){
	if(b==0) return a;
	else return gcd(b,a%b);
}
int Hash[505][505];
int main(){
	cin>>m;
	for(int i=1;i<=m;i++){
		int x,y,z;
	//	cout<<"/";
		//cin>>c>>x>>c>>y>>c>>c>>z;
		scanf("%c%d%c%d%c%c%d",&c,&x,&c,&y,&c,&c,&z);
		scanf("%c%d%c%d%c%c%d",&c,&x,&c,&y,&c,&c,&z);
	//	cout<<"?"<<i<<" "<<x<<" "<<y<<" "<<z<<endl;
		fz[i]=x+y;
		fm[i]=z;
		int p=gcd(fz[i],fm[i]);
		fz[i]/=p;
		fm[i]/=p;
	}
	for(int i=1;i<=m;i++){
		Hash[fz[i]][fm[i]]++;
	}
	for(int i=1;i<=m;i++){
		printf("%d ",Hash[fz[i]][fm[i]]);
	//	cout<<ans[i]+1<<" ";
	}
	return 0;
}


#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<stack>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
int m;
char c;
int ans[200005];
int fz[200005],fm[200005];
int main(){
	cin>>m;
	for(int i=1;i<=m;i++){
		int x,y,z;
	//	cout<<"/";
		//cin>>c>>x>>c>>y>>c>>c>>z;
		scanf("%c%d%c%d%c%c%d",&c,&x,&c,&y,&c,&c,&z);
		scanf("%c%d%c%d%c%c%d",&c,&x,&c,&y,&c,&c,&z);
	//	cout<<"?"<<i<<" "<<x<<" "<<y<<" "<<z<<endl;
		fz[i]=x+y;
		fm[i]=z;
	}
	for(int i=1;i<=m;i++){
		for(int j=i+1;j<=m;j++){
			if(fz[i]*fm[j]==fz[j]*fm[i]){
				ans[i]++;
				ans[j]++;
			}
		}
	}
	for(int i=1;i<=m;i++){
		printf("%d ",ans[i]+1);
	//	cout<<ans[i]+1<<" ";
	}
	return 0;
}


#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<stack>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
int m;
char c;
int p[200005];
int Hash[200005];
int main(){
	cin>>m;
	for(int i=1;i<=m;i++){
		int x,y,z;
	//	cout<<"/";
		cin>>c>>x>>c>>y>>c>>c>>z;
	//	scanf("%c%d%c%d%c%c%d",&c,&x,&c,&y,&c,&c,&z);
	//	scanf("%c%d%c%d%c%c%d",&c,&x,&c,&y,&c,&c,&z);
	//	cout<<"?"<<i<<" "<<x<<" "<<y<<" "<<z<<endl;
		p[i]=(x+y)/z;
		Hash[p[i]]++;
	}
	for(int i=1;i<=m;i++){
		cout<<Hash[p[i]]<<" ";
	}
	return 0;
}


#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<stack>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
int m;
char c;
int ans[200005];
int fz[200005],fm[200005];
int main(){
	cin>>m;
	for(int i=1;i<=m;i++){
		int x,y,z;
	//	cout<<"/";
		//cin>>c>>x>>c>>y>>c>>c>>z;
		scanf("%c%d%c%d%c%c%d",&c,&x,&c,&y,&c,&c,&z);
		scanf("%c%d%c%d%c%c%d",&c,&x,&c,&y,&c,&c,&z);
	//	cout<<"?"<<i<<" "<<x<<" "<<y<<" "<<z<<endl;
		fz[i]=x+y;
		fm[i]=z;
	}
	for(int i=1;i<=m;i++){
		for(int j=1;j<=m;j++){
			if(fz[i]*fm[j]==fz[j]*fm[i])ans[i]++;
		}
	}
	for(int i=1;i<=m;i++){
		cout<<ans[i]<<" ";
	}
	return 0;
}


#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<stack>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
int m;
char c;
int ans[200005];
int fz[200005],fm[200005];
int main(){
	cin>>m;
	for(int i=1;i<=m;i++){
		int x,y,z;
	//	cout<<"/";
		//cin>>c>>x>>c>>y>>c>>c>>z;
		scanf("%c%d%c%d%c%c%d",&c,&x,&c,&y,&c,&c,&z);
		scanf("%c%d%c%d%c%c%d",&c,&x,&c,&y,&c,&c,&z);
	//	cout<<"?"<<i<<" "<<x<<" "<<y<<" "<<z<<endl;
		fz[i]=x+y;
		fm[i]=z;
	}
	for(int i=1;i<=m;i++){
		for(int j=i+1;j<=m;j++){
			if(fz[i]*fm[j]==fz[j]*fm[i]){
				ans[i]++;
				ans[j]++;
			}
		}
	}
	for(int i=1;i<=m;i++){
		cout<<ans[i]+1<<" ";
	}
	return 0;
}


#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<stack>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
int m;
char c;
int ans[200005];
int fz[200005],fm[200005];
int main(){
	cin>>m;
	for(int i=1;i<=m;i++){
		int x,y,z;
	//	cout<<"/";
		cin>>c>>x>>c>>y>>c>>c>>z;
	//	scanf("%c%d%c%d%c%c%d",&c,&x,&c,&y,&c,&c,&z);
	//	scanf("%c%d%c%d%c%c%d",&c,&x,&c,&y,&c,&c,&z);
	//	cout<<"?"<<i<<" "<<x<<" "<<y<<" "<<z<<endl;
		fz[i]=x+y;
		fm[i]=z;
	}
	for(int i=1;i<=m;i++){
		for(int j=1;j<=m;j++){
			if(fz[i]*fm[j]==fz[j]*fm[i])ans[i]++;
		}
	}
	for(int i=1;i<=m;i++){
		cout<<ans[i]<<" ";
	}
	return 0;
}


#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<stack>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
int m;
char c;
int p[200005];
int Hash[200005];
int main(){
	cin>>m;
	for(int i=1;i<=m;i++){
		int x,y,z;
	//	cout<<"/";
		scanf("%c%d%c%d%c%c%d",&c,&x,&c,&y,&c,&c,&z);
		scanf("%c%d%c%d%c%c%d",&c,&x,&c,&y,&c,&c,&z);
	//	cout<<"?"<<i<<" "<<x<<" "<<y<<" "<<z<<endl;
		p[i]=(x+y)/z;
		Hash[p[i]]++;
	}
	for(int i=1;i<=m;i++){
		cout<<Hash[p[i]]<<" ";
	}
	return 0;
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int m;
	cin>>m;
	char x,y,z,w;
	long double a,b,c;
	map<long double,int>q;
	long double A[m];
	for(int i=0;i<m;i++)
	{
		cin>>x>>a>>y>>b>>z>>w>>c;
		A[i]=(a+b)/c;
		if(q.find(A[i])==q.end())
		{
			q[A[i]]=1;
		}
		else
		{
			q[A[i]]++;
		}
	}
	for(int i=0;i<m;i++)
	{
		cout<<q[A[i]]<<" ";
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int m; cin>>m;
    map<long double, int> a;
    long double x,y,z;
    vector<long double>X; vector<long double>Y; vector<long double>Z;
    char p,q,r,s; int t=1;
    while(m--){
        cin>>p>>x>>q>>y>>r>>s>>z;
        if(a[(x+y)/z]>0)a[(x+y)/z]++;
        else a[(x+y)/z]=1;
        //cout<<t<<" "<<(x+y)/z<<endl; t++;
        X.push_back(x); Y.push_back(y); Z.push_back(z);
    }
    // for(int i=0; i<a.size(); i++){
    //     if(a[i]>0)cout<<i<<" "<<a[i]<<endl;
    // }

    for(int i=0; i<X.size(); i++){
        cout<<a[(X[i]+Y[i])/Z[i]]<<" ";
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int m; cin>>m;
    std::vector<int>a(200);
    int x,y,z;
    vector<int>X; vector<int>Y; vector<int>Z;
    char p,q,r,s;
    while(m--){
        cin>>p>>x>>q>>y>>r>>s>>z;
        a[(x+y)/z]++;
        X.push_back(x); Y.push_back(y); Z.push_back(z);
    }
    for(int i=0; i<X.size(); i++){
        cout<<a[(X[i]+Y[i])/Z[i]]<<" ";
    }
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int m;
	cin>>m;
	char x,y,z,w;
	long double a,b,c;
	map<long double,int>q;
	long double A[m];
	for(int i=0;i<m;i++)
	{
		cin>>x>>a>>y>>b>>z>>w>>c;
		A[i]=(a+b)/c;
		cout<<A[i]<<"\n";
		if(q.find(A[i])==q.end())
		{
			q[A[i]]=1;
		}
		else
		{
			q[A[i]]++;
		}
	}
	for(int i=0;i<m;i++)
	{
		cout<<q[A[i]]<<" ";
	}
	return 0;
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int m;
	cin>>m;
	char x,y,z,w;
	double a,b,c;
	map<double,int>q;
	double A[m];
	for(int i=0;i<m;i++)
	{
		cin>>x>>a>>y>>b>>z>>w>>c;
		A[i]=(a+b)/c;
		if(q.find(A[i])==q.end())
		{
			q[A[i]]=1;
		}
		else
		{
			q[A[i]]++;
		}
	}
	for(int i=0;i<m;i++)
	{
		cout<<q[A[i]]<<" ";
	}
	return 0;
}


#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	ll m,i,j;
	cin>>m;
	map<double,ll>ans;
	double arr[m];
	for(j=0;j<m;j++)
	{
		string str;
		cin>>str;
		string str2,str3,str4;
		i=1;
		while(str[i]>='0'&&str[i]<='9')
		{
			str2.push_back(str[i]);
			i++;
		}
		i++;
			while(str[i]>='0'&&str[i]<='9')
		{
			str3.push_back(str[i]);
			i++;
		}
		i++;
		i++;
		while(i<str.length())
		{
			str4.push_back(str[i]);
			i++;
		}
		ll x,y,z;
		x=stoi(str2);
		y=stoi(str3);
		z=stoi(str4);

			double a=x+y;
	a=a*1.0/z;
	//	cout<<x<<" "<<y<<" "<<z<<" "<<a<<endl;
	ans[a]++;
	arr[j]=a;
	}
	double k;
	for(i=0;i<m;i++)
	{
		cout<<ans[arr[i]]<<" ";
	}

}


#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	ll m,i,j;
	cin>>m;
	map<ll,ll>ans;
	ll arr[m];
	for(j=0;j<m;j++)
	{
		string str;
		cin>>str;
		string str2,str3,str4;
		i=1;
		while(str[i]>='0'&&str[i]<='9')
		{
			str2.push_back(str[i]);
			i++;
		}
		i++;
			while(str[i]>='0'&&str[i]<='9')
		{
			str3.push_back(str[i]);
			i++;
		}
		i++;
		i++;
		while(i<str.length())
		{
			str4.push_back(str[i]);
			i++;
		}
		ll x,y,z;
		x=stoi(str2);
		y=stoi(str3);
		z=stoi(str4);

			ll a=x+y;
	a=a/z;
	//	cout<<x<<" "<<y<<" "<<z<<" "<<a<<endl;
	ans[a]++;
	arr[j]=a;
	}
	for(i=0;i<m;i++)
	{
		cout<<ans[arr[i]]<<" ";
	}

}


//Mark XXVI
#include<bits/stdc++.h>

#define big(x) greater<x>()
#define ll long long int
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define deb(x) cerr<<#x<<" : "<<x<<"\n";
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define rep(i,b,c) for(i=b; i<c; ++i)
#define rrep(i,b,c) for(i=b; i>=c; --i)

#define M 998244353
#define LINF 1e18
#define INF INT_MAX
int i,j;
using namespace std;

void solve()
{
  int m;
  cin>>m;
  int a[m];
  map<int,int> mp;
  string s;
  int x,y,z;
  rep(i,0,m)
  {
    cin>>s;
    string temp;
    for(j=1;s[j]!='+';++j) temp+=s[j];
    x=stoi(temp);
    temp="";
    j++;
    while(s[j]!=')') temp+=s[j++];
    y=stoi(temp);
    temp="";
    j+=2;
    while(j<s.size()) temp+=s[j++];
    z=stoi(temp);
    a[i]=(x+y)/z;
    mp[a[i]]++;
  }
  for(auto i:a) cout<<mp[i]<<" ";
}

int main()
{
  //Skipped in presense of online judge.
  #ifndef ONLINE_JUDGE
  freopen("/home/zeddie/Documents/input.txt","r",stdin);
  freopen("/home/zeddie/Documents/output.txt","w",stdout);
  freopen("/home/zeddie/Documents/error.txt","w",stderr);
  #endif

  IOS()
  ll t=1;
  //cin>>t;
  while(t--)
    solve();
}


//Mark XXVI
#include<bits/stdc++.h>

#define big(x) greater<x>()
#define ll long long int
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define deb(x) cerr<<#x<<" : "<<x<<"\n";
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define rep(i,b,c) for(i=b; i<c; ++i)
#define rrep(i,b,c) for(i=b; i>=c; --i)

#define M 998244353
#define LINF 1e18
#define INF INT_MAX
int i,j;
using namespace std;

void solve()
{
  int m;
  cin>>m;
  double a[m];
  map<double,int> mp;
  string s;
  int x,y,z;
  rep(i,0,m)
  {
    cin>>s;
    string temp;
    for(j=1;s[j]!='+';++j) temp+=s[j];
    x=stoi(temp);
    temp="";
    j++;
    while(s[j]!=')') temp+=s[j++];
    y=stoi(temp);
    temp="";
    j+=2;
    while(j<s.size()) temp+=s[j++];
    z=stoi(temp);
    a[i]=(x+y)/double(z);
    mp[a[i]]++;
  }
  for(auto i:a) cout<<mp[i]<<" ",cerr<<i<<" ";
}

int main()
{
  //Skipped in presense of online judge.
  #ifndef ONLINE_JUDGE
  freopen("/home/zeddie/Documents/input.txt","r",stdin);
  freopen("/home/zeddie/Documents/output.txt","w",stdout);
  freopen("/home/zeddie/Documents/error.txt","w",stderr);
  #endif

  IOS()
  ll t=1;
  //cin>>t;
  while(t--)
    solve();
}


#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <stack>
#include <set>
#include <list>
#include <numeric>
#include <sstream>
#include <iomanip>
#include <limits>

#define CLR(a, b) memset(a, (b), sizeof(a))
#define pb push_back

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair<string, int> psi;
typedef pair<string, string> pss;
typedef pair <int, ll> pil;

const double PI = acos(-1.0);
const double E = exp(1.0);
const double eps = 1e-8;

const int INF = 0x3f3f3f3f;
const ll llINF = 0x3f3f3f3f3f3f3f3f;
const int maxn = 2e5 + 5;
const int MOD = 1e9;

int gcd(int x, int y)
{
	int r;
	while (1)
	{
		r = x % y;
		if (r == 0)
			break;
		x = y;
		y = r;
	}
	return y;
}

vector <string> G;

string tran(int x)
{
	string ans = "";
	while (x)
	{
		ans += x % 10 + '0';
		x /= 10;
	}
	return ans;
}

int main()
{
	int n;
	cin >> n;
	int a, b, c;
	map <string, int> m;
	for (int i = 0; i < n; i++)
	{
		//scanf("(%d+%d)/%d", &a, &b, &c);
		getchar();
		getchar();
		scanf("%d", &a);
		getchar();
		scanf("%d", &b);
		getchar();
		getchar();
		scanf("%d", &c);
		a += b;
		b = c;
		c = gcd(a, b);
		a /= c;
		b /= c;
		//printf("%d %d\n", a, b);
		string s = "";
		s += tran(a);
		s += '#';
		s += tran(b);
		//cout << s << endl;
		m[s] ++;
		G.pb(s);

	}
	for (int i = 0; i < n; i++)
	{
		if (i)
			printf(" ");
		printf("%d", m[G[i]]);
	}
	cout << endl;
}


#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <stack>
#include <set>
#include <list>
#include <numeric>
#include <sstream>
#include <iomanip>
#include <limits>

#define CLR(a, b) memset(a, (b), sizeof(a))
#define pb push_back

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair<string, int> psi;
typedef pair<string, string> pss;
typedef pair <int, ll> pil;

const double PI = acos(-1.0);
const double E = exp(1.0);
const double eps = 1e-8;

const int INF = 0x3f3f3f3f;
const ll llINF = 0x3f3f3f3f3f3f3f3f;
const int maxn = 2e5 + 5;
const int MOD = 1e9;

double G[maxn];

int main()
{
	CLR(G, 0);
	int n;
	cin >> n;
	int a, b, c;
	map <double, int> m;
	for (int i = 0; i < n; i++)
	{
		//scanf("(%d+%d)/%d", &a, &b, &c);
		getchar();
		getchar();
		cin >> a;
		getchar();
		cin >> b;
		getchar();
		getchar();
		cin >> c;
		int num = (a + b) * 1.0 / c;
		m[num]++;
		G[i] = num;
	}
	for (int i = 0; i < n; i++)
	{
		if (i)
			printf(" ");
		printf("%d", m[G[i]]);
	}
	cout << endl;
}


#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <stack>
#include <set>
#include <list>
#include <numeric>
#include <sstream>
#include <iomanip>
#include <limits>

#define CLR(a, b) memset(a, (b), sizeof(a))
#define pb push_back

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair<string, int> psi;
typedef pair<string, string> pss;
typedef pair <int, ll> pil;

const double PI = acos(-1.0);
const double E = exp(1.0);
const double eps = 1e-8;

const int INF = 0x3f3f3f3f;
const ll llINF = 0x3f3f3f3f3f3f3f3f;
const int maxn = 2e5 + 5;
const int MOD = 1e9;

int gcd(int x, int y)
{
	int r;
	while (1)
	{
		r = x % y;
		if (r == 0)
			break;
		x = y;
		y = r;
	}
	return y;
}

struct node
{
	int a, b;
	int value;
}G[maxn];

int main()
{
	CLR(G, 0);
	int n;
	cin >> n;
	int a, b, c;
	for (int i = 0; i < n; i++)
	{
		//scanf("(%d+%d)/%d", &a, &b, &c);
		getchar();
		getchar();
		cin >> a;
		getchar();
		cin >> b;
		getchar();
		getchar();
		cin >> c;
		G[i].a = a + b;
		G[i].b = c;
		int m = gcd(G[i].a, G[i].b);
		G[i].a /= m;
		G[i].b /= m;
		G[i].value = 1;
		for (int j = 0; j < i; j++)
		{
			if (G[i].a == G[j].a && G[i].b == G[j].b)
				G[i].value++, G[j].value++;
		}
	}
	for (int i = 0; i < n; i++)
	{
		if (i)
			printf(" ");
		printf("%d", G[i].value);
	}
	cout << endl;
}


#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <stack>
#include <set>
#include <list>
#include <numeric>
#include <sstream>
#include <iomanip>
#include <limits>

#define CLR(a, b) memset(a, (b), sizeof(a))
#define pb push_back

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair<string, int> psi;
typedef pair<string, string> pss;
typedef pair <int, ll> pil;

const double PI = acos(-1.0);
const double E = exp(1.0);
const double eps = 1e-8;

const int INF = 0x3f3f3f3f;
const ll llINF = 0x3f3f3f3f3f3f3f3f;
const int maxn = 2e5 + 5;
const int MOD = 1e9;

int G[maxn];

int main()
{
	CLR(G, 0);
	int n;
	cin >> n;
	int a, b, c;
	map <int, int> m;
	for (int i = 0; i < n; i++)
	{
		//scanf("(%d+%d)/%d", &a, &b, &c);
		getchar();
		getchar();
		cin >> a;
		getchar();
		cin >> b;
		getchar();
		getchar();
		cin >> c;
		int num = (a + b) / c;
		m[num]++;
		G[i] = num;
	}
	for (int i = 0; i < n; i++)
	{
		if (i)
			printf(" ");
		printf("%d", m[G[i]]);
	}
	cout << endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define stringtochararray \
string s;cin>>s;int n=s.length();char a[n+1];strcpy(a,s.c_str());
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define PT palindromeTest	//Input - string, int, ll, l
#define GS generateSubsets	//Input - n
				//Return - vector<vector<int>>
#define GP generatePermutations //Input - int n
				//Return - vector<vector<int>>
#define PF primeFactorization	//Input - ll
				//Return - vector<ll>
#define nCr nCrModPFermat   //Input - n, r, p
				//Return - nCr mod p

// vec.lower_bound(2) where vec is {1, 2, 3, 4, 5} is 2
// vec.upper_bound(2) where vec is {1, 2, 3, 4, 5} is 3
// For a set s, distance(it1, it2) can be very useful

double fn(string s)
{
	if (s.length() == 1)
		return (double)(s[0] - '0');
	else
		return ((double)(s[0] - '0') * 10) + (double)(s[1] - '0');
}

main()
{
	fast;
	int n;
	cin>>n;
	std::vector<double> v;
	multiset<double> s;
	for (int i=0;i<n;i++)
	{
		string t; int j;
		cin>>t;
		string al = "", all = "", alll = "";
		for (j=1;j<4;j++)
		{
			if (t[j] != '+')
				al += t[j];
			else
				break;
		}
		j++;
		for (;j<10;j++)
		{
			if (t[j] != ')')
				all += t[j];
			else
				break;
		}
		j += 2;
		for (;j<t.length();j++)
			alll += t[j];
		double c1 = fn(al), c2 = fn(all), c3 = fn(alll);
		v.PB((c1 + c2)/c3);
		s.insert((c1 + c2)/c3);
	}
	for (int i=0;i<n;i++)
	{
		cout<<s.count(v[i])<<" ";
	}
	cout<<"\n";
}


    #include<bits/stdc++.h>
    using namespace std;
    #define ll long long int
    #define f first
    #define s second
    #define ii pair<int,int>
    #define vi vector<int>
    #define vl vector<ll>
    #define forn(i,n) for(int i=0;i<n;i++)
    #define rforn(i,n) for(int i=n-1;i>=0;i--)
    #define forne(i,n) for(int i=1;i<=n;i++)
    #define rforne(i,n) for(int i=n;i>=1;i--)
    #define forse(i,s,e) for(int i=s;i<e;i++)
    #define rforse(i,s,e) for(int i=e-1;i>=s;i--)
    #define all(x) x.begin(),x.end()
    #define pb push_back
    #define pf push_front
    #define pob pop_back
    #define pof pop_front

    ll N = 1e9+7;

    void solve(){
    	int n; cin>>n;
    	map<ii,int> mp;
    	vector<ii> v(n+4);
    	forn(i,n){
    		string s,a,b,c; cin>>s;
    		if(s[2]=='+'){
    			a=s.substr(1,1);
    			if(s[4]==')'){
    				b=s.substr(3,1);
    				c=s.substr(6,s.size()-6);
    			}
    			else{
    				b=s.substr(3,2);
    				c=s.substr(7,s.size()-7);
    			}
    		}
    		else{
    			a=s.substr(1,2);
    			if(s[5]==')'){
    				b=s.substr(4,1);
    				c=s.substr(7,s.size()-7);
    			}
    			else{
    				b=s.substr(4,2);
    				c=s.substr(8,s.size()-8);
    			}
    		}
    		//cout<<a<<" "<<b<<" "<<c<<endl;
    		int a1=0,b1=0,c1=0;
    		if(a.size()==1){
    			a1=a[0]-'0';
    		}
    		else{
    			a1=a[1]-'0';
    			a1 += 10*(a[0]-'0');
    		}
    		if(b.size() == 1){
    			b1=b[0]-'0';
    		}
    		else{
    			b1=b[1]-'0';
    			b1 += 10*(b[0]-'0');
    		}
    		if(c.size() == 1){
    			c1=c[0]-'0';
    		}
    		else{
    			c1=c[1]-'0';
    			c1 += 10*(c[0]-'0');
    		}
    		//cout<<a1<<" "<<b1<<" "<<c1<<endl;
    		int gcd1=__gcd(a1+b1,c1);
    		v[i]={(a1+b1)/gcd1,c1/gcd1};
    		mp[v[i]]++;
    	}
    	for(int i=0;i<n;i++){
    		cout<<mp[v[i]]<<" ";
    	}
    	cout<<endl;
    }
    int main(){
    	ios_base::sync_with_stdio(false);
    	cin.tie(NULL);
    	cout.tie(NULL);
    	int t=1;
    	//cin>>t;
    	while(t--){
    		solve();
    	}
    }


#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	long long n;
	float a,b,c;
	char ch1,ch2,ch3,ch4;
	cin >> n;
	vector <float> res(n);
	vector <long long> sum(n,0);

	for(long long i=0; i<n; ++i)
	{
		cin >> ch1 >> a >> ch2 >> b >> ch3 >> ch4 >> c;
		res[i] = (a+b)/c;
		cout << res[i] << endl;
	}

	for(long long i=0; i<n; ++i)
	{
		for(long long j=0; j<n; ++j)
		{
			if(res[j] == res[i])
			++sum[i];
		}
	}

	for(int i=0; i<n; ++i)
	cout << sum[i] << " ";

}


#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	long long n;
	float a,b,c;
	char ch1,ch2,ch3,ch4;
	cin >> n;
	vector <float> res(n);
	vector <long long> sum(n,0);
	map <float, long long> mapec;
	for(long long i=0; i<n; ++i)
	{
		cin >> ch1 >> a >> ch2 >> b >> ch3 >> ch4 >> c;
		res[i] = (a+b)/c;
		++mapec[res[i]];
	}

	for(long long i=0; i<n; ++i)
	cout << mapec[res[i]] << " ";

}


#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	long long n,a,b,c;
	char ch1,ch2,ch3,ch4;
	cin >> n;
	vector <long long> res(n);
	vector <long long> sum(n,0);

	for(long long i=0; i<n; ++i)
	{
		cin >> ch1 >> a >> ch2 >> b >> ch3 >> ch4 >> c;
		res[i] = a/c + (b + a%c)/c;
		//cout << res[i] << endl;
	}

	for(long long i=0; i<n; ++i)
	{
		for(long long j=0; j<n; ++j)
		{
			if(res[j] == res[i])
			++sum[i];
		}
	}

	for(int i=0; i<n; ++i)
	cout << sum[i] << " ";

}


#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n,a,b,c;
	char ch1,ch2,ch3,ch4;
	cin >> n;
	vector <int> res(n);
	vector <int> sum(n);

	for(int i=0; i<n; ++i)
	{
		cin >> ch1 >> a >> ch2 >> b >> ch3 >> ch4 >> c;
		res[i] = (a+b)/c;
		//cout << res[i] << endl;
	}

	for(int i=0; i<n; ++i)
	{
		for(int j=0; j<n; ++j)
		{
			if(res[j] == res[i])
			++sum[i];
		}
	}

	for(int i=0; i<n; ++i)
	cout << sum[i] << " ";

}


#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	long long n,a,b,c;
	char ch1,ch2,ch3,ch4;
	cin >> n;
	vector <long long> res(n);
	vector <long long> sum(n,0);

	for(long long i=0; i<n; ++i)
	{
		cin >> ch1 >> a >> ch2 >> b >> ch3 >> ch4 >> c;
		res[i] = a/c + b/c;
		//cout << res[i] << endl;
	}

	for(long long i=0; i<n; ++i)
	{
		for(long long j=0; j<n; ++j)
		{
			if(res[j] == res[i])
			++sum[i];
		}
	}

	for(int i=0; i<n; ++i)
	cout << sum[i] << " ";

}


#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	long long n;
	float a,b,c;
	char ch1,ch2,ch3,ch4;
	cin >> n;
	vector <float> res(n);
	vector <long long> sum(n,0);

	for(long long i=0; i<n; ++i)
	{
		cin >> ch1 >> a >> ch2 >> b >> ch3 >> ch4 >> c;
		res[i] = (a+b)/c;
		//cout << res[i] << endl;
	}

	for(long long i=0; i<n; ++i)
	{
		for(long long j=0; j<n; ++j)
		{
			if(res[j] == res[i])
			++sum[i];
		}
	}

	for(int i=0; i<n; ++i)
	cout << sum[i] << " ";

}


#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	long long n,a,b,c;
	char ch1,ch2,ch3,ch4;
	cin >> n;
	vector <float> res(n);
	vector <long long> sum(n,0);

	for(long long i=0; i<n; ++i)
	{
		cin >> ch1 >> a >> ch2 >> b >> ch3 >> ch4 >> c;
		res[i] = (a+b)/c;
		//cout << res[i] << endl;
	}

	for(long long i=0; i<n; ++i)
	{
		for(long long j=0; j<n; ++j)
		{
			if(res[j] == res[i])
			++sum[i];
		}
	}

	for(int i=0; i<n; ++i)
	cout << sum[i] << " ";

}


#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	long long n;
	float a,b,c;
	char ch1,ch2,ch3,ch4;
	cin >> n;
	vector <float> res(n);
	vector <long long> sum(n,0);
	map <float, long long> mapec;
	for(long long i=0; i<n; ++i)
	{
		cin >> ch1 >> a >> ch2 >> b >> ch3 >> ch4 >> c;
		res[i] = (a+b)/c;
		++mapec[res[i]];
		//cout << res[i] << endl;
	}

	for(long long i=0; i<n; ++i)
	cout << mapec[res[i]] << " ";

	//for(int i=0; i<n; ++i)
	//cout << sum[i] << " ";

}


#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<utility>
#include<iomanip>
#include<algorithm>
#include<cmath>
#define ll long long
using namespace std;

int main()
{
    int n; cin>>n;
    map<string,double> m1;
    map<double, int> m2;
    vector<string> v;
    int i;
    string s;
    int a,b,c,j;
    for(i=0;i<n;i++)
    {
        cin>>s;
        v.push_back(s);
        j=1;
        string x="";
        while(s[j]!='+')
        {
            x+=s[j]; j++;
        }
        j++;
        a=stoi(x);
        x="";
        while(s[j]!=')')
        {
            x+=s[j]; j++;
        }
        b=stoi(x);
        x="";
        j+=2;
        while(j<s.length())
        {
            x+=s[j]; j++;
        }
        c=stoi(x);
        double p=(double)(a+b)/c;
        //cout<<a<<" "<<b<<" "<<c<<" ";
       // cout<<p<<" ";
        m1[s]=p;
        m2[p]++;
    }
    for(i=0;i<n;i++)
    {
        cout<<m2[m1[v[i]]]<<" ";
    }
}


#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<utility>
#include<iomanip>
#include<algorithm>
#include<cmath>
#define ll long long
using namespace std;

int main()
{
    int n; cin>>n;
    map<string,int> m1;
    map<int, int> m2;
    vector<string> v;
    int i;
    string s;
    int a,b,c,j;
    for(i=0;i<n;i++)
    {
        cin>>s;
        v.push_back(s);
        j=1;
        string x="";
        while(s[j]!='+')
        {
            x+=s[j]; j++;
        }
        j++;
        a=stoi(x);
        x="";
        while(s[j]!=')')
        {
            x+=s[j]; j++;
        }
        b=stoi(x);
        x="";
        j+=2;
        while(j<s.length())
        {
            x+=s[j]; j++;
        }
        c=stoi(x);
        int p=(a+b)/c;
        //cout<<a<<" "<<b<<" "<<c<<" ";
       // cout<<p<<" ";
        m1[s]=p;
        m2[p]++;
    }
    for(i=0;i<n;i++)
    {
        cout<<m2[m1[v[i]]]<<" ";
    }
}


// Kotaro << Minoz << Hayama << Cohr3141592654

// Fall...

// You know, everybody's been tellin' me what they think about me for the last few months

// ... It's too loud
// Maybe it's time I tell 'em what I think about them
// ... Can't hear it coming down the hallway stairs from the parking lot
// ... It's too loud
// ... Three's not a crowd all up in it, slow fire

// ... Don't fall on my face
// ... Don't fall on my faith, oh
// ... Don't fall on my fate
// ... Don't fall on my faith, oh
// ... Don't fall on my fate
// ... Don't fall on my

// Gotta concentrate, against the clock I race
// Got no time to waste, I'm already late, I got a marathoner's pace
// Went from addict to a workaholic, word to Dr. Dre
// In that first marijuana tape-guess I got a chronic case (yeah)
// And I ain't just blowin' smoke, 'less it's in your momma's face
// I know this time Paul and Dre
// They won't tell me what not to say (nope)
// And though me and my party days
// Have all pretty much parted ways
// You'd swear to God I forgot I'm the guy that made "Not Afraid"
// One last time for Charlamagne
// If my response is late, it's just how long it takes
// To hit my fuckin' radar, I'm so far away
// These rappers are like Hunger Games
// One minute, they're mockin' Jay
// Next minute, they get their style from Migos or they copy Drake
// Maybe I just don't know when to turn around and walk away
// But all the hate, I call it "Walk on Water" gate
// I've had as much as I can tolerate
// I'm sick and tired of waitin', I done lost my patience
// I can take all of you motherfuckers on at once
// You wanted Shady? You got him!

// ... Don't fall on my face (yeah)
// ... Don't fall on my faith, oh
// ... Don't fall on my fate (line 'em up!)
// ... Don't fall on my faith, oh (rrr!)
// ... Don't fall on my fate (look)

// Somebody tell Budden before I snap, he better fasten it
// Or have his body bag get zipped
// The closest thing he's had to hits is smackin' bitches
// And don't make me have to give it back to Akademiks
// Say this shit is trash again, I'll have you twisted
// Like you had it when you thought you had me slippin' at the telly
// Even when I'm gettin' brain, you'll never catch me with a thot
// Lackin' with it, "he ain't spittin' like this on his last shit"
// Ho, you better go back and listen
// You know me better, thinkin' I'll slow or let up
// Call it trap 'cause it's a total setup
// Hopin' that you rappers fall in that
// Dre said, "Hold your head up!"—Kathy Griffin
// Stackin' ammunition, slap the clip in, cock it back on competition
// This is how I shot ahead (pew)—Gabby Giffords
// My attack is vicious, Jack the Ripper, back in business
// Tyler create nothin', I see why you called yourself a (faggot), bitch
// It's not just 'cause you lack attention
// It's because you worship D12's balls, you're sack-religious
// If you're gonna critique me
// You better at least be as good or better
// Get Earl the Hooded Sweater
// Whatever his name is to help you put together
// Some words, more than just two letters
// The fans waited for this moment like that feature
// When I stole the show (ha), sorry if I took forever (haha)

// ... Don't fall on my face (yeah)
// ... Don't fall on my faith, oh (I won't)
// ... Don't fall on my fate (line 'em up!)
// ... Don't fall on my faith, oh (ha)
// ... Don't fall on my fate (it's too easy)

// Just remember, I was here before you
// And I'll be here after you make your run-in for you
// Detractors, I might have to fuck Pitchfork with a corkscrew
// Just what the doctor ordered
// Revenge is the best medicine
// Increase the dose, from least to most
// And then tell the Grammys to go and fuck themselves
// They suck the blood from all the biggest artists like some leeches
// So they nominate 'em, get 'em there, get a name to MC the show
// Every parasite needs a host (haha)
// Then give Album of the Year to somebody that no one's ever even heard of
// All I know is I wrote every single word of
// Everything I ever murdered
// Time to separate the sheep from goats (yeah)
// And I got no faith in your writers, I don't believe in ghosts
// When rap needed it most, I was that wing and a prayer
// A beacon of hope, put a B-I-R-D in the air
// Somewhere some kid is bumpin' this while he lip-syncs in the mirror
// That's who I'm doin' it for, the rest I don't really even care
// But you would think I'm carryin' a Oxford dictionary in my pocket
// How I'm buryin' these artists
// On a scale of 'turnt' you're 'minus'
// Mine says 'very', yours says 'hardly'
// And what's scary is you probably can compare me to your car 'cause I'm just barely gettin' started (woo)
// And far as Lord Jamar, you better leave me the hell alone
// Or I'll show you an Elvis clone
// Walk up in this house you own, thrust my pelvic bone
// Use your telephone and go fetch me the remote
// Put my feet up and just make myself at home
// I belong here, clown, don't tell me 'bout the culture
// I inspired the Hopsins, the Logics, the Coles, the
// Seans, the K-Dots, the 5'9"s, and oh
// Brought the world 50 Cent, you did squat, piss and moan
// But I'm not gonna fall... bitch!

// ... It's too loud
// ... Can't hear it coming down the hallway stairs from the parking lot
// ... It's too loud
// ... Three's not a crowd all up in it
// ... Slow fire

#pragma GCC optimize ("Ofast,unroll-loops")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define ff  first
#define ss second
#define tm1 first
#define tm2 second.first
#define tm3 second.second
#define sz(x) ll(x.size())
#define fill(x, v) memset(x, v, sizeof(x))
#define all(v) (v).begin(), (v).end()
#define FER(i,a,b) for(ll i=ll(a); i< ll(b); ++i)
#define IFR(i,a,b) for(ll i=ll(a); i>=ll(b); --i )
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)

#define N 200005
#define mod 1000000007
#define M 26
#define bas 31
#define sqr(x) (x)*(x)
#define INF 1000000000

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef pair<ll, ll> ii;
typedef pair<ll, ii > tri;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> set_t;

#define trace(...) f(#__VA_ARGS__, __VA_ARGS__)

template<typename t> void f(const char* x, t&& val1){
    cout<<x<< " : "<<val1<<endl;
}

template<typename t1, typename... t2> void f(const char* x, t1&& val1, t2&&... val2){
    const char* xd=strchr(x+1, ',');
    cout.write(x, xd-x)<<" : "<<val1<<" | ";
    f(xd+1, val2...);
}

map<ll, ll> m;
ll val[N];
inline ii go(string &s, ll id){
    ll ans=0, idx;
    if(s[id+1]-'0'>=0 && s[id+1]-'0'<=9){
        ans+=10*(s[id]-'0')+s[id+1]-'0';
        idx=id+2;
    }
    else{
        ans+=s[id]-'0';
        idx=id+1;
    }
    return {ans, idx};
}
int main(){
    fastio;
    ll n; cin>>n;
    FER(i,0,n){
        string s; cin>>s;
        ii cur1=go(s, 1);
        ii cur2=go(s, cur1.ss+1);
        ii cur3=go(s, cur2.ss+2);
        ll t=(cur1.ff+cur2.ff)/cur3.ff;
        m[t]++;
        val[i]=t;
    }
    FER(i,0,n) cout<<m[val[i]]<<" "; cout<<endl;
    return 0;
}


// Kotaro << Minoz << Hayama << Cohr3141592654

// Fall...

// You know, everybody's been tellin' me what they think about me for the last few months

// ... It's too loud
// Maybe it's time I tell 'em what I think about them
// ... Can't hear it coming down the hallway stairs from the parking lot
// ... It's too loud
// ... Three's not a crowd all up in it, slow fire

// ... Don't fall on my face
// ... Don't fall on my faith, oh
// ... Don't fall on my fate
// ... Don't fall on my faith, oh
// ... Don't fall on my fate
// ... Don't fall on my

// Gotta concentrate, against the clock I race
// Got no time to waste, I'm already late, I got a marathoner's pace
// Went from addict to a workaholic, word to Dr. Dre
// In that first marijuana tape-guess I got a chronic case (yeah)
// And I ain't just blowin' smoke, 'less it's in your momma's face
// I know this time Paul and Dre
// They won't tell me what not to say (nope)
// And though me and my party days
// Have all pretty much parted ways
// You'd swear to God I forgot I'm the guy that made "Not Afraid"
// One last time for Charlamagne
// If my response is late, it's just how long it takes
// To hit my fuckin' radar, I'm so far away
// These rappers are like Hunger Games
// One minute, they're mockin' Jay
// Next minute, they get their style from Migos or they copy Drake
// Maybe I just don't know when to turn around and walk away
// But all the hate, I call it "Walk on Water" gate
// I've had as much as I can tolerate
// I'm sick and tired of waitin', I done lost my patience
// I can take all of you motherfuckers on at once
// You wanted Shady? You got him!

// ... Don't fall on my face (yeah)
// ... Don't fall on my faith, oh
// ... Don't fall on my fate (line 'em up!)
// ... Don't fall on my faith, oh (rrr!)
// ... Don't fall on my fate (look)

// Somebody tell Budden before I snap, he better fasten it
// Or have his body bag get zipped
// The closest thing he's had to hits is smackin' bitches
// And don't make me have to give it back to Akademiks
// Say this shit is trash again, I'll have you twisted
// Like you had it when you thought you had me slippin' at the telly
// Even when I'm gettin' brain, you'll never catch me with a thot
// Lackin' with it, "he ain't spittin' like this on his last shit"
// Ho, you better go back and listen
// You know me better, thinkin' I'll slow or let up
// Call it trap 'cause it's a total setup
// Hopin' that you rappers fall in that
// Dre said, "Hold your head up!"—Kathy Griffin
// Stackin' ammunition, slap the clip in, cock it back on competition
// This is how I shot ahead (pew)—Gabby Giffords
// My attack is vicious, Jack the Ripper, back in business
// Tyler create nothin', I see why you called yourself a (faggot), bitch
// It's not just 'cause you lack attention
// It's because you worship D12's balls, you're sack-religious
// If you're gonna critique me
// You better at least be as good or better
// Get Earl the Hooded Sweater
// Whatever his name is to help you put together
// Some words, more than just two letters
// The fans waited for this moment like that feature
// When I stole the show (ha), sorry if I took forever (haha)

// ... Don't fall on my face (yeah)
// ... Don't fall on my faith, oh (I won't)
// ... Don't fall on my fate (line 'em up!)
// ... Don't fall on my faith, oh (ha)
// ... Don't fall on my fate (it's too easy)

// Just remember, I was here before you
// And I'll be here after you make your run-in for you
// Detractors, I might have to fuck Pitchfork with a corkscrew
// Just what the doctor ordered
// Revenge is the best medicine
// Increase the dose, from least to most
// And then tell the Grammys to go and fuck themselves
// They suck the blood from all the biggest artists like some leeches
// So they nominate 'em, get 'em there, get a name to MC the show
// Every parasite needs a host (haha)
// Then give Album of the Year to somebody that no one's ever even heard of
// All I know is I wrote every single word of
// Everything I ever murdered
// Time to separate the sheep from goats (yeah)
// And I got no faith in your writers, I don't believe in ghosts
// When rap needed it most, I was that wing and a prayer
// A beacon of hope, put a B-I-R-D in the air
// Somewhere some kid is bumpin' this while he lip-syncs in the mirror
// That's who I'm doin' it for, the rest I don't really even care
// But you would think I'm carryin' a Oxford dictionary in my pocket
// How I'm buryin' these artists
// On a scale of 'turnt' you're 'minus'
// Mine says 'very', yours says 'hardly'
// And what's scary is you probably can compare me to your car 'cause I'm just barely gettin' started (woo)
// And far as Lord Jamar, you better leave me the hell alone
// Or I'll show you an Elvis clone
// Walk up in this house you own, thrust my pelvic bone
// Use your telephone and go fetch me the remote
// Put my feet up and just make myself at home
// I belong here, clown, don't tell me 'bout the culture
// I inspired the Hopsins, the Logics, the Coles, the
// Seans, the K-Dots, the 5'9"s, and oh
// Brought the world 50 Cent, you did squat, piss and moan
// But I'm not gonna fall... bitch!

// ... It's too loud
// ... Can't hear it coming down the hallway stairs from the parking lot
// ... It's too loud
// ... Three's not a crowd all up in it
// ... Slow fire

#pragma GCC optimize ("Ofast,unroll-loops")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define ff  first
#define ss second
#define tm1 first
#define tm2 second.first
#define tm3 second.second
#define sz(x) ll(x.size())
#define fill(x, v) memset(x, v, sizeof(x))
#define all(v) (v).begin(), (v).end()
#define FER(i,a,b) for(ll i=ll(a); i< ll(b); ++i)
#define IFR(i,a,b) for(ll i=ll(a); i>=ll(b); --i )
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)

#define N 200005
#define mod 1000000007
#define M 26
#define bas 31
#define sqr(x) (x)*(x)
#define INF 1000000000

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef pair<ll, ll> ii;
typedef pair<ll, ii > tri;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> set_t;

#define trace(...) f(#__VA_ARGS__, __VA_ARGS__)

template<typename t> void f(const char* x, t&& val1){
    cout<<x<< " : "<<val1<<endl;
}

template<typename t1, typename... t2> void f(const char* x, t1&& val1, t2&&... val2){
    const char* xd=strchr(x+1, ',');
    cout.write(x, xd-x)<<" : "<<val1<<" | ";
    f(xd+1, val2...);
}

map<double, ll> m;
double val[N];
inline ii go(string &s, ll id){
    ll ans=0, idx;
    if(s[id+1]-'0'>=0 && s[id+1]-'0'<=9){
        ans+=10*(s[id]-'0')+s[id+1]-'0';
        idx=id+2;
    }
    else{
        ans+=s[id]-'0';
        idx=id+1;
    }
    return {ans, idx};
}
int main(){
    fastio;
    ll n; cin>>n;
    FER(i,0,n){
        string s; cin>>s;
        ii cur1=go(s, 1);
        ii cur2=go(s, cur1.ss+1);
        ii cur3=go(s, cur2.ss+2);
        // trace(i, cur1.ff, cur2.ff, cur3.ff);
        double t=1.0*(cur1.ff+cur2.ff)/(1.0*cur3.ff);
        m[t]++;
        val[i]=t;
    }
    FER(i,0,n) cout<<m[val[i]]<<" "; cout<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define float double
#define dg(x) cout<<#x<<" :"<<x;
#define dg_array(ar) for(auto x : ar) cout<<x<<" ";cout<<endl;
#define dg_2darray(ar) for(auto x : ar) {for(auto y : x) cout<< y<<" ";cout<<endl;}
#define endl '\n'
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);

int toInt(string &str, int i )
{
	if(i == -1) return 0;
	return (str[i] - '0') + toInt(str, i -1)* 10;
}

pair<int , pair<int, int >> getcab (string &str)
{
	int n = str.size();
	int plus = find( str.begin() , str.end(), '+') - str.begin();
	int secondparenthesis = find(str.begin()+1, str.end(), ')') - str.begin();
	int slash  = find(str.begin(), str.end(), '/') - str. begin();

	string a = str.substr(1, plus -1);
	string b = str.substr(plus +  1, secondparenthesis - plus - 1);
	string c = str.substr(slash +1, n - slash -1);
	// cout<< a <<  "  " << b << " " << c << endl;
	int p  =1;
	return {toInt(c,c.size() -1), {toInt(a, a.size() -1), toInt(b, b.size() -1)}};
}
void solve()
{
	int n ;
	cin >>n;
	map<int, int>mp;
	vector<int> ar(n);
	for(int i =0 ; i< n ;i++)
	{
		string str;
		cin >> str ;
		pair<int, pair<int , int > > cab = getcab(str);
		ar[i] = (cab.second.first + cab.second.second) / cab.first;
		mp[ar[i]]++;
	}

	for(auto x : ar)
		cout << mp[x] << " ";
	cout << endl;
}

void testcase()
{
    int t;
    cin>>t;
    while(t--)
        solve();
}
int32_t main(){
	fast;
	#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	//	freopen("output.txt", "w", stdout);
	#endif
//    testcase();
   solve();
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define float double
#define dg(x) cout<<#x<<" :"<<x;
#define dg_array(ar) for(auto x : ar) cout<<x<<" ";cout<<endl;
#define dg_2darray(ar) for(auto x : ar) {for(auto y : x) cout<< y<<" ";cout<<endl;}
#define endl '\n'
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);

int toInt(string &str, int i )
{
	if(i == -1) return 0;
	return (str[i] - '0') + toInt(str, i -1)* 10;
}

pair<int , pair<int, int >> getcab (string &str)
{
	int n = str.size();
	int plus = find( str.begin() , str.end(), '+') - str.begin();
	int secondparenthesis = find(str.begin()+1, str.end(), ')') - str.begin();
	int slash  = find(str.begin(), str.end(), '/') - str. begin();

	string a = str.substr(1, plus -1);
	string b = str.substr(plus +  1, secondparenthesis - plus - 1);
	string c = str.substr(slash +1, n - slash -1);
	// cout<< a <<  "  " << b << " " << c << endl;
	int p  =1;
	return {toInt(c,c.size() -1), {toInt(a, a.size() -1), toInt(b, b.size() -1)}};
}
void solve()
{
	int n ;
	cin >>n;
	map<float, int>mp;
	vector<float> ar(n);
	for(int i =0 ; i< n ;i++)
	{
		string str;
		cin >> str ;
		pair<int, pair<int , int > > cab = getcab(str);
		ar[i] = (cab.second.first*1.0 + cab.second.second*1.0) / cab.first*1.0;
		mp[ar[i]]++;
		// cout << ar[i] <<endl;
	}

	for(auto x : ar)
		cout << mp[x] << " ";
	cout << endl;
}

void testcase()
{
    int t;
    cin>>t;
    while(t--)
        solve();
}
int32_t main(){
	fast;
	#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	//	freopen("output.txt", "w", stdout);
	#endif
//    testcase();
   solve();
}


#include <bits/stdc++.h>
using namespace std;
#define maxn 200000

int gcd(int a, int b) {
	int pr = a, r = b, q, h;
	while(r) {
		q = pr / r;
		h = r;
		r = pr - q * r;
		pr = h;
	}
	return pr;
}
struct Num {
	int n, d;
	Num(){}
	Num (int a, int b) {
		int g = gcd(a, b);
		n = a / g;
		d = b / g;
	}
	bool operator < (const Num &num) const {
		return n * num.d < d * num.n;
	}
};
Num p[maxn];
map<Num, int> ma;

int main() {
	int n, i, a, b, c;
	scanf("%d\n", &n);
	for (i = 0; i < n; i++) {
		scanf("(%d+%d)/%d\n", &a, &b, &c);
		p[i] = Num(a + b, c);
		ma[p[i]]++;
	}
	for (i = 0; i < n; i++) {
		if (i) printf(" ");
		printf("%d", ma[p[i]]);
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define maxn 200000

int gcd(int a, int b) {
	int pr = a, r = b, q, h;
	while(r) {
		q = pr / r;
		h = r;
		r = pr - q * r;
		pr = h;
	}
	return pr;
}
struct Num {
	int n, d;
	Num(){}
	Num (int a, int b) {
		int g = gcd(a, b);
		n = a / g;
		d = b / g;
	}
	bool operator < (const Num &num) const {
		return n * num.d < d * num.n;
	}
};
Num p[maxn];
map<Num, int> ma;

int main() {
	int n, i, a, b, c;
	scanf("%d\n", &n);
	for (i = 0; i < n; i++) {
		scanf("(%d+%d)/%d\n", &a, &b, &c);
		p[i] = Num(a + b, c);
		mp[p[i]]++;
	}
	for (i = 0; i < n; i++) {
		if (i) printf(" ");
		printf("%d", ma[p[i]]);
	}
	return 0;
}


/*
Mohit Dhattarwal
*/
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define foreach(it, v) for(auto it=(v).begin(); it != (v).end(); ++it)
#define gcd(a,b) __gcd(a,b)

#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define filewr() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<string,ll> psl;
typedef pair<ll,string> pls;

template<typename S, typename T>
ostream& operator<<(ostream& out,pair<S,T> const& p){out<<'('<<p.fi<<", "<<p.se<<')';return out;}

template<typename T>
ostream& operator<<(ostream& out,vector<T> const& v){
int l=v.size();for(int i=0;i<l-1;i++)out<<v[i]<<' ';if(l>0)out<<v[l-1];return out;}

template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}

template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}

const ld PI = 3.1415926535897932384626433832795;

typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> indexed_set;

ld count(string s)
{
	ll a,b,c;
	string aa="", bb="", cc="";
	ll f1=0, f2=0;
	for(ll i =1; i<s.length(); i++)
	{
		if(s.substr(i,1)=="+")
		{
			f1++;
		}

		else if(s.substr(i,1)==")" || s.substr(i,1)=="/")
		{
			f2++;
		}

		else if(f1==0)
		{
			aa+=s.substr(i,1);
		}
		else if(f1!=0 && f2==0)
		{
			bb+=s.substr(i,1);
		}
		else if(f2!=0)
		{
			cc+=s.substr(i,1);
		}
	}
	//tr(aa,bb,cc);
	a = stoll(aa);
	b = stoll(bb);
	c = stoll(cc);
	//tr(((a+b)*1.0/c));
	return ((a+b)*1.0/c);
}
void solve()
{
	ll n;
	string s;
	cin>>n;
	string a[n];
	map<ld,ll> m;
	map<string,ld> m2;
	for(ll i =0; i<n; i++)
	{
		cin>>s;
		a[i] = s;
		m[count(s)]++;
		m2[s] = count(s);
	}
	for(ll i =0; i<n; i++)
	{
		cout<<m[m2[a[i]]]<<" ";
	}
	cout<<endl;
}

int main(){
	fastio();
	ll t;
	t =1;
	while(t--)
	{
		solve();
	}
	return 0;
}


/*
Mohit Dhattarwal
*/
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define foreach(it, v) for(auto it=(v).begin(); it != (v).end(); ++it)
#define gcd(a,b) __gcd(a,b)

#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define filewr() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<string,ll> psl;
typedef pair<ll,string> pls;

template<typename S, typename T>
ostream& operator<<(ostream& out,pair<S,T> const& p){out<<'('<<p.fi<<", "<<p.se<<')';return out;}

template<typename T>
ostream& operator<<(ostream& out,vector<T> const& v){
int l=v.size();for(int i=0;i<l-1;i++)out<<v[i]<<' ';if(l>0)out<<v[l-1];return out;}

template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}

template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}

const ld PI = 3.1415926535897932384626433832795;

typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> indexed_set;

ll count(string s)
{
	ll a,b,c;
	string aa="", bb="", cc="";
	ll f1=0, f2=0;
	for(ll i =1; i<s.length(); i++)
	{
		if(s.substr(i,1)=="+")
		{
			f1++;
		}

		else if(s.substr(i,1)==")" || s.substr(i,1)=="/")
		{
			f2++;
		}

		else if(f1==0)
		{
			aa+=s.substr(i,1);
		}
		else if(f1!=0 && f2==0)
		{
			bb+=s.substr(i,1);
		}
		else if(f2!=0)
		{
			cc+=s.substr(i,1);
		}
	}
	//tr(aa,bb,cc);
	a = stoll(aa);
	b = stoll(bb);
	c = stoll(cc);
	return ((a+b)/c);
}
void solve()
{
	ll n;
	string s;
	cin>>n;
	string a[n];
	map<ll,ll> m;
	map<string,ll> m2;
	for(ll i =0; i<n; i++)
	{
		cin>>s;
		a[i] = s;
		m[count(s)]++;
		m2[s] = count(s);
	}
	for(ll i =0; i<n; i++)
	{
		cout<<m[m2[a[i]]]<<" ";
	}
	cout<<endl;
}

int main(){
	fastio();
	ll t;
	t =1;
	while(t--)
	{
		solve();
	}
	return 0;
}


 #include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define fr(i,n) for(i=0;i<n;i++)
#define F first
#define S second
#define fast std::ios_base::sync_with_stdio(false)
#define mod 1000000007
#define pi 3.14159265
int main() {
	fast;
	lli n;
	cin>>n;
	lli a[n],b[n],c[n],i;
	map<lli,lli>m;
	fr(i,n)
	{
		char s1,s2,s3,s4;
		cin>>s1;
		cin>>a[i]>>s2>>b[i]>>s3>>s4>>c[i];
		m[(a[i]+b[i])/c[i]]++;
	}
	fr(i,n)
	{
		cout<<m[(a[i]+b[i])/c[i]]<<" ";
	}

	return 0;
}


 #include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define fr(i,n) for(i=0;i<n;i++)
#define F first
#define S second
#define fast std::ios_base::sync_with_stdio(false)
#define mod 1000000007
#define pi 3.14159265
int main() {
	fast;
	lli n;
	cin>>n;
	float a[n],b[n],c[n];
	lli i;
	map<float,lli>m;
	fr(i,n)
	{
		char s1,s2,s3,s4;
		cin>>s1;
		cin>>a[i]>>s2>>b[i]>>s3>>s4>>c[i];
		m[(a[i]+b[i])/c[i]]++;
	}
	fr(i,n)
	{
		cout<<m[(a[i]+b[i])/c[i]]<<" ";
	}

	return 0;
}


#include <iostream>
#include <math.h>
#include <bits/stdc++.h>
#include <map>
#include <vector>
#include <deque>
#define ll long long int
using namespace std;

int main(){

//	ios::sync_with_stdio(false);
//	cin.tie(nullptr);
	ll m;
	cin>>m;
	vector<double>vectorr;
	unordered_map<double,ll>mapa;
	for(ll i=0;i<m;i++){
	char x1,x2,x3,x4;
	double x;
	int a,b,c;
	cin>>x1;

	cin>>a;
	cin>>x2>>b>>x3>>x4>>c;

	x=(a+b)*1.0/c*1.0;
	mapa[x]++;
	vectorr.push_back(x);
	}

	for(ll i=0;i<vectorr.size();i++){
		cout<<mapa[vectorr[i]]<<" ";
		}

}


#include <iostream>
#include <math.h>
#include <bits/stdc++.h>
#include <map>
#include <vector>
#include <deque>
#define ll long long int
using namespace std;

int main(){

//	ios::sync_with_stdio(false);
//	cin.tie(nullptr);
	ll m;
	cin>>m;
	vector<double>vectorr;
	unordered_map<double,ll>mapa;
	for(ll i=0;i<m;i++){
	char x1,x2,x3,x4;
	double x;
	int a,b,c;
	cin>>x1;

	cin>>a;
	cin>>x2>>b>>x3>>x4>>c;

	x=(double(a+b))/c*1.0;
	mapa[x]++;
	vectorr.push_back(x);
	}

	for(ll i=0;i<vectorr.size();i++){
		cout<<mapa[vectorr[i]]<<" ";
		}

}


using System;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.Collections.Generic;
namespace CF {
    class Solution {
        //private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);

        static void Main(string[] args) {
            int n = Convert.ToInt32(Console.ReadLine());
            string s1 = Console.ReadLine();
            string s2 = Console.ReadLine();
            int[] arr1 = new int[10];
            int[] arr2 = new int[10];
            int min = n;
            int max = 0;
            int temp = 0, temp2 = 0;
            for(int i = 0; i <= 9; i++) {
                arr1[i] = s1.Count(x => x == (char)i.ToString()[0]);
                arr2[i] = s2.Count(x => x == (char)i.ToString()[0]);
            }
            for(int i = 0; i <= 9; i++) {
                temp += arr1[i];
                min -= Math.Min(temp, arr2[i]);
                temp -= Math.Min(temp, arr2[i]);
                if(i!=0) {
                    temp2 += arr1[i - 1];
                    max += Math.Min(temp2, arr2[i]);
                    temp2 -= Math.Min(temp2, arr2[i]);
                }
            }

            Console.WriteLine(min);
            Console.WriteLine(max);
        }

        /*private static int Next() {
            int c;
            int m = 1;
            do {
                c = reader.Read();
                if (c == '-')
                    m = -1;
            } while (c < '0' || c > '9');
            int res = c - '0';
            while (true) {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return m*res;
                res *= 10;
                res += c - '0';
            }
        }*/
    }
}


    using System;
    using System.IO;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

namespace timusCsharp //
{
    static class Program
    {
        static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            var s1 = Console.ReadLine();
            var s2 = Console.ReadLine();
            var arr1 = new List<int>();
            var arr2 = new List<int>();
            var count1 = new int[10];
            var count2 = new int[10];
            for (int i = 0; i < n; i++)
            {
                arr1.Add(s1[i] - '0');
                count1[arr1[i]]++;
                arr2.Add(s2[i] - '0');
                count2[arr2[i]]++;
            }

            int min = Math.Min(count1[9], count2[9]);
            count1[9] -= min;
            count2[9] -= min;
            for (int i = 8; i >= 0; i--)
            {
                min = Math.Min(count1[i], count2[i] + count2[i + 1]);
                count1[i] -= min;
                count2[i] = count2[i] + count2[i + 1] - min;
            }
            int sum = 0;
            for (int i = 0; i < 10; i++)
            {
                sum += count1[i];
                count1[i] = 0;
                count2[i] = 0;
            }
            Console.WriteLine(sum);

            for (int i = 0; i < n; i++)
            {
                count1[arr1[i]]++;
                count2[arr2[i]]++;
            }

            sum = 0;
            for (int i = 8; i >= 0; i--)
            {
                min = Math.Min(count1[i], count2[i + 1]);
                count2[i] += count2[i + 1] - min;
                sum += min;
            }
            Console.WriteLine(sum);

        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Problem777B
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string sherCard = Console.ReadLine();
            string moriCard = Console.ReadLine();
            int[] sherNum = new int[n];
            int[] moriNum = new int[n];
            for (int i = 0; i < n; i++)
            {
                sherNum[i] = sherCard[i];
                moriNum[i] = moriCard[i];
            }
            Array.Sort(sherNum);
            Array.Sort(moriNum);
            int indexSher = 0;
            int indexMori = 0;
            int maxFlicksSher = 0;
            int minFlicksMori = n;
            while (indexSher < n && indexMori < n)
            {
                if (moriNum[indexMori] > sherNum[indexSher])
                {
                    maxFlicksSher++;
                    indexSher++;
                    indexMori++;
                }
                else indexMori++;
            }
            indexMori = 0;
            indexSher = 0;
            while (indexSher < n && indexMori < n)
            {
                if (moriNum[indexMori] >= sherNum[indexSher])
                {
                    minFlicksMori--;
                    indexSher++;
                    indexMori++;
                }
                else
                    indexMori++;
            }
            Console.WriteLine(minFlicksMori + "\n" + maxFlicksSher);
            //Console.ReadLine();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Problem777B
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int sherCard = int.Parse(Console.ReadLine());
            int moriCard = int.Parse(Console.ReadLine());
            int[] sherNum = new int[n];
            int[] moriNum = new int[n];
            for (int i = 0; i < n; i++)
            {
                sherNum[i] = sherCard % 10;
                sherCard /= 10;
                moriNum[i] = moriCard % 10;
                moriCard /= 10;
            }
            Array.Sort(sherNum);
            Array.Sort(moriNum);
            int indexSher = 0;
            int indexMori = 0;
            int maxFlicksSher = 0;
            int minFlicksMori = n;
            while (indexSher < n && indexMori < n)
            {
                if (moriNum[indexMori] > sherNum[indexSher])
                {
                    maxFlicksSher++;
                    indexSher++;
                    indexMori++;
                }
                else indexMori++;
            }
            indexMori = 0;
            indexSher = 0;
            while (indexSher < n && indexMori < n)
            {
                if (moriNum[indexMori] >= sherNum[indexSher])
                {
                    minFlicksMori--;
                    indexSher++;
                    indexMori++;
                }
                else
                    indexMori++;
            }
            Console.WriteLine(minFlicksMori + "\n" + maxFlicksSher);
            //Console.ReadLine();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Problem777B
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            long sherCard = int.Parse(Console.ReadLine());
            long moriCard = int.Parse(Console.ReadLine());
            long[] sherNum = new long[n];
            long[] moriNum = new long[n];
            for (int i = 0; i < n; i++)
            {
                sherNum[i] = sherCard % 10;
                sherCard /= 10;
                moriNum[i] = moriCard % 10;
                moriCard /= 10;
            }
            Array.Sort(sherNum);
            Array.Sort(moriNum);
            int indexSher = 0;
            int indexMori = 0;
            int maxFlicksSher = 0;
            int minFlicksMori = n;
            while (indexSher < n && indexMori < n)
            {
                if (moriNum[indexMori] > sherNum[indexSher])
                {
                    maxFlicksSher++;
                    indexSher++;
                    indexMori++;
                }
                else indexMori++;
            }
            indexMori = 0;
            indexSher = 0;
            while (indexSher < n && indexMori < n)
            {
                if (moriNum[indexMori] >= sherNum[indexSher])
                {
                    minFlicksMori--;
                    indexSher++;
                    indexMori++;
                }
                else
                    indexMori++;
            }
            Console.WriteLine(minFlicksMori + "\n" + maxFlicksSher);
            //Console.ReadLine();
        }
    }
}


using System;
 class Program
    {
        public static void Main(string[] args)
        {
             int[] sherlok;
            int[] moriarty;
            {
                string[] input = Console.In.ReadToEnd().Split(new char[] { '\n', '\r'}, StringSplitOptions.RemoveEmptyEntries);
                sherlok = new int[int.Parse(input[0])];
                moriarty = new int[sherlok.Length];
                for(int i = 0; i<sherlok.Length; i++)
                {
                    sherlok[i] = input[1][i];
                    moriarty[i] = input[2][i];
                }
            }
            Array.Sort(sherlok);
            Array.Sort(moriarty);
            int res = 0;
            for (int i = 0, j = 0; i < sherlok.Length; ++i)
            {
                if (moriarty[i] >= sherlok[j]) j++;
                else res++;
            }
            Console.WriteLine(res);
            res = sherlok.Length;
            for(int i = 0, j = 0; i<sherlok.Length; ++i)
            {
                if (moriarty[i] > sherlok[j]) j++;
                else res--;
            }
            Console.WriteLine(res);
        }
    }


using System;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace Codeforces
{
	internal class Template
	{
		private void Solve()
		{
			var n = cin.NextInt();
			var s = cin.NextString();
			var m = cin.NextString();
			var mor = new int[10];
			var mor2 = new int[10];
			for (var i = 0; i < m.Length; i++)
			{
				mor[m[i] - '0']++;
				mor2[m[i] - '0']++;
			}
			var min = 0;
			var max = 0;
			for (var i = 0; i < s.Length; i++)
			{
				var val = s[i] - '0';
				var found = false;
				for (var j = val; j < mor.Length; j++)
				{
					if (mor[j] > 0)
					{
						mor[j]--;
						found = true;
						break;
					}
				}
				if (!found)
				{
					min++;
				}

				for (var j = val + 1; j < mor2.Length; j++)
				{
					if (mor2[j] > 0)
					{
						mor2[j]--;
						max++;
						break;
					}
				}
			}
			Console.WriteLine(min);
			Console.WriteLine(max);
		}

		private static readonly Scanner cin = new Scanner();

		private static void Main()
		{
#if DEBUG
			var inputText = File.ReadAllText(@"..\..\input.txt");
			var testCases = inputText.Split(new[] { "input" }, StringSplitOptions.RemoveEmptyEntries);
			var consoleOut = Console.Out;
			for (var i = 0; i < testCases.Length; i++)
			{
				var parts = testCases[i].Split(new[] { "output" }, StringSplitOptions.RemoveEmptyEntries);
				Console.SetIn(new StringReader(parts[0].Trim()));
				var stringWriter = new StringWriter();
				Console.SetOut(stringWriter);
				var sw = Stopwatch.StartNew();
				new Template().Solve();
				sw.Stop();
				var output = stringWriter.ToString();

				Console.SetOut(consoleOut);
				var color = ConsoleColor.Green;
				var status = "Passed";
				if (parts[1].Trim() != output.Trim())
				{
					color = ConsoleColor.Red;
					status = "Failed";
				}
				Console.ForegroundColor = color;
				Console.WriteLine("Test {0} {1} in {2}ms", i + 1, status, sw.ElapsedMilliseconds);
			}
			Console.ReadLine();
			Console.ReadKey();
#else
			new Template().Solve();
			Console.ReadLine();
#endif
		}
	}

	internal class Scanner
	{
		private string[] s = new string[0];
		private int i;
		private readonly char[] cs = { ' ' };

		public string NextString()
		{
			if (i < s.Length) return s[i++];
			var line = Console.ReadLine() ?? string.Empty;
			s = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			i = 1;
			return s.First();
		}

		public double NextDouble()
		{
			return double.Parse(NextString());
		}

		public int NextInt()
		{
			return int.Parse(NextString());
		}

		public long NextLong()
		{
			return long.Parse(NextString());
		}
	}
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using static System.Math;

namespace Olymp
{
  public class ProblemSolver
  {
    private Tokenizer input;

    public void Solve()
    {

      int n = input.ReadInt();
      var a = input.ReadToken().Select(Convert.ToInt32).ToList();
      var b = input.ReadToken().Select(Convert.ToInt32).ToList();
      a.Sort();
      b.Sort();
      int ans1 = 0;
      for (int i = 0; i < n; i++)
      {
        if (a[i] > b[i])
          ans1++;
      }
      Console.WriteLine(ans1);
      int ans2 = 0;
      for (int i = 0; i < n; i++)
      {
        bool success = false;
        for (int j = 0; j < b.Count; j++)
        {
          if (b[j] > a[i])
          {
            ans2++;
            b.RemoveAt(j);
            success = true;
            break;
          }
        }
        if (!success)
          b.RemoveAt(b.Count - 1);
      }
      Console.WriteLine(ans2);
    }

    private bool OnOneLine(int xa, int ya, int xb, int yb, int xc, int yc)
    {
      return (yb - yc) * xa + (xc - xb) * ya + (xb * yc - xc * yb) == 0;
    }

    public ProblemSolver(TextReader input)
    {
      this.input = new Tokenizer(input);
    }

    #region Service functions

    private static int GCD(int a, int b)
    {
      while (b != 0)
      {
        a %= b;
        int t = b;
        b = a;
        a = t;
      }
      return a;
    }

    #endregion
  }

  #region Service classes

  public class Tokenizer
  {
    private TextReader reader;

    public int ReadInt()
    {
      var c = SkipWS();
      if (c == -1)
        throw new EndOfStreamException();
      bool isNegative = false;
      if (c == '-' || c == '+')
      {
        isNegative = c == '-';
        c = this.reader.Read();
        if (c == -1)
          throw new InvalidOperationException();
      }
      if (!char.IsDigit((char)c))
        throw new InvalidOperationException();
      int result = (char)c - '0';
      c = this.reader.Read();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        if (!char.IsDigit((char)c))
          throw new InvalidOperationException();
        result = result * 10 + (char)c - '0';
        c = this.reader.Read();
      }
      if (isNegative)
        result = -result;
      return result;
    }

    public string ReadLine()
    {
      return reader.ReadLine();
    }

    public long ReadLong()
    {
      return long.Parse(this.ReadToken());
    }

    public double ReadDouble()
    {
      return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);
    }

    public int[] ReadIntArray(int n)
    {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = ReadInt();
      return a;
    }

    public long[] ReadLongArray(int n)
    {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = ReadLong();
      return a;
    }

    public double[] ReadDoubleArray(int n)
    {
      double[] a = new double[n];
      for (int i = 0; i < n; i++)
        a[i] = ReadDouble();
      return a;
    }

    public string ReadToken()
    {
      var c = SkipWS();
      if (c == -1)
        return null;
      var sb = new StringBuilder();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        sb.Append((char)c);
        c = this.reader.Read();
      }
      return sb.ToString();
    }

    private int SkipWS()
    {
      int c = this.reader.Read();
      if (c == -1)
        return c;
      while (c > 0 && char.IsWhiteSpace((char)c))
        c = this.reader.Read();
      return c;
    }

    public Tokenizer(TextReader reader)
    {
      this.reader = reader;
    }
  }

  class Program
  {
    public static void Main(string[] args)
    {
      var solver = new ProblemSolver(Console.In);
      solver.Solve();
    }
  }

  #endregion
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using static System.Math;

namespace Olymp
{
  public class ProblemSolver
  {
    private Tokenizer input;

    public void Solve()
    {

      int n = input.ReadInt();
      var a = input.ReadToken().Select(Convert.ToInt32).ToList();
      var b = input.ReadToken().Select(Convert.ToInt32).ToList();
      a.Sort();
      b.Sort();

      int ans1 = 0;
      var c1 = new List<int>(b);
      for (int i = 0; i < n; i++)
      {
        bool success = false;
        for (int j = 0; j < c1.Count; j++)
        {
          if (c1[j] >= a[i])
          {
            c1.RemoveAt(j);
            success = true;
            break;
          }
        }
        if (!success)
        {
          ans1++;
          c1.RemoveAt(c1.Count - 1);
        }
      }
      Console.WriteLine(ans1);

      int ans2 = 0;
      var c2 = new List<int>(b);
      for (int i = 0; i < n; i++)
      {
        bool success = false;
        for (int j = 0; j < c2.Count; j++)
        {
          if (c2[j] > a[i])
          {
            ans2++;
            c2.RemoveAt(j);
            success = true;
            break;
          }
        }
        if (!success)
          c2.RemoveAt(c2.Count - 1);
      }
      Console.WriteLine(ans2);
    }

    private bool OnOneLine(int xa, int ya, int xb, int yb, int xc, int yc)
    {
      return (yb - yc) * xa + (xc - xb) * ya + (xb * yc - xc * yb) == 0;
    }

    public ProblemSolver(TextReader input)
    {
      this.input = new Tokenizer(input);
    }

    #region Service functions

    private static int GCD(int a, int b)
    {
      while (b != 0)
      {
        a %= b;
        int t = b;
        b = a;
        a = t;
      }
      return a;
    }

    #endregion
  }

  #region Service classes

  public class Tokenizer
  {
    private TextReader reader;

    public int ReadInt()
    {
      var c = SkipWS();
      if (c == -1)
        throw new EndOfStreamException();
      bool isNegative = false;
      if (c == '-' || c == '+')
      {
        isNegative = c == '-';
        c = this.reader.Read();
        if (c == -1)
          throw new InvalidOperationException();
      }
      if (!char.IsDigit((char)c))
        throw new InvalidOperationException();
      int result = (char)c - '0';
      c = this.reader.Read();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        if (!char.IsDigit((char)c))
          throw new InvalidOperationException();
        result = result * 10 + (char)c - '0';
        c = this.reader.Read();
      }
      if (isNegative)
        result = -result;
      return result;
    }

    public string ReadLine()
    {
      return reader.ReadLine();
    }

    public long ReadLong()
    {
      return long.Parse(this.ReadToken());
    }

    public double ReadDouble()
    {
      return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);
    }

    public int[] ReadIntArray(int n)
    {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = ReadInt();
      return a;
    }

    public long[] ReadLongArray(int n)
    {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = ReadLong();
      return a;
    }

    public double[] ReadDoubleArray(int n)
    {
      double[] a = new double[n];
      for (int i = 0; i < n; i++)
        a[i] = ReadDouble();
      return a;
    }

    public string ReadToken()
    {
      var c = SkipWS();
      if (c == -1)
        return null;
      var sb = new StringBuilder();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        sb.Append((char)c);
        c = this.reader.Read();
      }
      return sb.ToString();
    }

    private int SkipWS()
    {
      int c = this.reader.Read();
      if (c == -1)
        return c;
      while (c > 0 && char.IsWhiteSpace((char)c))
        c = this.reader.Read();
      return c;
    }

    public Tokenizer(TextReader reader)
    {
      this.reader = reader;
    }
  }

  class Program
  {
    public static void Main(string[] args)
    {
      var solver = new ProblemSolver(Console.In);
      solver.Solve();
    }
  }

  #endregion
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Selbani
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            string m = Console.ReadLine();

            int[] mor = new int[10];
            int[] ser = new int[10];
            for (int i = 0; i < n;i++)
            {
                int digit = int.Parse(s[i].ToString());
                ser[digit]++;
                digit = int.Parse(m[i].ToString());
                mor[digit]++;
            }

            int max = 0;
            int k = 0;

            for (int i = 1; i <= 9;i++)
            {
                if (mor[i]>k+ser[i-1])
                {
                    max += k + ser[i - 1];
                    k = 0;
                }
                else
                {
                    max += mor[i];
                    k = k + ser[i] - mor[i];
                }
            }

            int min = 0;
            k = 0;
            for (int i = 9; i > 0;i--)
            {
                if (ser[i]>k+mor[i])
                {
                   min += ser[i]-k - mor[i];
                   k = 0;
                }
                else
                {
                    k = k + mor[i] - ser[i];
                }
            }

            Console.WriteLine(min);
            Console.WriteLine(max);

        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Selbani
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            string m = Console.ReadLine();

            int[] mor = new int[10];
            int[] ser = new int[10];
            for (int i = 0; i < n;i++)
            {
                int digit = int.Parse(s[i].ToString());
                ser[digit]++;
                digit = int.Parse(m[i].ToString());
                mor[digit]++;
            }

            int max = 0;
            int k = 0;

            for (int i = 1; i <= 9;i++)
            {
                if (mor[i]>k+ser[i-1])
                {
                    max += k + ser[i - 1];
                    k = 0;
                }
                else
                {
                    max += mor[i];
                    k = k + ser[i-1] - mor[i];
                }
            }

            int min = 0;
            k = 0;
            for (int i = 9; i > 0;i--)
            {
                if (ser[i]>k+mor[i])
                {
                   min += ser[i]-k - mor[i];
                   k = 0;
                }
                else
                {
                    k = k + mor[i] - ser[i];
                }
            }

            Console.WriteLine(min);
            Console.WriteLine(max);

        }
    }
}


using System;
using System.IO;
using System.Text;

namespace Game_of_Credit_Cards
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            int n = Next();

            var sh = new int[10];
            for (int i = 0; i < n; i++)
            {
                sh[Next(true)]++;
            }

            var mo = new int[10];
            for (int i = 0; i < n; i++)
            {
                mo[Next(true)]++;
            }

            int remain = 0;
            int flicks = 0;
            for (int i = 10 - 1; i >= 0; i--)
            {
                if (sh[i] <= mo[i] + remain)
                {
                    remain = mo[i] + remain - sh[i];
                }
                else
                {
                    flicks += sh[i] - (mo[i] + remain);
                    remain = 0;
                }
            }
            writer.WriteLine(flicks);

            flicks = 0;

            for (int i = 0; i < 10; i++)
            {
                int j = i + 1;
                while (j < mo.Length && sh[i] > 0)
                {
                    int sub = Math.Min(sh[i], mo[j]);
                    if (sub > 0)
                    {
                        sh[i] -= sub;
                        mo[j] -= sub;
                        flicks += sub;
                    }
                    else
                    {
                        j++;
                    }
                }
            }
            writer.WriteLine(flicks);

            writer.Flush();
        }

        private static int Next(bool one = false)
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            if (one)
                return res;
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}


using System;

namespace _777B
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string a = Console.ReadLine(), b = Console.ReadLine();
            int[] aCnt = new int[10], bCnt = new int[10];
            for (int i = 0; i < n; i++)
            {
                aCnt[a[i] - '0']++;
                bCnt[b[i] - '0']++;
            }
            int result1 = 0, result2 = 0;
            int[] aCnt_ = new int[10], bCnt_ = new int[10];
            // Result 1
            aCnt.CopyTo(aCnt_, 0); bCnt.CopyTo(bCnt_, 0);
            for (int i = 0; i < 10; i++)
            {
                int addToRes = aCnt_[i];
                for (int j = i; j < 10 && addToRes > 0; j++)
                {
                    int diff = Math.Min(addToRes, bCnt_[j]);
                    addToRes -= diff;
                    bCnt_[j] -= diff;
                }
                result1 += addToRes;
            }
            // Result 2
            aCnt.CopyTo(aCnt_, 0); bCnt.CopyTo(bCnt_, 0);
            for (int i = 0; i < 10; i++)
            {
                int addToRes = 0;
                for (int j = i + 1; j < 10 && aCnt_[i] > 0; j++)
                {
                    int diff = Math.Min(aCnt_[i], bCnt_[j]);
                    addToRes += diff;
                    aCnt_[i] -= diff;
                    bCnt_[j] -= diff;
                }
                result2 += addToRes;
            }
            Console.WriteLine(result1);
            Console.WriteLine(result2);
        }
    }
}


using System;
using System.Collections.Generic;

namespace Solution
{
	class Solution
	{
		static void Main()
		{
			var n = int.Parse(Console.ReadLine());
			var a = Console.ReadLine();
			var b = Console.ReadLine();

			var sherlock = new List<int>();
			var moriarti = new List<int>();

			for (int i = 0; i < n; i++)
			{
				sherlock.Add(int.Parse(a[i].ToString));
				moriarti.Add(int.Parse(b[i].ToString));
			}

			sherlock.Sort();
			moriarti.Sort();

			j = 0;

			foreach (var m in moriarti)
				if (m >= sherlock[j])
					j++;

			Console.WriteLine(n - j);

			j = 0;

			foreach (var m in moriarti)
				if (m > sherlock[j])
					j++;

			Console.WriteLine(j);
		}
	}
}


using System;
using System.Collections.Generic;

namespace Solution
{
	class Solution
	{
		static void Main()
		{
			var n = int.Parse(Console.ReadLine());
			var a = Console.ReadLine();
			var b = Console.ReadLine();

			var sherlock = new List<int>();
			var moriarti = new List<int>();

			for (int i = 0; i < n; i++)]
			{
				sherlock.Add(int.Parse(a[i].ToString));
				moriarti.Add(int.Parse(b[i].ToString));
			}

			sherlock.Sort();
			moriarti.Sort();

			j = 0;

			foreach (var m in moriarti)
				if (m >= sherlock[j])
					j++;

			Console.WriteLine(n - j);

			j = 0;

			foreach (var m in moriarti)
				if (m > sherlock[j])
					j++;

			Console.WriteLine(j);
		}
	}
}