#include <iostream>
#include <unordered_map>
#include <string>
using namespace std;
int main()
{
    int n;
    cin >> n;
    unordered_map<string, int> mp;
    int colors[8] = {0};
    for (int i = 0; i < n; i++)
    {
        string name;
        int color;
        cin >> name >> color;
        mp[name] = color;
    }
    for (const auto &item : mp)
    {
        colors[item.second]++;
    }
    for (int i = 0; i < 8; i++)
    {
        cout << colors[i] << endl;
    }
}