subnet_mask = []
ip = []
input_ = []
while True:
    try:
        input_ = input()
        input_ = input_.split('~') #输入的字符串分开
        subnet_mask.append(input_[1]) #保存掩码部分
        ip.append(input_[0]) #保存IP部分
    except:
        break
A = 0
B = 0
C = 0
D = 0
E = 0
wrong = 0
p_ip = 0
for i in range(len(ip)):
    a = subnet_mask[i]
    a = a.split('.') #按照'.'分开
    b = ip[i]
    b = b.split('.') #按照'.'分开
    if(int(b[0]) == 0) | (int(b[0]) == 127): #判断ip是否0或者127开头,如果是直接略过,优先判定这个,即使掩码不对也略过,题目这样设置真的***
        continue
    b_1 ='{:08b}'.format(int(a[0])) #'{:08b}'.format()是转化为8位二进制,前面补0
    b_2 ='{:08b}'.format(int(a[1]))
    b_3 ='{:08b}'.format(int(a[2]))
    b_4 ='{:08b}'.format(int(a[3]))
    flag = 0
    bin_subnet_mask = b_1+b_2+b_3+b_4 #拼接
    for j in range(4):
        if(bin_subnet_mask[j] == '') | (bin_subnet_mask[j].isdigit() == 0): #判断输入的是否为合法的掩码,有字母和空白的去掉
            flag = 1
            break
        if(int(bin_subnet_mask[j]) < 0) | (int(bin_subnet_mask[j]) > 255):#判断是否在0-255之间
            flag = 1
            break
    if(flag == 1):#出现前面两个错误则认为是非法的
        wrong += 1
        continue
    if(bin_subnet_mask == '00000000000000000000000000000000') | (bin_subnet_mask == '11111111111111111111111111111111'):#掩码全0或者全1也认为是非法的
        wrong += 1
        continue
    bin_subnet_mask = list(bin_subnet_mask)
    flag = 0
    for j in range(32):
        if(bin_subnet_mask[j] == '0'): #找到第一个0的位置
            flag = j
            break
    if('1' in bin_subnet_mask[flag+1:]):#若后面有1则认为是非法的掩码
        wrong += 1
        continue
            
    
    flag = 0
    for j in range(4):#对于输入是否合法ip的判断
        if(b[j] == '') | (b[j].isdigit() == 0):
            flag = 1
            break
        if(int(b[j]) < 0) | (int(b[j]) > 255):
            flag = 1
            break
    if(flag == 1):
        wrong += 1
        continue
    if(int(b[0]) == 0)|(int(b[0]) == 127):
        continue
    if(int(b[0]) >= 1)&(int(b[0]) <= 126):
        A += 1
    elif(int(b[0]) >= 128)&(int(b[0]) <= 191):
        B += 1
    elif(int(b[0]) >= 192)&(int(b[0]) <= 223):
        C += 1
    elif(int(b[0]) >= 224)&(int(b[0]) <= 239):
        D += 1
    else:
        E += 1 #以上为对ABCDE分类
    if(int(b[0]) == 10):#判断是否私人ip ps:私人IP与IP分类不冲突
        p_ip += 1
    if(int(b[0]) == 172) & (int(b[1]) >= 16) & (int(b[1]) <= 31):
        p_ip += 1
    if(int(b[0]) == 192) & (int(b[1]) == 168):
        p_ip += 1
print(A,B,C,D,E,wrong,p_ip)