//#define _GLIBCXX_DEBUG #include using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; using uint = unsigned; using pii = pair; using pll = pair; template using pq = priority_queue, greater>; const int MOD = 1000000007; const int MODD = 998244353; const ll dx[] = {0, 1, 0, -1, 1, -1, 1, -1}; const ll dy[] = {1, 0, -1, 0, 1, 1, -1, -1}; #define overload4(_1, _2, _3, _4, name, ...) name #define overload3(_1, _2, _3, name, ...) name #define rep1(n) for(ll i = 0; i < (ll)(n); i++) #define rep2(i, n) for(ll i = 0; i < (ll)(n); i++) #define rep3(i, a, b) for(ll i = (ll)(a); i < (ll)(b); i++) #define rep4(i, a, b, c) for(ll i = (ll)(a); i < (ll)(b); i += (ll)(c)) #define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__) #define rrep1(n) for(ll i = (ll)(n); i > (ll)(0); i--) #define rrep2(i, n) for(ll i = (ll)(n); i > (ll)(0); i--) #define rrep3(i, a, b) for(ll i = (ll)(a); i > (ll)(b); i--) #define rrep4(i, a, b, c) for(ll i = (ll)(a); i > (ll)(b); i -= (ll)(c)) #define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__) #define all(v) v.begin(), v.end() #define elif else if #define eb emplace_back #define mp make_pair #define mt make_tuple #define fi first #define se second #define stoi stoll #define MIN(v) *min_element(all(v)) #define MAX(v) *max_element(all(v)) int main(){ ll N; cin >> N; map SS; vector ans(8, 0); rep(N){ string S; ll C; cin >> S >> C; if(SS[S]) ans[SS[S]]--, ans[C]++, SS[S] = C; else ans[C]++, SS[S] = C; } for(auto i : ans) cout << i << endl; return 0; }