#include using namespace std; #include using namespace atcoder; using ll = long long; #define rep(i, n) for (ll i = 0; i < ll(n); i++) int main(){ int n; cin >> n; vector s(n); vector c(n); rep(i,n) cin >> s[i] >> c[i]; set st; vector cnt(8); for(int i = n-1;i >= 0;i--){ if(st.count(s[i])) continue; st.insert(s[i]); cnt[c[i]]++; } rep(i,8) cout << cnt[i] << ' '; cout << endl; }