import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int countA = 0,countB = 0,countC = 0,countD = 0,countE = 0,countWrong = 0,countPrivate = 0;
while (sc.hasNextLine()){
String str = sc.nextLine();
//双回车退出hasNextLine;
if("".equals(str)){
break;
}
//分离出ip地址和子网掩码
String[] ipAndMask = str.split("\\~");
//分离出第一位,判断是否忽略,属于哪一类
int num1 = getIpSeg(ipAndMask[0],0);
if(num1 == 0 || num1 == 127){
continue;
}
//判断子网掩码是否非法
if(maskIsIllegal(ipAndMask[1])){
countWrong++;
continue;
}
//判断ip地址是否非法
if(ipIsIllegal(ipAndMask[0])){
countWrong++;
continue;
}
//判断合法的
if(num1 >= 1 && num1 <= 126){
countA++;
}else if(num1 >= 128 && num1 <= 191){
countB++;
}else if(num1 >= 192 && num1 <= 223){
countC++;
}else if(num1 >= 224 && num1 <= 239){
countD++;
}else if(num1 >= 240 && num1 <= 255){
countE++;
}
//判断私有
int num2 = getIpSeg(ipAndMask[0], 1);
if(num1 == 10 || (num1 == 172 && num2 >= 16 && num2 <= 31) || (num1 == 192 && num2 == 168)){
countPrivate++;
}
}
System.out.println(countA+" "+countB+" "+countC+" "+countD+" "+countE+" "+countWrong+" "+countPrivate);
}
private static boolean ipIsIllegal(String s) {
//分离每位
String[] num = s.split("\\.");
if(num.length != 4){
return true;
}
if(Integer.parseInt(num[0]) > 255 || Integer.parseInt(num[1]) > 255 || Integer.parseInt(num[2]) > 255 || Integer.parseInt(num[3]) > 255){
return true;
}
return false;
}
private static boolean maskIsIllegal(String s) {
//分离每位
String[] num = s.split("\\.");
if(num.length != 4){
return true;
}
//把子网掩码转为二进制字符串
String mask = toBinary(num);
if(!mask.matches("[1]{1,}[0]{1,}")){
return true;
}
return false;
}
private static String toBinary(String[] num) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < num.length; i++) {
StringBuilder s = new StringBuilder(Integer.toBinaryString(Integer.parseInt(num[i])));
while(s.length() < 8){
s.insert(0, "0");
}
sb.append(s);
}
return sb.toString();
}
private static int getIpSeg(String s,int index) {
//分离每位
String[] num = s.split("\\.");
return Integer.parseInt(num[index]);
}
}