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

bool teshu(string ip){
    stringstream ss(ip);
    string s;
    vector<int> v;

    while (getline(ss, s, '.')) {
        v.push_back(stoi(s));
    }
    if ((v[0] == 0) ||
        (v[0] == 127))
        return true;
    
    return false;
}

bool judge_ip(string ip){
    stringstream ss(ip);
    string s;
    vector<int> v;
    int j = 0;

    while (getline(ss, s, '.'))
    {
        if (++j > 4 || s.length()==0 || stoi(s, 0, 10) < 0 || stoi(s, 0, 10) > 255)
            return false;
    }

    return j == 4;
}
 
bool is_private(string ip){
    stringstream ss(ip);
    string s;
    vector<int> v;

    while (getline(ss, s, '.')) {
        v.push_back(stoi(s));
    }
    if ((v[0] == 10) ||
        (v[0] == 172 && v[1] <=31 && v[1] >= 16) ||
        (v[0] == 192 && v[1] == 168))
        return true;
    
    return false;
}

int ip_type(string ip){
    stringstream ss(ip);
    string s;
    vector<int> v;

    while (getline(ss, s, '.')) {
        v.push_back(stoi(s));
    }

    if (v[0] >= 1 && v[0] <= 126)
        return 1;
    if (v[0] >= 128 && v[0] <= 191)
        return 2;
    if (v[0] >= 192 && v[0] <= 223)
        return 3;
    if (v[0] >= 224 && v[0] <= 239)
        return 4;
    if (v[0] >= 240 && v[0] <= 255)
        return 5;

    return -1;
}

bool is_mask(string ip){
    stringstream ss(ip);
    string s;
    vector<int> v;
    int flag = 1;

    while (getline(ss, s, '.')) {
        v.push_back(stoi(s));
    }

    if (v[0] == 255 && v[1] == 255 && v[2] == 255 && v[3] == 255)
        return false;

    if (v[0] == 0 && v[1] == 0 && v[2] == 0 && v[3] == 0)
        return false;

    for (int i = 0; i < 4; i++)
    {
        if (flag == 0 && v[i] > 0)
            return false;
        if (v[i] != 255)
            flag = 0;
        if (v[i] < 255 && v[i] > 0)
        {
            if (v[i] != 128 && v[i] != 192 && v[i] != 224 && v[i] != 240 && 
                v[i] != 248 && v[i] != 252 && v[i] != 254)
            {
                return false;
            }
        }
    }

    return true;
}
 
int main(){
    string input;
    int a = 0,b = 0,c = 0,d = 0,e = 0,err = 0,p = 0;
    while (getline(cin, input))
    {
        string ip, mask;
        stringstream ss(input);
        getline(ss, ip, '~');
        getline(ss, mask, '~');
        
        if (judge_ip(ip) && teshu(ip))
            continue;
        if (!judge_ip(mask))
        {
            err += 1;
            continue;
        }
        else {
            if (!is_mask(mask))
            {
                err += 1;
                continue;
            }
        }
        if (!judge_ip(ip))
        {
            err += 1;
        }
        else {
            switch (ip_type(ip)) {
                case 1:
                    a += 1;
                    break;
                case 2:
                    b += 1;
                    break;
                case 3:
                    c += 1;
                    break;
                case 4:
                    d += 1;
                    break;
                case 5:
                    e += 1;
                    break;
                default:
                    err += 1;
            }
            if (is_private(ip))
                p += 1;
        }
    }
    cout << a << " " << b << " " << c << " " << d << " " << e << " " << err << " " << p << endl;
    return 0;
}