# 识别有效的IP地址和掩码并进行分类统计
def value(S):
    return int(S[0])*256**3 + int(S[1])*256**2 + int(S[2])*256 + int(S[3])
def bin64(S):
    b = ''
    for i in S:
        b += bin(int(i))[2:].zfill(8)
    return b
A1,A2 = value(['1','0','0','0']),value(['126','255','255','255'])
B1,B2 = value(['128','0','0','0']),value(['191','255','255','255'])
C1,C2 = value(['192','0','0','0']),value(['223','255','255','255'])
D1,D2 = value(['224','0','0','0']),value(['239','255','255','255'])
E1,E2 = value(['240','0','0','0']),value(['255','255','255','255'])
Sa1,Sa2 = value(['10','0','0','0']),value(['10','255','255','255'])
Sb1,Sb2 = value(['172','16','0','0']),value(['172','31','255','255'])
Sc1,Sc2 = value(['192','168','0','0']),value(['192','168','255','255'])
def isA(ip):
    return A1<=value(ip)<=A2
def isB(ip):
    return B1<=value(ip)<=B2
def isC(ip):
    return C1<=value(ip)<=C2
def isD(ip):
    return D1<=value(ip)<=D2
def isE(ip):
    return E1<=value(ip)<=E2
def isS(ip):
    return Sa1<=value(ip)<=Sa2 or Sb1<=value(ip)<=Sb2 or Sc1<=value(ip)<=Sc2
def isIp(ip):
    if len(ip) != 4:
        return False
    for i in ip:
        if not i.isnumeric() or int(i)<0 or int(i)>255:
            return False
    return True
def isMask(mask):
    if len(mask) != 4:
        return False
    for i in mask:
        if not i.isnumeric() or int(i)<0 or int(i)>255:
            return False
    t = list(map(int,list(bin64(mask))))
    a = []
    for i in range(len(t)-1):
        a.append(t[i]-t[i+1])
    if a.count(1) == 1 and a.count(0) == 30:
        return True
    else:
        return False

out  = [0]*7
while 1:
    try:
        pass
        ip,mask = input().strip().split('~')
        ip = ip.split('.')
        mask = mask.split('.')
        #print(ip)
        #print(mask)

        if isIp(ip) and isMask(mask):
            if isA(ip):
                out[0] += 1
            if isB(ip):
                out[1] += 1
            if isC(ip):
                out[2] += 1
            if isD(ip):
                out[3] += 1
            if isE(ip):
                out[4] += 1
            if isS(ip):
                out[6] += 1
        else:
            out[5] += 1
        #print('out=',out)
    except:
        break
#print('out=',out)
print(' '.join(map(str,out)))