import sys
a,b,c,d,e,f,g = 0,0,0,0,0,0,0
z = sys.stdin.read().strip().split('\n')
for y in z:
try:
h,i= y.split('~')
j,k,l,m = h.split('.')
n,o,p,q = map(int,i.split('.'))
if 0<= n <= 255 and 0<= o <= 255 and 0<= p <= 255 and 0<= q <= 255 :
r = bin(n)[2:].zfill(8)
s = bin(o)[2:].zfill(8)
t = bin(p)[2:].zfill(8)
u = bin(q)[2:].zfill(8)
v = str(r)+str(s)+str(t)+str(u)
if 0<= int(j) <= 255 and 0<= int(k) <= 255 and 0<= int(l) <= 255 and 0<= int(m) <= 255 :
if int(j) == 0 or int(j) == 127:
continue
else:
f += 1
continue
if all(c in '01' for c in v) and '0' in v and '1' not in v[v.find('0'):]:
if '0' not in v or '1' not in v :
f += 1
continue
else:
f += 1
continue
if 1<= int(j) <= 126 :
a += 1
if int(j) == 10:
g += 1
elif 128<= int(j) <= 191 :
b += 1
if int(j) == 172 and int(k) == 16:
g += 1
elif 192<= int(j) <= 223 :
c += 1
if int(j) == 192 and int(k) == 168:
g += 1
elif 224<= int(j) <= 239 :
d += 1
elif 240<= int(j) <= 255 :
e += 1
else:
pass
except:
f += 1
print(a,b,c,d,e,f,g,sep=' ')