#include using namespace std; #define rep(i, n) for (ll i = 0; i < (n); ++i) #define rep1(i, n) for (ll i = 1; i < (n); ++i) #define rrep(i, n) for (ll i = n; i > 0; --i) #define bitrep(i, n) for (ll i = 0; i < (1 << n); ++i) #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() #define yesNo(b) ((b) ? "Yes" : "No") using ll = long long; using ull = unsigned long long; using ld = long double; string alphabet = "abcdefghijklmnopqrstuvwxyz"; string ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const double pi = 3.141592653589793; ll smallMOD = 998244353; ll bigMOD = 1000000007; int main() { int n; cin >> n; vector a(8, 0); map mp; rep(i, n) { string s; int x; cin >> s >> x; a[x]++; if (mp[s] != 0) { a[mp[s] - 1]--; mp[s] = x + 1; } else { mp[s] = x + 1; } } rep(i, 8) { cout << a[i] << endl; } return 0; }