ip_lst = ip.split('.')
    if len(ip_lst) != 4 or '' in ip_lst:
        return False
    for item in ip_lst:
        if int(item) < 0 or int(item) > 255:
            return False
    return True


def check_mask(mask):
    if not check_ip(mask):
        return False
    if mask == '255.255.255.255' or mask == '0.0.0.0':  # 二进制下全为1或者全为0
        return False
    mask_lst = mask.split('.')
    mask_bit = ''
    for item in mask_lst:
        a = bin(int(item))[2:]
        b = '0' * (8 - len(a)) + str(a)
        mask_bit += b
    find_0 = mask_bit.find('0')  # 查找 0 从哪里开始
    find_1 = mask_bit.rfind('1')  # 查找 1 从哪里结束
    if find_1 + 1 == find_0:
        return True
    else:
        return False


def check_private_ip(ip):
    ip_lst = ip.split('.')
    if ip_lst[0] == '10':
        return True
    if ip_lst[0] == '172' and 16 <= int(ip_lst[1]) <= 31:
        return True
    if ip_lst[0] == '192' and ip_lst[1] == '168':
        return True
    return False


res = [0, 0, 0, 0, 0, 0, 0]  # A,B,C,D,E,错误IP或掩码,私有IP
while True:
    try:
        s = input()
        ip = s.split('~')[0]
        mask = s.split('~')[1]
        if check_ip(ip):
            first = int(ip.split('.')[0])
            if first == 0 or first == 127:
                continue
            if check_mask(mask):
                if check_private_ip(ip):
                    res[6] += 1
                if 1 <= first <= 126:
                    res[0] += 1
                elif 128 <= first <= 191:
                    res[1] += 1
                elif 192 <= first <= 223:
                    res[2] += 1
                elif 224 <= first <= 239:
                    res[3] += 1
                elif 240 <= first <= 255:
                    res[4] += 1
            else:
                res[5] += 1
        else:
            res[5] += 1
    except:
        break
print(' '.join(str(i) for i in res))