#include <iostream>
#include <string.h>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdlib>
#include <limits.h>
#include <vector>
#include <string>
#include <ctype.h>
#include <complex>
#include <cmath>
using namespace             std;
const int                   Maxn=3000,Maxm=2500000,Mo=1000000007,oo=INT_MAX>>2;
int                         n,m,ans,i,j,
a[Maxn],b[Maxn],sa[Maxn],sb[Maxn],vis[Maxn][Maxn],f[Maxn][Maxn];
double                      sumxf,xf[Maxn];
string                      s1,s2;
int dfs(int l,int r)
{
    if (vis[l][r]) return f[l][r];
    if (l==n) return f[l][r]=(a[l]==b[r]);
    if (r==m) return 0;
    vis[l][r]=1;
    int p=dfs(l+1,r+1);
    if (p>0&&a[l]==b[r]) f[l][r]=p+1;
    return f[l][r];
}
map<int, int> mp;
int main()
{
    ios::sync_with_stdio(0);
    //freopen("/Users/MAC/Desktop/Error202/Error202/1.in","r",stdin);
    //freopen("/Users/MAC/Desktop/Error202/Error202/1.out","w",stdout);
    cin>>s1>>s2;
    n=s1.size();
    m=s2.size();
    for (int i=1;i<=n;i++) sa[i]=a[i]=s1[i-1]-'0';
    for (int i=1;i<=m;i++) sb[i]=b[i]=s2[i-1]-'0';
    for (int i=2;i<=n;i++) sa[i]+=sa[i-1];
    for (int i=2;i<=m;i++) sb[i]+=sb[i-1];
    if (sa[n]%2==1) {
        a[++n]=1; sa[n]=sa[n-1]+1;
    }

    for (i=1;i<=n;i++)
        dfs(i,1);
    int ck=0;
    //cout<<f[n][1]<<endl;
    for (i=1;i<=n+1;i++)
    {
        if (f[i][1]==n-i+1)
        {
                int c1=sa[i-1];
                int c2=sb[m]-sb[n-i+1];
                if (n-i+1<m&&b[n-i+2]==0&&sa[n]%2==1) c1--;
                if (n-i+1<m&&b[n-i+2]==1&&sa[n]%2==1) c1++;
                if (c1>=c2) ck=1;
        }
    }
    if(ck) cout<<"YES\n"; else cout<<"NO\n";

}


#include <iostream>
#include <string.h>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdlib>
#include <limits.h>
#include <vector>
#include <string>
#include <ctype.h>
#include <complex>
#include <cmath>
using namespace             std;
const int                   Maxn=3000,Maxm=2500000,Mo=1000000007,oo=INT_MAX>>2;
int                         n,m,ans,i,j,a[Maxn],b[Maxn],sa[Maxn],sb[Maxn],nt[Maxn],rd0,ar0;
double                      sumxf,xf[Maxn];
string                      s1,s2;
map<int, int> mp;
int main()
{
    ios::sync_with_stdio(0);
//
    //freopen("/Users/MAC/Desktop/Error202/Error202/1.in","r",stdin);
    //freopen("/Users/MAC/Desktop/Error202/Error202/1.out","w",stdout);
    cin>>s1>>s2;
    int n=s1.size();
    int m=s2.size();
    for (int i=1;i<=n;i++) sa[i]=a[i]=s1[i-1]-'0';
    for (int i=1;i<=m;i++) sb[i]=b[i]=s2[i-1]-'0';
    for (int i=2;i<=n;i++) sa[i]+=sa[i-1];
    for (int i=2;i<=m;i++) sb[i]+=sb[i-1];
    nt[1]=0;
    for (int i=2;i<=n;i++)
    {
        while (j&&a[j+1]!=a[i]) j=nt[j];
        if (a[j+1]==a[i]) j++;
        nt[i]=j;
    }
    int ck=0;
    for (i=1;i<=n;i++)
    {
        int k=i-1;
        for (j=1;j<=m;j++){
            while (k>=i&&b[j]!=a[k+1]) k=nt[k];
            if (k<i-1) k=i-1;
            if (b[j]==a[k+1]) k++;
            if (k==n)
            {
                k=nt[k]; if (k<i-1) k=i-1;
                int c1=sa[i-1];
                int c2=sb[m]-sb[n-i+1];
                if (n-i+1<m&&b[n-i+2]==0&&sa[n]%2==1) c1--;
                if (n-i+1<m&&b[n-i+2]==1&&sa[n]%2==1) c1++;
                if (c1>=c2) ck=1;
            }
        }
    }
    if(ck) cout<<"YES\n"; else cout<<"NO\n";

}


#include <iostream>
#include <string.h>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdlib>
#include <limits.h>
#include <vector>
#include <string>
#include <ctype.h>
#include <complex>
#include <cmath>
using namespace             std;
const int                   Maxn=3000,Maxm=2500000,Mo=1000000007,oo=INT_MAX>>2;
int                         n,m,ans,i,j,
a[Maxn],b[Maxn],sa[Maxn],sb[Maxn],vis[Maxn][Maxn],f[Maxn][Maxn];
double                      sumxf,xf[Maxn];
string                      s1,s2;
int dfs(int l,int r)
{
    if (vis[l][r]) return f[l][r];
    if (l==n) return a[l]==b[r];
    if (r==m) return 0;
    vis[l][r]=1;
    int p=dfs(l+1,r+1);
    if (p>0&&a[l]==b[r]) f[l][r]=p+1;
    return f[l][r];
}
map<int, int> mp;
int main()
{
    ios::sync_with_stdio(0);
    //freopen("/Users/MAC/Desktop/Error202/Error202/1.in","r",stdin);
    //freopen("/Users/MAC/Desktop/Error202/Error202/1.out","w",stdout);
    cin>>s1>>s2;
    n=s1.size();
    m=s2.size();
    for (int i=1;i<=n;i++) sa[i]=a[i]=s1[i-1]-'0';
    for (int i=1;i<=m;i++) sb[i]=b[i]=s2[i-1]-'0';
    for (int i=2;i<=n;i++) sa[i]+=sa[i-1];
    for (int i=2;i<=m;i++) sb[i]+=sb[i-1];

    for (i=1;i<=n;i++) dfs(i,1);
    int ck=0;
    for (i=1;i<=n;i++)
    {
        if (f[i][1])
        {
                int c1=sa[i-1];
                int c2=sb[m]-sb[n-i+1];
                if (n-i+1<m&&b[n-i+2]==0&&sa[n]%2==1) c1--;
                if (n-i+1<m&&b[n-i+2]==1&&sa[n]%2==1) c1++;
                if (c1>=c2) ck=1;
        }
    }
    if(ck) cout<<"YES\n"; else cout<<"NO\n";

}


#include <iostream>
#include <string.h>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdlib>
#include <limits.h>
#include <vector>
#include <string>
#include <ctype.h>
#include <complex>
#include <cmath>
using namespace             std;
const int                   Maxn=3000,Maxm=2500000,Mo=1000000007,oo=INT_MAX>>2;
int                         n,m,ans,i,j,
a[Maxn],b[Maxn],sa[Maxn],sb[Maxn],vis[Maxn][Maxn],f[Maxn][Maxn];
double                      sumxf,xf[Maxn];
string                      s1,s2;
int dfs(int l,int r)
{
    if (vis[l][r]) return f[l][r];
    if (l==n) return a[l]==b[r];
    if (r==m) return 0;
    vis[l][r]=1;
    int p=dfs(l+1,r+1);
    if (p>0&&a[l]==b[r]) f[l][r]=p+1;
    return f[l][r];
}
map<int, int> mp;
int main()
{
    ios::sync_with_stdio(0);
    //freopen("/Users/MAC/Desktop/Error202/Error202/1.out","w",stdout);
    cin>>s1>>s2;
    n=s1.size();
    m=s2.size();
    for (int i=1;i<=n;i++) sa[i]=a[i]=s1[i-1]-'0';
    for (int i=1;i<=m;i++) sb[i]=b[i]=s2[i-1]-'0';
    for (int i=2;i<=n;i++) sa[i]+=sa[i-1];
    for (int i=2;i<=m;i++) sb[i]+=sb[i-1];

    for (i=1;i<=n;i++) dfs(i,1);
    int ck=0;
    for (i=1;i<=n;i++)
    {
        if (f[i][1]==n-i+1)
        {
                int c1=sa[i-1];
                int c2=sb[m]-sb[n-i+1];
                if (n-i+1<m&&b[n-i+2]==0&&sa[n]%2==1) c1--;
                if (n-i+1<m&&b[n-i+2]==1&&sa[n]%2==1) c1++;
                if (c1>=c2) ck=1;
        }
    }
    if(ck) cout<<"YES\n"; else cout<<"NO\n";

}


#include <iostream>
#include <string.h>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdlib>
#include <limits.h>
#include <vector>
#include <string>
#include <ctype.h>
#include <complex>
#include <cmath>
using namespace             std;
const int                   Maxn=3000,Maxm=2500000,Mo=1000000007,oo=INT_MAX>>2;
int                         n,m,ans,i,j,
a[Maxn],b[Maxn],sa[Maxn],sb[Maxn],vis[Maxn][Maxn],f[Maxn][Maxn];
double                      sumxf,xf[Maxn];
string                      s1,s2;
int dfs(int l,int r)
{
    if (vis[l][r]) return f[l][r];
    if (l==n) return f[l][r]=(a[l]==b[r]);
    if (r==m) return 0;
    vis[l][r]=1;
    int p=dfs(l+1,r+1);
    if (p>0&&a[l]==b[r]) f[l][r]=p+1;
    return f[l][r];
}
map<int, int> mp;
int main()
{
    ios::sync_with_stdio(0);
    //freopen("/Users/MAC/Desktop/Error202/Error202/1.in","r",stdin);
    //freopen("/Users/MAC/Desktop/Error202/Error202/1.out","w",stdout);
    cin>>s1>>s2;
    n=s1.size();
    m=s2.size();
    for (int i=1;i<=n;i++) sa[i]=a[i]=s1[i-1]-'0';
    for (int i=1;i<=m;i++) sb[i]=b[i]=s2[i-1]-'0';
    for (int i=2;i<=n;i++) sa[i]+=sa[i-1];
    for (int i=2;i<=m;i++) sb[i]+=sb[i-1];
    if (sb[n]%2==1) {
        a[++n]=1; sa[n]=sa[n-1]+1;
    }

    for (i=1;i<=n;i++)
        dfs(i,1);
    int ck=0;
    //cout<<f[n][1]<<endl;
    for (i=1;i<=n+1;i++)
    {
        if (f[i][1]==n-i+1)
        {
                int c1=sa[i-1];
                int c2=sb[m]-sb[n-i+1];
                if (n-i+1<m&&b[n-i+2]==0&&sa[n]%2==1) c1--;
                if (n-i+1<m&&b[n-i+2]==1&&sa[n]%2==1) c1++;
                if (c1>=c2) ck=1;
        }
    }
    if(ck) cout<<"YES\n"; else cout<<"NO\n";

}


#include <iostream>
#include <string.h>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdlib>
#include <limits.h>
#include <vector>
#include <string>
#include <ctype.h>
#include <complex>
#include <cmath>
using namespace             std;
const int                   Maxn=3000,Maxm=2500000,Mo=1000000007,oo=INT_MAX>>2;
int                         n,m,ans,i,j,
a[Maxn],b[Maxn],sa[Maxn],sb[Maxn],vis[Maxn][Maxn],f[Maxn][Maxn];
double                      sumxf,xf[Maxn];
string                      s1,s2;
int dfs(int l,int r)
{
    if (vis[l][r]) return f[l][r];
    if (l==n) return f[l][r]=(a[l]==b[r]);
    if (r==m) return 0;
    vis[l][r]=1;
    int p=dfs(l+1,r+1);
    if (p>0&&a[l]==b[r]) f[l][r]=p+1;
    return f[l][r];
}
map<int, int> mp;
int main()
{
    ios::sync_with_stdio(0);
    //freopen("/Users/MAC/Desktop/Error202/Error202/1.in","r",stdin);
    //freopen("/Users/MAC/Desktop/Error202/Error202/1.out","w",stdout);
    cin>>s1>>s2;
    n=s1.size();
    m=s2.size();
    for (int i=1;i<=n;i++) sa[i]=a[i]=s1[i-1]-'0';
    for (int i=1;i<=m;i++) sb[i]=b[i]=s2[i-1]-'0';
    for (int i=2;i<=n;i++) sa[i]+=sa[i-1];
    for (int i=2;i<=m;i++) sb[i]+=sb[i-1];

    for (i=1;i<=n;i++)
        dfs(i,1);
    int ck=0;
    //cout<<f[n][1]<<endl;
    for (i=1;i<=n;i++)
    {
        if (f[i][1]==n-i+1)
        {
                int c1=sa[i-1];
                int c2=sb[m]-sb[n-i+1];
                if (n-i+1<m&&b[n-i+2]==0&&sa[n]%2==1) c1--;
                if (n-i+1<m&&b[n-i+2]==1&&sa[n]%2==1) c1++;
                if (c1>=c2) ck=1;
        }
    }
    if(ck) cout<<"YES\n"; else cout<<"NO\n";

}


#include<vector>
#include<list>
#include<map>
#include<set>
#include<deque>
#include<queue>
#include<stack>
#include<bitset>
#include<algorithm>
#include<functional>
#include<numeric>
#include<utility>
#include<iostream>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<cstdlib>
#include<cctype>
#include<string>
#include<cstring>
#include<cstdio>
#include<ctime>
#include<climits>
#include<complex>
#include<cassert>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(x) (int)((x).size())
#define all(x) x.begin(),x.end()
#define clr(x) memset((x),0,sizeof(x))
#define cdp(x) memset((x),-1,sizeof(x))
#define rep(i,n) for (i=0;i<n;i++)
#define Rep(i,a,b) for (i=a;i<=b;i++)
#define ff(i,x) for (i=start[x];i!=-1;i=a[i].next)
#define foreach(e,x) for(__typeof(x.begin()) e=x.begin();e!=x.end();++e)
using namespace std;
const double eps=1e-8;
const double pi=acos(-1.0);
int dblcmp(double d){if (fabs(d)<eps)return 0;return d>eps?1:-1;}
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
string s,t;
int main()
{
    int i,j,k;
    cin>>s>>t;
    int x=count(all(s),'1');
    int y=count(all(t),'1');
    if (x>y)
    {
        puts("YES");
        return 0;
    }
    for (i=0;i<sz(s)-1;i++)
    {
        string q=s.substr(i);
        if (q==t)
        {
            puts("YES");
            return 0;
        }
        if (count(all(q),'1')&1)q+="1";
        else q+="0";
        while (sz(q)<sz(t))q+="0";
        if (q==t)
        {
            puts("YES");
            return 0;
        }
    }
    puts("NO");
    return 0;
}
/*
3 3 1000000
1000 2    2
1000 2 2
*/


#include<vector>
#include<list>
#include<map>
#include<set>
#include<deque>
#include<queue>
#include<stack>
#include<bitset>
#include<algorithm>
#include<functional>
#include<numeric>
#include<utility>
#include<iostream>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<cstdlib>
#include<cctype>
#include<string>
#include<cstring>
#include<cstdio>
#include<ctime>
#include<climits>
#include<complex>
#include<cassert>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(x) (int)((x).size())
#define all(x) x.begin(),x.end()
#define clr(x) memset((x),0,sizeof(x))
#define cdp(x) memset((x),-1,sizeof(x))
#define rep(i,n) for (i=0;i<n;i++)
#define Rep(i,a,b) for (i=a;i<=b;i++)
#define ff(i,x) for (i=start[x];i!=-1;i=a[i].next)
#define foreach(e,x) for(__typeof(x.begin()) e=x.begin();e!=x.end();++e)
using namespace std;
const double eps=1e-8;
const double pi=acos(-1.0);
int dblcmp(double d){if (fabs(d)<eps)return 0;return d>eps?1:-1;}
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
string s,t;
int main()
{
    int i,j,k;
    cin>>s>>t;
    int x=count(all(s),'1');
    int y=count(all(t),'1');
    puts(x>=y?"YES":"NO");
    return 0;
}


#include<vector>
#include<list>
#include<map>
#include<set>
#include<deque>
#include<queue>
#include<stack>
#include<bitset>
#include<algorithm>
#include<functional>
#include<numeric>
#include<utility>
#include<iostream>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<cstdlib>
#include<cctype>
#include<string>
#include<cstring>
#include<cstdio>
#include<ctime>
#include<climits>
#include<complex>
#include<cassert>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(x) (int)((x).size())
#define all(x) x.begin(),x.end()
#define clr(x) memset((x),0,sizeof(x))
#define cdp(x) memset((x),-1,sizeof(x))
#define rep(i,n) for (i=0;i<n;i++)
#define Rep(i,a,b) for (i=a;i<=b;i++)
#define ff(i,x) for (i=start[x];i!=-1;i=a[i].next)
#define foreach(e,x) for(__typeof(x.begin()) e=x.begin();e!=x.end();++e)
using namespace std;
const double eps=1e-8;
const double pi=acos(-1.0);
int dblcmp(double d){if (fabs(d)<eps)return 0;return d>eps?1:-1;}
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
string s,t;
int main()
{
    int i,j,k;
    cin>>s>>t;
    int x=count(all(s),'1');
    int y=count(all(t),'1');
    if (x>=y)
    {
        puts("YES");
        return 0;
    }
    for (i=0;i<sz(s)-1;i++)
    {
        string q=s.substr(i);
        if (q==t)
        {
            puts("YES");
            return 0;
        }
        if (count(all(q),'1')&1)q+="1";
        else q+="0";
        while (sz(q)<sz(t))q+="0";
        if (q==t)
        {
            puts("YES");
            return 0;
        }
    }
    puts("NO");
    return 0;
}


#include<vector>
#include<list>
#include<map>
#include<set>
#include<deque>
#include<queue>
#include<stack>
#include<bitset>
#include<algorithm>
#include<functional>
#include<numeric>
#include<utility>
#include<iostream>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<cstdlib>
#include<cctype>
#include<string>
#include<cstring>
#include<cstdio>
#include<ctime>
#include<climits>
#include<complex>
#include<cassert>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(x) (int)((x).size())
#define all(x) x.begin(),x.end()
#define clr(x) memset((x),0,sizeof(x))
#define cdp(x) memset((x),-1,sizeof(x))
#define rep(i,n) for (i=0;i<n;i++)
#define Rep(i,a,b) for (i=a;i<=b;i++)
#define ff(i,x) for (i=start[x];i!=-1;i=a[i].next)
#define foreach(e,x) for(__typeof(x.begin()) e=x.begin();e!=x.end();++e)
using namespace std;
const double eps=1e-8;
const double pi=acos(-1.0);
int dblcmp(double d){if (fabs(d)<eps)return 0;return d>eps?1:-1;}
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
string s,t;
int main()
{
    int i,j,k;
    cin>>s>>t;
    int x=count(all(s),'1');
    int y=count(all(t),'1');
    if (x>=y)
    {
        puts("YES");
        return 0;
    }
    if (x%2==1&&x+1==y)
    {
        puts("YES");
        return 0;
    }
    puts("NO");
    return 0;
}
/*
3 3 1000000
1000 2    2
1000 2 2
*/


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
string x,y;
int sum1=0;
int n,m;
int sum[2];
int main()
{
    cin >> x >> y;
    n=x.size();
    m=y.size();
    for (int i=0;i<n;++i)
    {
        if (x[i]=='1')
        {
            sum1++;
        }
    }
    sum[sum1%2]++;
    for (int i=0;i<=n;++i)
    {
        if (n-i>m)
        {
            continue;
        }
        int ok=1;

                //string t=x.substr(i);
                int j=i;
                for (j=i;j<n;++j)
                {
                    if (y[j-i]!=x[j])
                    {
                        ok=0;
                        break;
                    }
                }
                if (!ok)
                {
                    if (i<n && x[i]=='1')
                    {
                        sum1--;
                        sum[sum1%2]++;
                    }
                    continue;
                }
                int ts1=sum[1];
                int ts0=sum[0];
                while (j-i<m)
                {
                    char cc=y[j-i];
                    if (cc=='1')
                    {
                        ts1--;
                        j++;
                        if (ts1<0 || ts0<0)
                        {
                            ok=0;
                            break;
                        }
                        continue;
                    }
                    else
                    {
                        ts0--;
                    }
                    if (ts1<0 || ts0<0)
                    {
                        ok=0;
                        break;
                    }
                    while (y[j-i]==cc && j-i<m)
                    {
                        j++;
                    }
                }
                if (ok)
                {
                    cout << "YES" << endl;
                    return 0;

                }
                if (i<n && x[i]=='1')
                {
                    sum1--;
                    sum[sum1%2]++;
                }

    }
    cout << "NO" << endl;

    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
string x,y;
int sum1=0;
int n,m;
int sum[2];
int main()
{
    cin >> x >> y;
    n=x.size();
    m=y.size();
    for (int i=0;i<n;++i)
    {
        if (x[i]=='1')
        {
            sum1++;
        }
    }
    sum[sum1%2]++;
    for (int i=0;i<=n;++i)
    {
        if (n-i>m)
        {
            continue;
        }
        int ok=1;

                //string t=x.substr(i);
                int j=i;
                for (j=i;j<n;++j)
                {
                    if (y[j-i]!=x[j])
                    {
                        ok=0;
                        break;
                    }
                }
                if (!ok)
                {
                    if (i<n && x[i]=='1')
                    {
                        sum1--;
                        sum[sum1%2]++;
                    }
                    continue;
                }
                int ts1=sum[1];
                int ts0=sum[0];
                while (j-i<m)
                {
                    char cc=y[j-i];
                    if (cc=='1')
                    {
                        ts1--;
                    }
                    else
                    {
                        ts0--;
                    }
                    if (ts1<0 || ts0<0)
                    {
                        ok=0;
                        break;
                    }
                    while (y[j-i]==cc && j-i<m)
                    {
                        j++;
                    }
                }
                if (ok)
                {
                    cout << "YES" << endl;
                    return 0;

                }
                if (i<n && x[i]=='1')
                {
                    sum1--;
                    sum[sum1%2]++;
                }

    }
    cout << "NO" << endl;

    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
string x,y;
int sum1=0;
int n,m;
bool ad1[2];
int main()
{
    cin >> x >> y;
    n=x.size();
    m=y.size();
    for (int i=0;i<n;++i)
    {
        if (x[i]=='1')
        {
            sum1++;
        }
    }
    ad1[sum1%2]=1;
    for (int i=0;i<n;++i)
    {
        if (n-i>m)
        {
            continue;
        }

            if (ad1[0])
            {
                string t=x.substr(i);
                while (t.size()<m)
                {
                    t+='0';
                }
                if (t==y)
                {
                    cout << "YES" << endl;
                    return 0;

                }
            }
            if (ad1[1])
            {
                string t=x.substr(i);
                t+='1';
                while (t.size()<m)
                {
                    t+='0';
                }
                if (t==y)
                {
                    cout << "YES" << endl;
                    return 0;

                }
            }
            if (x[i]=='1')
            {
                sum1--;
                ad1[sum1%2]=1;
            }

    }
    if (ad1[0])
    {
        string t="";
        while (t.size()<m)
        {
            t+='0';
        }
        if (t==y)
        {
            cout << "YES" << endl;
            return 0;

        }
    }
    if (ad1[1])
    {
        string t="";
        t+='1';
        while (t.size()<m)
        {
            t+='0';
        }
        if (t==y)
        {
            cout << "YES" << endl;
            return 0;

        }
    }
    cout << "NO" << endl;

    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
string x,y;
int sum1=0;
int n,m;
int sum[2];
int main()
{
    cin >> x >> y;
    n=x.size();
    m=y.size();
    for (int i=0;i<n;++i)
    {
        if (x[i]=='1')
        {
            sum1++;
        }
    }
    int sum2=0;
    for (int i=0;i<m;++i)
    {
        if (y[i]=='1')
        {
            sum2++;
        }
    }
    if (sum1%2)
    {
        sum1++;
    }
    if (sum1>=sum2)
    {
        cout << "YES" << endl;
    }
    else

    cout << "NO" << endl;

    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
string x,y;
int sum1=0;
int n,m;
int sum[2];
int main()
{
    cin >> x >> y;
    n=x.size();
    m=y.size();
    for (int i=0;i<n;++i)
    {
        if (x[i]=='1')
        {
            sum1++;
        }
    }
    sum[sum1%2]++;
    int st=sum1%2;
    int numall=1;
    for (int i=0;i<=n;++i)
    {
        if (n-i>m)
        {
            continue;
        }
        int ok=1;

                //string t=x.substr(i);
                int j=i;
                for (j=i;j<n;++j)
                {
                    if (y[j-i]!=x[j])
                    {
                        ok=0;
                        break;
                    }
                }
                if (!ok)
                {
                    if (i<n && x[i]=='1')
                    {
                        numall++;
                    }
                    continue;
                }
                int ts1=numall;
                int ns=st;
                while (j-i<m)
                {
                    char cc=ns+'0';
                    if (cc=='0')
                    {
                        while (y[j-i]=='0' && j-i<m)
                        {
                            j++;
                        }
                    }
                    else
                    {
                        if (y[j-i]=='1')
                        {
                            j++;
                            ts1++;
                        }

                    }

                    ns=1-ns;
                    ts1--;
                    if (ts1<0)
                    {
                        ok=0;
                        break;
                    }
                }
                if (ok && ts1>=0)
                {
                    cout << "YES" << endl;
                    return 0;

                }
                if (i<n && x[i]=='1')
                {
                    sum1--;
                    numall++;
                }

    }
    cout << "NO" << endl;

    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
string x,y;
int sum1=0;
int n,m;
bool ad1[2];
int main()
{
    cin >> x >> y;
    n=x.size();
    m=y.size();
    for (int i=0;i<n;++i)
    {
        if (x[i]=='1')
        {
            sum1++;
        }
    }
    ad1[sum1%2]=1;
    for (int i=0;i<n;++i)
    {
        if (n-i>m)
        {
            continue;
        }

            if (ad1[0])
            {
                string t=x.substr(i);
                while (t.size()<m)
                {
                    t+='0';
                }
                if (t==y)
                {
                    cout << "YES" << endl;
                    return 0;

                }
            }
            if (ad1[1])
            {
                string t=x.substr(i);
                t+='1';
                while (t.size()<m)
                {
                    t+='0';
                }
                if (t==y)
                {
                    cout << "YES" << endl;
                    return 0;

                }
            }
            if (x[i]=='1')
            {
                sum1--;
                ad1[sum1%2]=1;
            }

    }
    cout << "NO" << endl;

    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
string x,y;
int sum1=0;
int n,m;
int sum[2];
int main()
{
    cin >> x >> y;
    n=x.size();
    m=y.size();
    for (int i=0;i<n;++i)
    {
        if (x[i]=='1')
        {
            sum1++;
        }
    }
    sum[sum1%2]++;
    int st=sum1%2;
    int numall=1;
    for (int i=0;i<=n;++i)
    {
        if (n-i>m)
        {
            continue;
        }
        int ok=1;

                //string t=x.substr(i);
                int j=i;
                for (j=i;j<n;++j)
                {
                    if (y[j-i]!=x[j])
                    {
                        ok=0;
                        break;
                    }
                }
                if (!ok)
                {
                    if (i<n && x[i]=='1')
                    {
                        sum1--;
                        numall++;
                    }
                    continue;
                }
                int ts1=numall;
                int ns=st;
                while (j-i<m)
                {
                    char cc=ns+'0';
                    if (cc=='0')
                    {
                        while (y[j-i]=='0' && j-i<m)
                        {
                            j++;
                        }
                    }
                    else
                    {
                        if (y[j-i]=='1')
                        {
                            j++;
                        }
                        ts1++;
                    }
                    ns=1-ns;
                    ts1--;
                }
                if (ts1>=0)
                {
                    cout << "YES" << endl;
                    return 0;

                }
                if (i<n && x[i]=='1')
                {
                    sum1--;
                    numall++;
                }

    }
    cout << "NO" << endl;

    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
string x,y;
int sum1=0;
int n,m;
int sum[2];
int main()
{
    cin >> x >> y;
    n=x.size();
    m=y.size();
    for (int i=0;i<n;++i)
    {
        if (x[i]=='1')
        {
            sum1++;
        }
    }
    int st=sum1%2;
    int numall=1;
    for (int i=0;i<=n;++i)
    {
        int ts1=numall;
        if (i<n && x[i]=='1')
        {
            numall++;
        }
        if (n-i>m)
        {
            continue;
        }
        int ok=1;

                //string t=x.substr(i);
                int j=i;
                for (j=i;j<n;++j)
                {
                    if (y[j-i]!=x[j])
                    {
                        ok=0;
                        break;
                    }
                }
                if (!ok)
                {
                    continue;
                }

                int ns=st;
                while (j-i<m)
                {
                    char cc=ns+'0';
                    if (cc=='0')
                    {
                        while (y[j-i]=='0' && j-i<m)
                        {
                            j++;
                        }
                    }
                    else
                    {
                        if (y[j-i]=='1')
                        {
                            j++;
                            ts1++;
                        }

                    }
                    if (j-i>=m)
                    {
                        break;
                    }

                    ns=1-ns;
                    ts1--;
                    if (ts1<=0)
                    {
                        ok=0;
                        break;
                    }
                }
                if (ok)
                {
                    cout << "YES" << endl;
                    return 0;

                }

    }
    cout << "NO" << endl;

    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
string x,y;
int sum1=0;
int n,m;
int sum[2];
int main()
{
    cin >> x >> y;
    n=x.size();
    m=y.size();
    for (int i=0;i<n;++i)
    {
        if (x[i]=='1')
        {
            sum1++;
        }
    }
    sum[sum1%2]++;
    int st=sum1%2;
    int numall=1;
    for (int i=0;i<=n;++i)
    {
        if (n-i>m)
        {
            if (i<n && x[i]=='1')
            {
                numall++;
            }
            continue;
        }
        int ok=1;

                //string t=x.substr(i);
                int j=i;
                for (j=i;j<n;++j)
                {
                    if (y[j-i]!=x[j])
                    {
                        ok=0;
                        break;
                    }
                }
                if (!ok)
                {
                    if (i<n && x[i]=='1')
                    {
                        numall++;
                    }
                    continue;
                }
                int ts1=numall;
                int ns=st;
                while (j-i<m)
                {
                    char cc=ns+'0';
                    if (cc=='0')
                    {
                        while (y[j-i]=='0' && j-i<m)
                        {
                            j++;
                        }
                    }
                    else
                    {
                        if (y[j-i]=='1')
                        {
                            j++;
                            ts1++;
                        }

                    }

                    ns=1-ns;
                    ts1--;
                    if (ts1<0)
                    {
                        ok=0;
                        break;
                    }
                }
                if (ok && ts1>=0)
                {
                    cout << "YES" << endl;
                    return 0;

                }
                if (i<n && x[i]=='1')
                {
                    numall++;
                }

    }
    cout << "NO" << endl;

    return 0;
}


#include <algorithm>
#include <iterator>
#include <iostream>
#include <utility>
#include <string>
#include <vector>

using namespace std;

int main()
{
	string s1, s2;

	cin >> s1 >> s2;

	int cnt1 = count(s1.begin(), s1.end(), '1');
	int cnt22 = count(s2.begin(), s2.end(), '1');

	int cnt2 = 0;

	int n = s2.size();

	for(int i = 0; i < n; i++)
	{
		if( s2[i] == '1' )
		{
			if( (cnt1 + cnt2) % 2 )
				cnt2++;
			else
				cnt1--, cnt2++;
		}
		else if( s2[i] == '0' )
		{
			if( (cnt1 + cnt2) % 2 ) cnt1--;
		}
	}

	//cout << cnt1 << " " << cnt2 << endl;

	if( cnt1 >= 0 && cnt2 == cnt22 ) cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}


#include <algorithm>
#include <iterator>
#include <iostream>
#include <utility>
#include <string>
#include <vector>

using namespace std;

int main()
{
	string s1, s2;

	cin >> s1 >> s2;

	int cnt1 = count(s1.begin(), s1.end(), '1');
	int cnt2 = count(s2.begin(), s2.end(), '1');

	if( s1 == s2 )
	{
		cout << "YES" << endl;
		return 0;
	}

 	if( (!cnt2 && s1.size() <= s2.size()) || (cnt1 <= cnt2 ) )
		cout << "NO" << endl;
	else
		cout << "YES" << endl;

	return 0;
}


#include <algorithm>
#include <iterator>
#include <iostream>
#include <utility>
#include <string>
#include <vector>

using namespace std;

int main()
{
	string s1, s2;

	cin >> s1 >> s2;

	int cnt1 = count(s1.begin(), s1.end(), '1');
	int cnt22 = count(s2.begin(), s2.end(), '1');

	int cnt2 = 0;

	int n = s2.size();

	for(int i = 0; i < n && cnt1 >= 0; i++)
	{
		if( s2[i] == '1' )
		{
			if( (cnt1 + cnt2) % 2 )
				cnt2++;
			else
				cnt1--, cnt2++;
		}
		else if( s2[i] == '0' )
		{
			if( (cnt1 + cnt2) % 2 ) cnt1--;
		}
	}

	//cout << cnt1 << " " << cnt2 << endl;

	if( cnt1 >= 0 && cnt2 == cnt22 ) cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}


#include <algorithm>
#include <iterator>
#include <iostream>
#include <utility>
#include <string>
#include <vector>

using namespace std;

int main()
{
	string s1, s2;

	cin >> s1 >> s2;

	int cnt1 = count(s1.begin(), s1.end(), '1');
	int cnt2 = count(s2.begin(), s2.end(), '1');

	if( cnt1 + (cnt1 % 2) >= cnt2 )
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	return 0;
}


using namespace std;
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>

#define foreach(x, v) for (typeof (v).begin() x=(v).begin(); x !=(v).end(); ++x)
#define For(i, a, b) for (int i=(a); i<(b); ++i)
#define D(x) cout << #x " is " << x << endl

const int MAXN = 2005;
int border[MAXN];

string a, b;
bool possible(int last){

	for (int j = last-1, i = a.size()-1; j >= 0; --j, i--){
		assert(a[i] == b[j]);
	}

	int n = a.size();
	int j;
	int ones_b = 0;
	int ones_a = 0;
	for (j = 0; j < last; ++j) if (b[j] == '1') ones_b++;
	for (int i = 0; i < n; ++i) if (a[i] == '1') ones_a++;

	if (last == 0 and ones_a % 2 == 1) ones_a++;

	ones_a -= ones_b;
	assert(ones_a >= 0);
	assert(n - last >= 0);
	while (j < (int) b.size()){
		if (b[j] == '0'){
			if ((ones_a + ones_b) % 2 == 1 and ones_a <= 0) return false;
			if ((ones_a + ones_b) % 2 == 1 and ones_a > 0) ones_a--;
			j++;
		}else{
			if ((ones_a + ones_b) % 2 == 0 and ones_a <= 0) return false;
			if ((ones_a + ones_b) % 2 == 0 and ones_a > 0) ones_a--;
			ones_b++;
			j++;
		}
	}

	return true;
}

int main(){
	#ifndef ONLINE_JUDGE
		freopen("in.txt", "r", stdin);
	#endif
	;

	while (cin >> a >> b){
		string s = b + "$" + a;
		int n = s.size();
		border[0] = 0;
		for (int i = 1; i < n; ++i) {
		    border[i] = border[i - 1];
		    while (border[i] > 0 and s[i] != s[border[i]]) {
		        border[i] = border[border[i] - 1];
		    }
		    if (s[i] == s[border[i]]) border[i]++;
		}

		int last = border[n-1];
		bool can = false;
		while(last >= 0 and !can){
			can = possible(last);
			//D(last);
			if (last == 0) break;
			last = border[last-1];
		}
		int ones = 0;
		for (int i = 0; i < a.size(); ++i) if (a[i] == '1') ones++;
		if (ones % 2 == 1) ones++;
		for (int i = 0; i < b.size(); ++i) if (b[i] == '1') ones--;

		// if (can) puts("YES");
		// else puts("NO");

		if ((ones >= 0 and !can) or (can and ones < 0)) puts("Differs");
		else puts("OK");
	}

    return 0;
}


using namespace std;
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>

#define foreach(x, v) for (typeof (v).begin() x=(v).begin(); x !=(v).end(); ++x)
#define For(i, a, b) for (int i=(a); i<(b); ++i)
#define D(x) cout << #x " is " << x << endl

const int MAXN = 2005;
int border[MAXN];

string a, b;
bool possible(int last){
	int j;
	int ones_b = 0;
	int ones_a = 0;
	for (j = 0; j < last; ++j) if (b[j] == '1') ones_b++;
	for (int i = 0; i < (int) a.size(); ++i) if (a[i] == '1') ones_a++;

	ones_a -= ones_b;
	assert(ones_a >= 0);
	while (j < (int) b.size()){
		if (b[j] == '0'){
			if ((ones_a + ones_b) % 2 == 1 and ones_a <= 0) return false;
			if ((ones_a + ones_b) % 2 == 1 and ones_a > 0) ones_a--;
			j++;
		}else{
			if ((ones_a + ones_b) % 2 == 0 and ones_a == 0) return false;
			if ((ones_a + ones_b) % 2 == 0 and ones_a > 0) ones_a--;
			ones_b++;
			j++;
		}
	}

	return true;
}

int main(){
	#ifndef ONLINE_JUDGE
		freopen("in.txt", "r", stdin);
	#endif
	;

	while (cin >> a >> b){
		string s = b + "$" + a;
		int n = s.size();
		border[0] = 0;
		for (int i = 1; i < n; ++i) {
		    border[i] = border[i - 1];
		    while (border[i] > 0 and s[i] != s[border[i]]) {
		        border[i] = border[border[i] - 1];
		    }
		    if (s[i] == s[border[i]]) border[i]++;
		}

		int last = border[n-1];
		bool can = false;
		while(last >= 0 and !can){
			//D(last);
			can = possible(last);
			break;
			if (last == 0) break;
			last = border[last-1];
		}

		if (can) puts("YES");
		else puts("NO");

	}

    return 0;
}


using namespace std;
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>

#define foreach(x, v) for (typeof (v).begin() x=(v).begin(); x !=(v).end(); ++x)
#define For(i, a, b) for (int i=(a); i<(b); ++i)
#define D(x) cout << #x " is " << x << endl

const int MAXN = 2005;
int border[MAXN];

string a, b;
bool possible(int last){
	int j;
	int ones_b = 0;
	int ones_a = 0;
	for (j = 0; j < last; ++j) if (b[j] == '1') ones_b++;
	for (int i = 0; i < (int) a.size(); ++i) if (a[i] == '1') ones_a++;

	ones_a -= ones_b;
	assert(ones_a >= 0);

	while (j < (int) b.size()){
		if (b[j] == '0'){
			if ((ones_a + ones_b) % 2 == 1 and ones_a <= 0) return false;
			if ((ones_a + ones_b) % 2 == 1 and ones_a > 0) ones_a--;
			j++;
		}else{
			if ((ones_a + ones_b) % 2 == 0 and ones_a == 0) return false;
			if ((ones_a + ones_b) % 2 == 0 and ones_a > 0) ones_a--;
			ones_b++;
			j++;
		}
	}

	return true;
}

int main(){
	#ifndef ONLINE_JUDGE
		freopen("in.txt", "r", stdin);
	#endif
	;

	while (cin >> a >> b){
		string s = b + "$" + a;
		int n = s.size();
		border[0] = 0;
		for (int i = 1; i < n; ++i) {
		    border[i] = border[i - 1];
		    while (border[i] > 0 and s[i] != s[border[i]]) {
		        border[i] = border[border[i] - 1];
		    }
		    if (s[i] == s[border[i]]) border[i]++;
		}

		int last = border[n-1];
		bool can = false;
		while(last >= 0 and !can){
			can = possible(last);
			if (last == 0) break;
			last = border[last-1];
		}

		if (can) puts("YES");
		else puts("NO");

	}

    return 0;
}


using namespace std;
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>

#define foreach(x, v) for (typeof (v).begin() x=(v).begin(); x !=(v).end(); ++x)
#define For(i, a, b) for (int i=(a); i<(b); ++i)
#define D(x) cout << #x " is " << x << endl

const int MAXN = 2005;
int border[MAXN];

string a, b;
bool possible(int last){

	for (int j = last-1, i = a.size()-1; j >= 0; --j, i--){
		assert(a[i] == b[j]);
	}

	int n = a.size();
	int j;
	int ones_b = 0;
	int ones_a = 0;
	for (j = 0; j < last; ++j) if (b[j] == '1') ones_b++;
	for (int i = 0; i < n; ++i) if (a[i] == '1') ones_a++;

	if (last == 0 and ones_a % 2 == 1) ones_a++;

	ones_a -= ones_b;
	assert(ones_a >= 0);
	assert(n - last >= 0);
	while (j < (int) b.size()){
		if (b[j] == '0'){
			if ((ones_a + ones_b) % 2 == 1 and ones_a <= 0) return false;
			if ((ones_a + ones_b) % 2 == 1 and ones_a > 0) ones_a--;
			j++;
		}else{
			if ((ones_a + ones_b) % 2 == 0 and ones_a <= 0) return false;
			if ((ones_a + ones_b) % 2 == 0 and ones_a > 0) ones_a--;
			ones_b++;
			j++;
		}
	}

	return true;
}

int main(){
	#ifndef ONLINE_JUDGE
		freopen("in.txt", "r", stdin);
	#endif
	;

	while (cin >> a >> b){
		string s = b + "$" + a;
		int n = s.size();
		border[0] = 0;
		for (int i = 1; i < n; ++i) {
		    border[i] = border[i - 1];
		    while (border[i] > 0 and s[i] != s[border[i]]) {
		        border[i] = border[border[i] - 1];
		    }
		    if (s[i] == s[border[i]]) border[i]++;
		}

		int last = border[n-1];
		bool can = false;
		while(last >= 0 and !can){
			can = possible(last);
			//D(last);
			if (last == 0) break;
			last = border[last-1];
		}
		int ones = 0;
		for (int i = 0; i < a.size(); ++i) if (a[i] == '1') ones++;
		if (ones % 2 == 1) ones++;
		for (int i = 0; i < b.size(); ++i) if (b[i] == '1') ones--;

		if (can) puts("YES");
		else puts("NO");

		// if ((ones >= 0 and !can) or (can and ones < 0)) puts("Differs");
		// else puts("OK");
	}

    return 0;
}


using namespace std;
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>

#define foreach(x, v) for (typeof (v).begin() x=(v).begin(); x !=(v).end(); ++x)
#define For(i, a, b) for (int i=(a); i<(b); ++i)
#define D(x) cout << #x " is " << x << endl

const int MAXN = 2005;
int border[MAXN];

int main(){
	#ifndef ONLINE_JUDGE
		freopen("in.txt", "r", stdin);
	#endif
	;

	string a, b;
	while (cin >> a >> b){
		int ones = 0;
		for (int i = 0; i < a.size(); ++i) if (a[i] == '1') ones++;
		if (ones % 2 == 1) ones++;
		for (int i = 0; i < b.size(); ++i) if (b[i] == '1') ones--;

		if (ones >= 0) puts("YES");
		else puts("NO");
	}

    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
int la,lb;
char a[2000],b[2000];
int main()
{
    scanf("%s\n%s\n",a+1,b+1);
    la=strlen(a+1),lb=strlen(b+1);
    int sum=0,tot=0;
    for (int i=1;i<=la;i++) sum+=(a[i]-'0');
    for (int i=1;i<=lb;i++) tot+=(b[i]-'0');
    sum+=(sum&1);
    if (sum>=tot) cout<<"YES";else cout<<"NO";
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
int la,lb;
char a[2000],b[2000];
int main()
{
    scanf("%s\n%s\n",a+1,b+1);
    la=strlen(a+1),lb=strlen(b+1);
    int flag=1;
    for (int i=1;i<=lb-1;i++)
        if (b[i]!=b[i+1]) flag=0;
    if (flag && b[1]=='0') {
        cout<<"YES";
        return 0;
    }
    for (int i=1;i<=la;i++) {
        int j=i,k,o=0;
        for (k=1;k<=lb && j<=la;o^=(b[k]-'0'),k++,j++)
            if (a[j]!=b[k]) break;
        if (j<=la) continue;
        for (;k<=lb;o^=o,k++)
            if (o!=b[k]-'0') break;
        if (k<=lb) continue;
        cout<<"YES";
        return 0;
    }
    cout<<"NO";
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
int la,lb;
char a[2000],b[2000];
int main()
{
    scanf("%s\n%s\n",a+1,b+1);
    la=strlen(a+1),lb=strlen(b+1);
    int sum=0;
    for (int i=1;i<=la;i++) sum+=a[i]-'0';
    int tot=0;
    for (int i=1;i<=la+1;tot+=a[i]-'0',i++) {
        int j=i,k,o=tot;
        for (k=1;k<=lb && j<=la;k++,j++)
            if (a[j]!=b[k]) break;
        if (j<=la) continue;
        int p=(sum&1),q;
        for (;k<=lb;k++) {
            if (b[k]=='0') q=0;else q=1;
            if (p!=q) {
                if (!o) break;
                o--,p^=1;
            }
            if (1==q) p^=1;
        }
        if (k<=lb) continue;
        cout<<"YES";
        return 0;
    }
    cout<<"NO";
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
int la,lb;
char a[2000],b[2000];
int main()
{
    scanf("%s\n%s\n",a+1,b+1);
    la=strlen(a+1),lb=strlen(b+1);
    int sum=0,tot=0;
    for (int i=1;i<=la;i++) sum+=(a[i]-'0');
    for (int i=1;i<=lb;i++) tot+=(b[i]-'0');
    sum+=(sum&1);
    if (sum>=tot) cout<<"YES";cout<<"NO";
    return 0;
}


#include<cstdio>
using namespace std;
int num[200][100], t[200005][2];

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

int main(){
	int m, a, b, c;
	scanf("%d",&m);
	for(int i = 0; i < m; i++){
		getchar();
		scanf("(%d+%d)/%d",&a,&b,&c);
		int g = gcd(a+b,c);
		num[(a+b)/g][c/g]++;
		t[i][0] = (a+b)/g;
		t[i][1] = c/g;
	}

	for(int i = 0; i < m; i++)
		printf("%d ",num[t[i][0]][t[i][1]]);
	printf("\n");
	return 0;
}


#include<cstdio>
using namespace std;
int num[1005], t[200005];

int main(){
	int m, a, b, c;
	scanf("%d",&m);
	for(int i = 0; i < m; i++){
		getchar();
		scanf("(%d+%d)/%d",&a,&b,&c);
		t[i] = (a+b)/c;
		num[t[i]]++;
	}

	for(int i = 0; i < m; i++)
		printf("%d ",num[t[i]]);
	printf("\n");
	return 0;
}


#include<cstdio>
using namespace std;
int num[205], t[200005];

int main(){
	int m, a, b, c;
	scanf("%d",&m);
	for(int i = 0; i < m; i++){
		getchar();
		scanf("(%d+%d)/%d",&a,&b,&c);
		t[i] = (a+b)/c;
		num[t[i]]++;
	}

	for(int i = 0; i < m; i++)
		printf("%d%c",num[t[i]],i==m-1?'\n':' ');
	return 0;
}


#include<iostream>
#include<vector>
using namespace std;

int main(){
    int t;
    cin>>t;
    vector<int> myvec(1000000, 0);
    vector<int> second;
    while(t--){
        string s,a="",b="",c="";
        int count=0,check=0;
        cin>>s;

        for(int i=1;i<s.length();i++){
            if(s[i]=='+'){
                count++;
                continue;
            }else if(count==0)
            {
                a+=s[i];
                continue;
            }

            if ((count > 0 && check == 0) && s[i] != ')')
            {

                b+=s[i];
                continue;
            }
            else if(s[i]==')' || s[i]=='/')
            {
                check++;
                continue;
            }
            if((s[i]!='/'&& s[i]!=')') && check>0){
                c+=s[i];
            }
        }
        int f=stoi(a);
        int o=stoi(b);
        int k=stoi(c);
        int val=(f+o)/k;
        second.push_back(val);
        myvec[val]++;
    }
    for(int i=0;i<second.size();i++){
        cout<<myvec[second[i]]<<" ";
    }
    return 0;
}


#include<iostream>
#include<vector>
#include<map>
using namespace std;

int main(){
    int t;
    cin>>t;

    vector<double> second;
    map<double,int> mymap;
    for(int d=0;d<t;d++){
        string s,a="",b="",c="";
        int count=0,check=0;
        cin>>s;

        for(int i=1;i<s.length();i++){
            if(s[i]=='+'){
                count++;
                continue;
            }else if(count==0)
            {
                a+=s[i];
                continue;
            }

            if ((count > 0 && check == 0) && s[i] != ')')
            {

                b+=s[i];
                continue;
            }
            else if(s[i]==')' || s[i]=='/')
            {
                check++;
                continue;
            }
            if((s[i]!='/'&& s[i]!=')') && check>0){
                c+=s[i];
            }
        }
        double f=(double) stoi(a);
        double o = (double)stoi(b);
        double k = stoi(c);
        double val = (double) (f + o) / k;
        second.push_back(val);
        mymap[val]++;
    }
    for(int i=0;i<second.size();i++){
        cout<<mymap[second[i]]<<" ";
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std ;
typedef  long long int ll ;
#define inf 9e18
#define mod 1000000007
#define mod1 998244353
long long int power(long long int a,long long int n,long long int m) ;
long long int power(long long int a,long long int n,long long int m)
{  if(n==0)
   return 1 ;
   long long int x=power(a,n/2,m) ;
   if(n%2!=0)
    return (((a*x)%m)*(x)%m)%m ;
    else return (x*x)%m ;
}
ll sti(string s) ;
ll sti(string s)
{
    ll i,j,x=0 ;
    for(i=0;i<s.size();i++)
        x=(x*10)+(s[i]-'0') ;
      //    cout<<x<<" " ;
    return x ;
}

int main()
{ ll n,i,j,x,y,m,k,t,sum,count,cnt,b,c,d,j1,z,a,o,temp;
  ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   string s ;
   cin>>n ;
   ll arr[200] ;
   ll brr[n] ;
   memset(arr,0,sizeof(arr)) ;
   for(i=0;i<n;i++)
   {
       cin>>s ;
       string s1,s2,s3,s4 ;
       s2="" ;
       s3="" ;
       s4="" ;
       s1="" ;
       for(j=0;j<s.size();j++)
       {
           if(s[j]=='(')
           {
               k=j+1 ;
               while(s[k]!='+')
                s2+=s[k++] ;
               j=k-1 ;
           }
           else if(s[j]=='+')
           {
               k=j+1 ;
               while(s[k]!=')')
                s3+=s[k++] ;
               j=k ;

           }
           else  { k=j+1 ;
                while(k<s.size())
                s4+=s[k++] ;
               j=k ;

            }
       } //cout<<s1<<"\n" ;

       x=(sti(s2)+sti(s3))/(sti(s4)) ;
      // cout<<x<<" " ;
       arr[x]++ ;
       brr[i]=x ;

   }
   for(i=0;i<n;i++)
   {
       cout<<arr[brr[i]]<<" " ;

   }
   return 0; }


#include<bits/stdc++.h>
using namespace std ;
typedef  long long int ll ;
#define inf 9e18
#define mod 1000000007
#define mod1 998244353
long long int power(long long int a,long long int n,long long int m) ;
long long int power(long long int a,long long int n,long long int m)
{  if(n==0)
   return 1 ;
   long long int x=power(a,n/2,m) ;
   if(n%2!=0)
    return (((a*x)%m)*(x)%m)%m ;
    else return (x*x)%m ;
}
float sti(string s) ;
float sti(string s)
{
    ll i,j ;
     float x=0 ;
    for(i=0;i<s.size();i++)
        x=(x*10)+(s[i]-'0') ;
      //    cout<<x<<" " ;
    return x ;
}

int main()
{ ll n,i,j,x,y,m,k,t,sum,count,cnt,b,c,d,j1,z,a,o,temp;
  ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   string s ;
   cin>>n ;
   map<float,ll> p ;
   float brr[n] ;
   for(i=0;i<n;i++)
   {
       cin>>s ;
       string s1,s2,s3,s4 ;
       s2="" ;
       s3="" ;
       s4="" ;
       s1="" ;
       for(j=0;j<s.size();j++)
       {
           if(s[j]=='(')
           {
               k=j+1 ;
               while(s[k]!='+')
                s2+=s[k++] ;
               j=k-1 ;
           }
           else if(s[j]=='+')
           {
               k=j+1 ;
               while(s[k]!=')')
                s3+=s[k++] ;
               j=k ;

           }
           else  { k=j+1 ;
                while(k<s.size())
                s4+=s[k++] ;
               j=k ;

            }
       } //cout<<s1<<"\n" ;

       float z1=(sti(s2)+sti(s3))/(sti(s4)) ;
      // cout<<x<<" " ;
       p[z1]++ ;
       brr[i]=z1;

   }
   for(i=0;i<n;i++)
   {
       cout<<p[brr[i]]<<" " ;

   }
   return 0; }


#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define int long long int
#define popcount(x) __builtin_popcountll(x)
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define sc second
#define pb push_back
#define fr first
#define all(a) (a).begin(),(a).end()
#define mem0(a) memset(a,0,sizeof(a))
#define ld long double
const int INF = __LONG_LONG_MAX__;
#define rall(a) (a).rbegin(),(a).rend()
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroint-loops")

int power(int b,int e,int m)
{
  if(b==0) return 0;
  if(e==0) return 1;
  if(e&1) return b*power(b*b%m,e/2,m)%m;
  return power(b*b%m,e/2,m);
}
int power( int b, int e)
{
  if(b==0) return 0;
  if(e==0) return 1;
  if(e&1) return b*power(b*b,e/2);
  return power(b*b,e/2);
}
bool isPowerOfTwo(int x)
{
    // x wiint check if x == 0 and !(x & (x - 1)) wiint check if x is a power of 2 or not
  return (x && !(x & (x - 1)));
}

void solve()
{
  int m;
  cin>>m;
  vector <int> v;
  map<int,int>mp;
  while(m--)
  {
    string s;
    cin>>s;
    int a,b,c;
    if(s[2]=='+')
    {
      a=s[1]-'0';
      if(s[4]==')')
      {
        b=s[3]-'0';
      }
      else
      {
        b=(s[3]-'0')*10+(s[4]-'0');
      }
    }
    else
    {
      a=(s[1]-'0')*10+(s[2]-'0');
      if(s[5]==')')
      {
        b=s[4]-'0';
      }
      else
      {
        b=(s[4]-'0')*10+(s[5]-'0');
      }
    }
    int n=s.size();
    if(s[n-2]=='/')
    {
      c=s[n-1]-'0';
    }
    else
    {
      c=(s[n-2]-'0')*10+(s[n-1]-'0');
    }
    int xx=(a+b)/c;
    v.pb(xx);
    mp[xx]++;
  }
  for(auto i:v) cout<<mp[i]<<" ";
}

signed main()
{
  fastio
  int tt=1;
  // cin>>tt;
   // freopen("input.ttxt", "r" , stdin);
  // freopen("output.txt", "w", stdout);
  while(tt--)
  {
    solve();
    cout<<"\n";
  }
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define int long long int
#define popcount(x) __builtin_popcountll(x)
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define sc second
#define pb push_back
#define fr first
#define all(a) (a).begin(),(a).end()
#define mem0(a) memset(a,0,sizeof(a))
#define ld long double
const int INF = __LONG_LONG_MAX__;
#define rall(a) (a).rbegin(),(a).rend()
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroint-loops")

int power(int b,int e,int m)
{
  if(b==0) return 0;
  if(e==0) return 1;
  if(e&1) return b*power(b*b%m,e/2,m)%m;
  return power(b*b%m,e/2,m);
}
int power( int b, int e)
{
  if(b==0) return 0;
  if(e==0) return 1;
  if(e&1) return b*power(b*b,e/2);
  return power(b*b,e/2);
}
bool isPowerOfTwo(int x)
{
    // x wiint check if x == 0 and !(x & (x - 1)) wiint check if x is a power of 2 or not
  return (x && !(x & (x - 1)));
}

void solve()
{
  int m;
  cin>>m;
  vector <double> v;
  map<double,int>mp;
  int a,b,c;
  while(m--)
  {
    char x,y,z,zz;
    cin>>x>>a>>y>>b>>z>>zz>>c;
    double xx=(double)(a+b)/c;
    v.pb(xx);
    mp[xx]++;
  }
  for(auto i:v) cout<<mp[i]<<" ";
}

signed main()
{
  fastio
  int tt=1;
  // cin>>tt;
   // freopen("input.ttxt", "r" , stdin);
  // freopen("output.txt", "w", stdout);
  while(tt--)
  {
    solve();
    cout<<"\n";
  }
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define int long long int
#define popcount(x) __builtin_popcountll(x)
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define sc second
#define pb push_back
#define fr first
#define all(a) (a).begin(),(a).end()
#define mem0(a) memset(a,0,sizeof(a))
#define ld long double
const int INF = __LONG_LONG_MAX__;
#define rall(a) (a).rbegin(),(a).rend()
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroint-loops")

int power(int b,int e,int m)
{
  if(b==0) return 0;
  if(e==0) return 1;
  if(e&1) return b*power(b*b%m,e/2,m)%m;
  return power(b*b%m,e/2,m);
}
int power( int b, int e)
{
  if(b==0) return 0;
  if(e==0) return 1;
  if(e&1) return b*power(b*b,e/2);
  return power(b*b,e/2);
}
bool isPowerOfTwo(int x)
{
    // x wiint check if x == 0 and !(x & (x - 1)) wiint check if x is a power of 2 or not
  return (x && !(x & (x - 1)));
}

void solve()
{
  int m;
  cin>>m;
  vector <double> v;
  map<double,int>mp;
  while(m--)
  {
    string s;
    cin>>s;
    int a,b,c;
    if(s[2]=='+')
    {
      a=s[1]-'0';
      if(s[4]==')')
      {
        b=s[3]-'0';
      }
      else
      {
        b=(s[3]-'0')*10+(s[4]-'0');
      }
    }
    else
    {
      a=(s[1]-'0')*10+(s[2]-'0');
      if(s[5]==')')
      {
        b=s[4]-'0';
      }
      else
      {
        b=(s[4]-'0')*10+(s[5]-'0');
      }
    }
    int n=s.size();
    if(s[n-2]=='/')
    {
      c=s[n-1]-'0';
    }
    else
    {
      c=(s[n-2]-'0')*10+(s[n-1]-'0');
    }
    double xx=(double)(a+b)/c;
    v.pb(xx);
    mp[xx]++;
  }
  for(auto i:v) cout<<mp[i]<<" ";
}

signed main()
{
  fastio
  int tt=1;
  // cin>>tt;
   // freopen("input.ttxt", "r" , stdin);
  // freopen("output.txt", "w", stdout);
  while(tt--)
  {
    solve();
    cout<<"\n";
  }
  return 0;
}


#include<bits/stdc++.h>

#define KhaledAshraf ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define modulo ll(1e9+7)
#define PI acos(-1.0)
#define setzero(a) memset(a,0,sizeof(a))
#define setdp(a) memset(a,-1,sizeof(a))

typedef long long ll;

using namespace std;

int main() {

	ll N;
	cin>>N;
	vector<long double>V;
	map<double,int>mp;
	for(int i=0;i<N;i++){
		char X;
		long double A,B,C;
		cin>>X>>A>>X>>B>>X>>X>>C;
		long double Z=(A+B)/C;
		V.push_back(Z);
		mp[Z]++;
	}
	for(int i=0;i<V.size();i++){
		cout<<mp[V[i]]<<" ";
	}
	return 0;
}


#include<bits/stdc++.h>

#define KhaledAshraf ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define modulo ll(1e9+7)
#define PI acos(-1.0)
#define setzero(a) memset(a,0,sizeof(a))
#define setdp(a) memset(a,-1,sizeof(a))

typedef long long ll;

using namespace std;

int main() {

	ll N;
	cin>>N;
	vector<long double>V;
	map<double,int>mp;
	for(int i=0;i<N;i++){
		char X;
		ll A,B,C;
		cin>>X>>A>>X>>B>>X>>X>>C;
		V.push_back((A+B)/C);
		mp[(A+B)/C]++;
	}
	for(int i=0;i<V.size();i++){
		cout<<mp[V[i]]<<" ";
	}
	return 0;
}


#include<bits/stdc++.h>

#define KhaledAshraf ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define modulo ll(1e9+7)
#define PI acos(-1.0)
#define setzero(a) memset(a,0,sizeof(a))
#define setdp(a) memset(a,-1,sizeof(a))

typedef long long ll;

using namespace std;

int main() {

	ll N;
	cin>>N;
	vector<long double>V;
	map<double,int>mp;
	for(int i=0;i<N;i++){
		char X;
		ll A,B,C;
		cin>>X>>A>>X>>B>>X>>X>>C;
		long double Z=(A+B)/C;
		V.push_back(Z);
		mp[Z]++;
	}
	for(int i=0;i<V.size();i++){
		cout<<mp[V[i]]<<" ";
	}
	return 0;
}


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

class Val{
public:
    int indx;
    int value;
    Val(int indx , int value){
        this->indx = indx;
        this->value = value;
    }
    bool operator<=(const Val& rhs)const{
        return value<=rhs.value;
    }
};
 map < int , int >vau;
int main(){
    int m;
    cin>>m;
    vector<int>vau2;

    for(int i = 1 ; i  <= m;i++){
        double a,b,c;
        char q,w,e,r;
        cin >> q >> a >> w >> b >> e >> r >> c;
        //cout << q << a << w << b << e << r << c;
        int val = (a+b)/c;
                //ans.push_back(Val(i , val));
        vau[val] ++;
        vau2.push_back(val);
    }

    for(int i = 1;i<=m;i++){
        cout<<vau[vau2[i-1] ]<<" ";

    }
    cout<<endl;

 return 0;
}


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

class Val{
public:
    int indx;
    int value;
    Val(int indx , int value){
        this->indx = indx;
        this->value = value;
    }
    bool operator<=(const Val& rhs)const{
        return value<=rhs.value;
    }
};
 map < double , int >vau;
int main(){
    int m;
    cin>>m;
    vector<double>vau2;

    for(int i = 1 ; i  <= m;i++){
        double a,b,c;
        char q,w,e,r;
        cin >> q >> a >> w >> b >> e >> r >> c;
        //cout << q << a << w << b << e << r << c;
        double val = (a+b)/c;
                //ans.push_back(Val(i , val));
        vau[val] ++;
        vau2.push_back(val);
    }

    for(int i = 1;i<=m;i++){
        cout<<vau[vau2[i-1] ]<<" ";

    }
    cout<<endl;

 return 0;
}


// Author : Nachiket Kanore
// Institute : PICT, Pune

#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define FAST ios_base::sync_with_stdio(false);\
             cin.tie(NULL); \
             cout.tie(NULL)
using namespace std;

int32_t main(){
    FAST;

    unordered_map<int,int> f;
    unordered_map<int,int> point;
    int n;  cin >> n;
    for(int x=0;x<n;x++){
        char c; cin >> c;
        int a;  cin >> a ;
        cin >> c;
        int b;  cin >> b;
        cin >> c;
        cin >> c;
        int cc;  cin >> cc;

        int cord = (a + b) / cc;
        point[x+1] = cord;
        f[cord]++;

    }

    for(int x=1;x<=n;x++)
        cout << f[point[x]] << " ";

    return 0;
}


// Author : Nachiket Kanore
// Institute : PICT, Pune

#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define FAST ios_base::sync_with_stdio(false);\
             cin.tie(NULL); \
             cout.tie(NULL)
using namespace std;

int32_t main(){
    FAST;

    cout << fixed << setprecision(10);

    unordered_map< string,int > cnt;
    unordered_map<int , string > cordinate;

    int n;  cin >> n;
    for(int x=0;x<n;x++){
        char c; cin >> c;
        int a;  cin >> a ;
        cin >> c;
        int b;  cin >> b;
        cin >> c;
        cin >> c;
        int cc;  cin >> cc;

        int nume = a+b;
        int deno = cc;

        int g = __gcd(nume , deno);

        nume /= g , deno /= g;

        string t = to_string(nume) + "/" + to_string(deno);

        cordinate[x+1] = t;
        cnt[t]++;

    }

    for(int x=1;x<=n;x++)
        cout << cnt[cordinate[x]] << " ";

    return 0;
}


#include "bits/stdc++.h"

using namespace std;
using LL = long long;

constexpr int N = 1e5 + 5;

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

    int n;
    cin >> n;

    vector< int> a(n), b(n), c(n);
    vector< int> cnt(1000);

    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;

        for (char &c : s) {
            if (isdigit(c)) continue;
            c = ' ';
        }

        stringstream ss(s);
        ss >> a[i] >> b[i] >> c[i];
        cnt[(a[i] + b[i]) / c[i]]++;
    }

    for (int i = 0; i < n; i++) cout << cnt[(a[i] + b[i]) /  c[i]] << ' ';

}


#include "bits/stdc++.h"

using namespace std;
using LL = long long;

constexpr int N = 1e5 + 5;

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

    int n;
    cin >> n;

    vector< int> a(n), b(n), c(n);
    vector< int> cnt(100000);

    int lcm = 1;

    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;

        for (char &c : s) {
            if (isdigit(c)) continue;
            c = ' ';
        }

        stringstream ss(s);
        ss >> a[i] >> b[i] >> c[i];

        lcm = c[i] / __gcd(c[i], lcm) * lcm;
    }

    for (int i = 0; i < n; i++) {
        cnt[(a[i] + b[i]) * lcm / c[i]]++;
    }

    for (int i = 0; i < n; i++) cout << cnt[(a[i] + b[i]) * lcm / c[i]] << ' ';

}


#include "bits/stdc++.h"

using namespace std;
using LL = long long;

constexpr int N = 1e5 + 5;

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

    int n;
    cin >> n;

    vector< LL> a(n), b(n), c(n);
    map< LL, int> cnt;
    LL lcm = 1;

    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;

        for (char &c : s) {
            if (isdigit(c)) continue;
            c = ' ';
        }

        stringstream ss(s);
        ss >> a[i] >> b[i] >> c[i];

        lcm = c[i] / __gcd(c[i], lcm) * lcm;
    }

    for (int i = 0; i < n; i++) {
        cnt[(a[i] + b[i]) * lcm / c[i]]++;
    }

    for (int i = 0; i < n; i++) cout << cnt[(a[i] + b[i]) * lcm / c[i]] << ' ';

}


#include "bits/stdc++.h"

using namespace std;
using LL = long long;

constexpr int N = 1e5 + 5;

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

    int n;
    cin >> n;

    map< pair< int, int>, int> cnt;
    vector< pair< int, int>> in(n);

    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;

        for (char &c : s) {
            if (isdigit(c)) continue;
            c = ' ';
        }

        stringstream ss(s);
        int a, b, c;
        ss >> a >> b >> c;

        int g = __gcd(a + b, c);
        in[i] = make_pair((a + b) / g, c / g);

        cnt[in[i]]++;
    }

    for (int i = 0; i < n; i++) cout << cnt[in[i]] << ' ';

}


#include <bits/stdc++.h>

#define ll          long long int
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pair<int,int>>
#define mi          map<int,int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define rep(i,a,b)  for(i=a;i<b;i++)
#define inf         INT_MAX

template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }

using namespace std;
void solve()
{
    int n,i,j;
    cin>>n;
    string s;
    vi v;
    mi m;
    rep(i,0,n)
    {
        cin>>s;
        j=1;
        string n1(""),n2(""),n3("");
        while(isdigit(s[j]))n1+=s[j],j++;
        j++;
        while(isdigit(s[j]))n2+=s[j],j++;
        j+=2;
        while(isdigit(s[j]))n3+=s[j],j++;
        int a,b,c;
        a=stoi(n1);
        b=stoi(n2);
        c=stoi(n3);
        v.pb((a+b)/c);
        m[v.back()]++;
    }
    rep(i,0,n)cout<<m[v[i]]<<" ";
    cout<<endl;
}
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>

#define ll          long long int
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pair<int,int>>
#define mi          map<int,int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define rep(i,a,b)  for(i=a;i<b;i++)
#define inf         INT_MAX

template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }

using namespace std;
void solve()
{
    int n,i,j;
    cin>>n;
    string s;
    vii v;
    map<pii,int> m;
    rep(i,0,n)
    {
        cin>>s;
        j=1;
        string n1(""),n2(""),n3("");
        while(isdigit(s[j]))n1+=s[j],j++;
        j++;
        while(isdigit(s[j]))n2+=s[j],j++;
        j+=2;
        while(isdigit(s[j]))n3+=s[j],j++;
        int a,b,c;
        a=stoi(n1);
        b=stoi(n2);
        c=stoi(n3);
        int g=__gcd(a+b,c);
        v.pb(mp((a+b)/g,c/g));
        m[v.back()]++;
    }
    for(auto i:v)cout<<m[mp(i.F,i.S)]<<" ";
    cout<<endl;
}
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}


/* Abhishek Chaturvedi- abhishekchaturvedi10oct */

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define vi              vector<int>
#define pii             pair<int,int>
#define mii             map<int,int>
#define	pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int>>
#define mod             1000000007
#define inf             1e18
#define	ps(x,y)         fixed<<setprecision(y)<<x
#define tc(x)           int x; cin>>x; while(x--)
#define loopf(i,x,y)    for (int i=x;i<=y;i++)
#define loopb(i,x,y)    for (int i=x;i>=y;i--)

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

void FASTIO()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

void solve(){
    int n;
    cin>>n;
    unordered_map<int,int> m;
    int arr[n];
    loopf(i,0,n-1){
        string s;
        cin>>s;
        int q,r,x;
        loopf(j,0,s.length()-1){
            if (s[j]==')'){
                q=j;
            }
            if (s[j]=='/'){
                x=j;
            }
            if(s[j]=='+'){
                r=j;
            }
        }
        int a=stoi(s.substr(1,r-1));
        int b=stoi(s.substr(r+1,q-r-1));
        int c=stoi(s.substr(x+1));
        //cout<<a<<b<<c<<" ";
        int z=(a+b)/c;
        arr[i]=z;
        //cout<<z<<" ";
        m[z]+=1;
    }
    loopf(k,0,n-1){
        for(auto &i : m){
            if(arr[k]==i.ff){
                cout<<i.ss<<" ";
                break;
            }
        }
    }
}

int32_t main(){

	FASTIO();
	//c(t){
		solve();
	//}
	return 0;
}


/* Abhishek Chaturvedi- abhishekchaturvedi10oct */

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define vi              vector<int>
#define pii             pair<int,int>
#define mii             map<int,int>
#define	pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int>>
#define mod             1000000007
#define inf             1e18
#define	ps(x,y)         fixed<<setprecision(y)<<x
#define tc(x)           int x; cin>>x; while(x--)
#define loopf(i,x,y)    for (int i=x;i<=y;i++)
#define loopb(i,x,y)    for (int i=x;i>=y;i--)

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

void FASTIO()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

void solve(){
    int n;
    cin>>n;
    unordered_map<float,int> m;
    //unordered_map<float,int> ma;
    float arr[n];
    loopf(i,0,n-1){
        string s;
        cin>>s;
        int q,r,x;
        loopf(j,0,s.length()-1){
            if (s[j]==')'){
                q=j;
            }
            if (s[j]=='/'){
                x=j;
            }
            if(s[j]=='+'){
                r=j;
            }
        }
        int a=stoi(s.substr(1,r-1));
        int b=stoi(s.substr(r+1,q-r-1));
        int c=stoi(s.substr(x+1));
        //cout<<a<<b<<c<<" ";
        float z=(a+b)*1.0/c;
        //cout<<z<<" ";
        arr[i]=z;
        //cout<<z<<" ";
        m[z]+=1;
    }
    loopf(k,0,n-1){
        cout<<m[arr[k]]<<" ";
    }
}

int32_t main(){

	FASTIO();
	//c(t){
		solve();
	//}
	return 0;
}


/* Abhishek Chaturvedi- abhishekchaturvedi10oct */

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define vi              vector<int>
#define pii             pair<int,int>
#define mii             map<int,int>
#define	pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int>>
#define mod             1000000007
#define inf             1e18
#define	ps(x,y)         fixed<<setprecision(y)<<x
#define tc(x)           int x; cin>>x; while(x--)
#define loopf(i,x,y)    for (int i=x;i<=y;i++)
#define loopb(i,x,y)    for (int i=x;i>=y;i--)

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

void FASTIO()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

void solve(){
    int n;
    cin>>n;
    unordered_map<float,int> m;
    float arr[n];
    loopf(i,0,n-1){
        string s;
        cin>>s;
        int q,r,x;
        loopf(j,0,s.length()-1){
            if (s[j]==')'){
                q=j;
            }
            if (s[j]=='/'){
                x=j;
            }
            if(s[j]=='+'){
                r=j;
            }
        }
        int a=stoi(s.substr(1,r-1));
        int b=stoi(s.substr(r+1,q-r-1));
        int c=stoi(s.substr(x+1));
        //cout<<a<<b<<c<<" ";
        float z=(float)(a+b)/c;
        //cout<<z<<" ";
        arr[i]=z;
        //cout<<z<<" ";
        m[z]+=1;
    }
    loopf(k,0,n-1){
        for(auto &i : m){
            if(arr[k]==i.ff){
                //cout<<arr[k]<<i.ff;
                cout<<i.ss<<" ";
                break;
            }
        }
    }
}

int32_t main(){

	FASTIO();
	//c(t){
		solve();
	//}
	return 0;
}


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

int m;
map<int, double> to;
map<double, int> cnt;

int main()
{
	cin >> m;
	for (int i=1; i<=m; ++i) {
		int a, b, c; scanf(" (%d+%d)/%d", &a, &b, &c);
		double dst = double(a+b)/c;
		to[i] = dst, cnt[dst]++;
	}

	for (int i=1; i<=m; ++i) {
		cout << cnt[to[i]];
		cout << (i == m ? '\n' : ' ');
	}
}


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

int m;
int to[200200];
map<int, int> cnt;

int main()
{
	cin >> m;
	for (int i=1; i<=m; ++i) {
		int a, b, c; scanf(" (%d+%d)/%d", &a, &b, &c);
		int dst = (a+b)/c;
		to[i] = dst, cnt[dst]++;
	}

	for (int i=1; i<=m; ++i) {
		cout << cnt[to[i]];
		cout << (i == m ? '\n' : ' ');
	}
}


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

int m;
int to[200200];
int cnt[250];

int main()
{
	cin >> m;
	for (int i=1; i<=m; ++i) {
		int a, b, c; scanf(" (%d+%d)/%d", &a, &b, &c);
		int dst = (a+b)/c;
		to[i] = dst, cnt[dst]++;
	}

	for (int i=1; i<=m; ++i) {
		cout << cnt[to[i]];
		cout << (i == m ? '\n' : ' ');
	}
}


#include <bits/stdc++.h>

using namespace std;

vector<int> ans;
unordered_map<int, int> ma;
set<char> se {'(', ')', '+', '/'};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  cin.ignore();
  while (n--) {
    string s;
    getline(cin, s);
    for (char& c : s) {
      if (se.count(c))
        c = ' ';
    }
    stringstream ss(s);
    int a, b, c;
    ss >> a >> b >> c;
    int val = (a + b) / c;
    ++ma[val];
    ans.push_back(val);
  }
  for (int i : ans)
    cout << ma[i] << ' ';
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

vector<double> ans;
unordered_map<double, int> ma;
set<char> se {'(', ')', '+', '/'};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  cin.ignore();
  while (n--) {
    string s;
    getline(cin, s);
    for (char& c : s) {
      if (se.count(c))
        c = ' ';
    }
    stringstream ss(s);
    int a, b, c;
    ss >> a >> b >> c;
    double val = (a + b) * 1.0 / c * 1.0;
    ++ma[val];
    ans.push_back(val);
  }
  for (double i : ans)
    cout << ma[i] << ' ';
  return 0;
}


/*****************************************************************\
IN THE NAME OF ALLAH, MOST GRACIOUS AND MOST MERCIFUL
|                                                                 |
|     Author     : Mahabub Rahman                                 |
|     Email      : mahabubrahman618@gmail.com                     |
|     University : Comilla University, Bangladesh                 |
|                  Department of Computer Science & Engineering   |
\*****************************************************************/

/*...................................Data_Types............................................*/
#include<bits/stdc++.h>

using namespace std;
#define FastIO ios::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define       ll                  long long int
#define       ull                  unsigned long long int
#define       veci                 vector<int>
#define       vecc                 vector<char>
#define       vecs                 vector<string>
#define       vecl                 vector<long long int>
#define       vecp                 vector<  pair<int,int> >
#define       mapstrint            map< string , int >
#define       mapstrstr            map< string , string >
#define       mapint               map< int, int >
#define       pb                   push_back
#define       newline cerr << endl
#define       pob                  pop_back
#define       mp                   make_pair
#define       pii                  pair<int, int>
#define       F                    first
#define       S                    second
#define       sc(x)                scanf("%d",&x)
#define       sc2(xx,zz)           scanf("%d %d",&xx,&zz)
#define       scl(x)               scanf("%lld",&x)
#define       scl2(xx,zz)          scanf("%lld %lld",&xx,&zz)
#define       pf                   printf
#define       min3(a,b,c)          min(a,b<c?b:c)
#define       max3(a,b,c)          max(a,b>c?b:c)
#define       all(v)               v.begin(), v.end()
///=============== Debugging ============================///
#define       debug(x) cerr << #x << " = " << x << endl
#define       debug2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define       debug3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define       debug4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
//#define f(x) (64 - __builtin_clzll(x))
///============ CONSTANT ===============///
#define mx9   1000000007
#define mx7   10000007
#define mx6   2000006
#define mx5   200005
#define inf   1<<30                                           //infinity value
#define eps   1e-9
#define mod   mx9
///==============================TEMPLATES===============================///

long double PI = acosl(-1);
bool compare_int(int a, int b){return (a>b);} //This function is use for descending order.
bool compare_string (string a, string b){return a.size()<b.size();}
bool compare_pair(const pair<int,int> &a,
                    const pair<int,int> &b){if(a.second==b.second)return a.first<b.first; else return (a.second > b.second);}
bool cmp(pair<string ,int > x , pair<string ,int > y){return (x.S < y.S);}
///=====================Graph Moves================///
//const int fx[]= {+1,-1,+0,+0};
//const int fy[]= {+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move

///=====================Bitmask===================///
//int Set(int N,int pos){return N=N | (1<<pos);}
//int reset(int N,int pos){return N= N & ~(1<<pos);}
//bool check(int N,int pos){return (bool)(N & (1<<pos));}

///========================================FUNCTION=========================================///
//bool check(int n){if(n==1) return false; for(int i=2; i*i<=n; i++){if(n%i==0) return false;} return true;}
//ll bigmod(ll a, ll b, ll m){if(b==0) return 1%m;ll x=bigmod(a, b/2, m);x=(x*x)%m;if(b%2==1)x=(x*a)%m;return x;}
//bool flag[mx5];veci prime;
//void sieve(){prime.pb(2);for(ll i=3; i*i<=mx5; i+=2){if(flag[i]) continue;for(ll j=i*i; j<=mx5; j+=i+i) flag[j]=true;}for(ll i=3; i<=mx5; i+=2) if(!flag[i]) prime.pb(i);}
//ll fact(ll n){if(n==0 or n==1)return 1; else return n*fact(n-1);}
void NA(){printf("NO\n");exit(0);}
void YA(){printf("YES\n");exit(0);}

///=================START_FROM_HERE=====================///

int32_t main()
{
    ///Don't see test case until get 7/8 times wrong submission..!!
    ///Try to make Corner, Even, Odd or Prime case..!!
    FastIO;
    int t;
    cin >> t;
    map<double, double> m;
    vector<double> aa;
    for(int i=0; i<t; i++)
    {
        double a, b, c;
        char p1, sig, p2, sla;
        cin >> p1 >> a >> sig >> b >> p2 >> sla >> c;

        double x = (a+b)/c;
        m[x]++;
        aa.pb(x);
    }
    for(int i=0; i<t; i++) cout << m[aa[i]] << ' ';
    cout << endl;

}
///Created:


/*****************************************************************\
IN THE NAME OF ALLAH, MOST GRACIOUS AND MOST MERCIFUL
|                                                                 |
|     Author     : Mahabub Rahman                                 |
|     Email      : mahabubrahman618@gmail.com                     |
|     University : Comilla University, Bangladesh                 |
|                  Department of Computer Science & Engineering   |
\*****************************************************************/

/*...................................Data_Types............................................*/
#include<bits/stdc++.h>

using namespace std;
#define FastIO ios::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define       ll                  long long int
#define       ull                  unsigned long long int
#define       veci                 vector<int>
#define       vecc                 vector<char>
#define       vecs                 vector<string>
#define       vecl                 vector<long long int>
#define       vecp                 vector<  pair<int,int> >
#define       mapstrint            map< string , int >
#define       mapstrstr            map< string , string >
#define       mapint               map< int, int >
#define       pb                   push_back
#define       newline cerr << endl
#define       pob                  pop_back
#define       mp                   make_pair
#define       pii                  pair<int, int>
#define       F                    first
#define       S                    second
#define       sc(x)                scanf("%d",&x)
#define       sc2(xx,zz)           scanf("%d %d",&xx,&zz)
#define       scl(x)               scanf("%lld",&x)
#define       scl2(xx,zz)          scanf("%lld %lld",&xx,&zz)
#define       pf                   printf
#define       min3(a,b,c)          min(a,b<c?b:c)
#define       max3(a,b,c)          max(a,b>c?b:c)
#define       all(v)               v.begin(), v.end()
///=============== Debugging ============================///
#define       debug(x) cerr << #x << " = " << x << endl
#define       debug2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define       debug3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define       debug4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
//#define f(x) (64 - __builtin_clzll(x))
///============ CONSTANT ===============///
#define mx9   1000000007
#define mx7   10000007
#define mx6   2000006
#define mx5   200005
#define inf   1<<30                                           //infinity value
#define eps   1e-9
#define mod   mx9
///==============================TEMPLATES===============================///

long double PI = acosl(-1);
bool compare_int(int a, int b){return (a>b);} //This function is use for descending order.
bool compare_string (string a, string b){return a.size()<b.size();}
bool compare_pair(const pair<int,int> &a,
                    const pair<int,int> &b){if(a.second==b.second)return a.first<b.first; else return (a.second > b.second);}
bool cmp(pair<string ,int > x , pair<string ,int > y){return (x.S < y.S);}
///=====================Graph Moves================///
//const int fx[]= {+1,-1,+0,+0};
//const int fy[]= {+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move

///=====================Bitmask===================///
//int Set(int N,int pos){return N=N | (1<<pos);}
//int reset(int N,int pos){return N= N & ~(1<<pos);}
//bool check(int N,int pos){return (bool)(N & (1<<pos));}

///========================================FUNCTION=========================================///
//bool check(int n){if(n==1) return false; for(int i=2; i*i<=n; i++){if(n%i==0) return false;} return true;}
//ll bigmod(ll a, ll b, ll m){if(b==0) return 1%m;ll x=bigmod(a, b/2, m);x=(x*x)%m;if(b%2==1)x=(x*a)%m;return x;}
//bool flag[mx5];veci prime;
//void sieve(){prime.pb(2);for(ll i=3; i*i<=mx5; i+=2){if(flag[i]) continue;for(ll j=i*i; j<=mx5; j+=i+i) flag[j]=true;}for(ll i=3; i<=mx5; i+=2) if(!flag[i]) prime.pb(i);}
//ll fact(ll n){if(n==0 or n==1)return 1; else return n*fact(n-1);}
void NA(){printf("NO\n");exit(0);}
void YA(){printf("YES\n");exit(0);}

///=================START_FROM_HERE=====================///

int32_t main()
{
    ///Don't see test case until get 7/8 times wrong submission..!!
    ///Try to make Corner, Even, Odd or Prime case..!!
    FastIO;
    int t;
    cin >> t;
    map<double, int> m;
    vector<double> aa;
    for(int i=0; i<t; i++)
    {
        int a, b, c;
        char p1, sig, p2, sla;
        cin >> p1 >> a >> sig >> b >> p2 >> sla >> c;

        double x = (a+b)/c;
        m[x]++;
        aa.pb(x);
    }
    for(int i=0; i<t; i++) cout << m[aa[i]] << ' ';
    cout << endl;

}
///Created:


#include <bits/stdc++.h>

using namespace std;
unordered_map<int, int> cnt;

int val(string s) {
  int l = s.size();
  vector<int> in, ans;
  for(int i = 0; i < l; i++) {
    if(s[i]=='(' || s[i]=='+' || s[i]==')' || s[i]=='/') {
      in.push_back(i);
    }
  }
  in.push_back(l);
  for(int i = 1; i < (int)in.size(); i++) {
    if(in[i] - in[i - 1] > 1) {
      string consider = s.substr(in[i - 1] + 1, in[i] - in[i - 1] - 1);
      ans.push_back(stoi(consider));
    }
  }
  return (ans[0] + ans[1])/ans[2];
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<string> ret(n);
  for(int i = 0; i < n; i++) {
    cin >> ret[i];
    cnt[val(ret[i])]++;
  }
  for(int i = 0; i < n; i++) {
    cout << cnt[val(ret[i])] << " ";
  }
  cout << '\n';
  return 0;
}


#include <bits/stdc++.h>

using namespace std;
unordered_map<double, int> cnt;

double val(string s) {
  int l = s.size();
  vector<int> in, ans;
  for(int i = 0; i < l; i++) {
    if(s[i]=='(' || s[i]=='+' || s[i]==')' || s[i]=='/') {
      in.push_back(i);
    }
  }
  in.push_back(l);
  for(int i = 1; i < (int)in.size(); i++) {
    if(in[i] - in[i - 1] > 1) {
      string consider = s.substr(in[i - 1] + 1, in[i] - in[i - 1] - 1);
      ans.push_back(stoi(consider));
    }
  }
  return (ans[0] + ans[1])*(1.0)/ans[2];
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<string> ret(n);
  for(int i = 0; i < n; i++) {
    cin >> ret[i];
    cnt[val(ret[i])]++;
  }
  for(int i = 0; i < n; i++) {
    cout << cnt[val(ret[i])] << " ";
  }
  cout << '\n';
  return 0;
}


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

int main(){

	int n,i;
	cin>>n;
	double arr[n+1];
	int t=n;
	int k=0;
	map<double,int> m;
	while(t--){
			string s,a,b,c;
			char aa[100],bb[100],cc[100];
	cin>>s;
	int index = 1;
	while(s[index]!='+'){
		a+=s[index];
		index++;
	}
	index++;
	while(s[index]!=')'){
		b+=s[index];
		index++;
	}
	index+=2;
	while(index<s.length()){
		c+=s[index];
		index++;
	}
	for(i=0;i<a.length();i++)
		aa[i] = a[i];
	for(i=0;i<b.length();i++)
		bb[i] = b[i];
	for(i=0;i<c.length();i++)
		cc[i] = c[i];
	int a1=atoi(aa);
	int b1=atoi(bb);
	int c1=atoi(cc);

	double ans=(double)(a1+b1)/(double)c1;

m[ans]++;
arr[k++]=ans;

	memset(aa,0,sizeof(aa));
	memset(bb,0,sizeof(bb));
	memset(cc,0,sizeof(cc));

}

for(int j=0;j<n;j++){
cout<<m[(double)arr[j]]<<" ";

}

	return 0;
}


#include <iostream>
#include <stdlib.h>

using namespace std;

int m;

const int MAX_M = 200000;

int counter[100][100] = {};
pair <int, int> coord[MAX_M + 5];

int CGD(int a, int b)
{
    int c;

    while(b != 0)
    {
        c = a % b;
        a = b;
        b = c;
    }

    return a;
}

pair <int, int>  GetInput(string &str)
{
    int len[3] = {1, 1, 1};

    if(str[2] != '+') len[0] = 2;

    if(str[len[0] + 3] != ')') len[1] = 2;

    if(str[str.length() - 2] != '/') len[2] = 2;

    int sum = atoi(str.substr(1, len[0]).c_str()) + atoi(str.substr(2 + len[0], len[1]).c_str());
    int c = atoi(str.substr(str.length() - len[2], len[2]).c_str());

    int cgd = CGD(sum, c);

    return make_pair(sum / cgd, c / cgd);
}

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

    cin >> m;

    for(int  i = 0; i < m; i++)
    {
        string in;
        cin >> in;

        coord[i] = GetInput(in);
        counter[coord[i].first][coord[i].second]++;
    }

    for(int i = 0; i < m; i++)
        cout << counter[coord[i].first][coord[i].second] << " ";

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define code ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long
#define endl "\n"
#define pb push_back
#define rep(i,j,k) for(int i=j;i<k;i+=1)
const long double pi=2*acos(0.0);
const int MOD=1e9+7;
int32_t main (){
    code ;
    int t;
     //cin>>t;
    t=1;
    while(t--){
        int n;
        cin>>n;
        map<double,int>f;
        map<int,double>mp;
        for(int j=1;j<=n;j++){
            string s;
            cin>>s;
            int a,b,c;
            string k="";
            int i=1;
            for(i;i<s.length();i++){
                if(s[i]-'0'>=0 && s[i]-'0'<=9 ){
                    k+=s[i];
                }
                else break;
            }
            //cout<<k<<" ";
            a=stoi(k);
            i++;
            k="";
             for(i;i<s.length();i++){
                if(s[i]-'0'>=0 && s[i]-'0'<=9 ){
                    k+=s[i];
                }
                else break;
            }
           //cout<<k<<" ";
            b=stoi(k);
            i+=2;
            k="";
              for(i;i<s.length();i++){
                if(s[i]-'0'>=0 && s[i]-'0'<=9 ){
                    k+=s[i];
                }
                else break;
            }
           // cout<<k<<" ";
            c=stoi(k);
            double val=((1.0*a+1.0*b)/1.0*c);
            //cout<<val<<" ";
            mp[j]=val;
            f[val]++;
        }
        vector<int> v;
        for(int i=1;i<=n;i++){
           cout<<f[mp[i]]<<" ";
           //v.pb(f[mp[i]]);
        }
        sort(v.begin(),v.end());
       // for(auto x:v)cout<<x<<" ";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define code ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long
#define endl "\n"
#define pb push_back
#define rep(i,j,k) for(int i=j;i<k;i+=1)
const long double pi=2*acos(0.0);
const int MOD=1e9+7;
int32_t main (){
    code ;
    int t;
     //cin>>t;
    t=1;
    while(t--){
        int n;
        cin>>n;
        map<double,int>f;
        map<int,double>mp;
        for(int j=1;j<=n;j++){
            string s;
            cin>>s;
            int a,b,c;
            string k="";
            int i=1;
            for(i;i<s.length();i++){
                if(s[i]-'0'>=0 && s[i]-'0'<=9 ){
                    k+=s[i];
                }
                else break;
            }
            //cout<<k<<" ";
            a=stoi(k);
            i++;
            k="";
             for(i;i<s.length();i++){
                if(s[i]-'0'>=0 && s[i]-'0'<=9 ){
                    k+=s[i];
                }
                else break;
            }
           //cout<<k<<" ";
            b=stoi(k);
            i+=2;
            k="";
              for(i;i<s.length();i++){
                if(s[i]-'0'>=0 && s[i]-'0'<=9 ){
                    k+=s[i];
                }
                else break;
            }
           // cout<<k<<" ";
            c=stoi(k);
            double val=((double(a)+double(b))/double(c));
            //cout<<val<<" ";
            mp[j]=val;
            f[val]++;
        }
        vector<int> v;
        for(int i=1;i<=n;i++){
           cout<<f[mp[i]]<<" ";
           //v.pb(f[mp[i]]);
        }
        sort(v.begin(),v.end());
       // for(auto x:v)cout<<x<<" ";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define code ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long
#define endl "\n"
#define pb push_back
#define rep(i,j,k) for(int i=j;i<k;i+=1)
const long double pi=2*acos(0.0);
const int MOD=1e9+7;
int32_t main (){
    code ;
    int t;
     //cin>>t;
    t=1;
    while(t--){
        int n;
        cin>>n;
        map<int,int>f;
        map<int,int>mp;
        for(int j=1;j<=n;j++){
            string s;
            cin>>s;
            int a,b,c;
            string k="";
            int i=1;
            for(i;i<s.length();i++){
                if(s[i]-'0'>=0 && s[i]-'0'<=9 ){
                    k+=s[i];
                }
                else break;
            }
            //cout<<k<<" ";
            a=stoi(k);
            i++;
            k="";
             for(i;i<s.length();i++){
                if(s[i]-'0'>=0 && s[i]-'0'<=9 ){
                    k+=s[i];
                }
                else break;
            }
           //cout<<k<<" ";
            b=stoi(k);
            i+=2;
            k="";
              for(i;i<s.length();i++){
                if(s[i]-'0'>=0 && s[i]-'0'<=9 ){
                    k+=s[i];
                }
                else break;
            }
           // cout<<k<<" ";
            c=stoi(k);
            int val=(a+b)/c;
            //cout<<val<<" ";
            mp[j]=val;
            f[val]++;
        }
        for(int i=1;i<=n;i++){
            cout<<f[mp[i]]<<" ";
        }

    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;

map<double, int> m;
double pos[200005];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int a, b, c, n;
  char d;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> d >> a >> d >> b >> d >> d >> c;
    pos[i] = (double) (a + b) / c;
    if (m.find(pos[i]) == m.end()) {
      m[pos[i]] = 1;
    } else {
      m[pos[i]]++;
    }
  }
  for (int i = 0; i < n; i++) {
    cout << m[pos[i]] << ' ';
  }
  cout << '\n';
  return 0;
}


#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;

map<long double, int> m;
long double pos[200005];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int a, b, c, n;
  char d;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> d >> a >> d >> b >> d >> d >> c;
    pos[i] = (long double) (a + b) / c;
    if (m.find(pos[i]) == m.end()) {
      m[pos[i]] = 1;
    } else {
      m[pos[i]]++;
    }
  }
  for (int i = 0; i < n; i++) {
    cout << m[pos[i]] << ' ';
  }
  cout << '\n';
  return 0;
}