import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        
        int aCount = 0;
        int bCount = 0;
        int cCount = 0;
        int dCount = 0;
        int eCount = 0;
        int isError = 0;//ip或掩码非法个数
        int priCount = 0;
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String lineStr = in.nextLine();
            String[] ipAndMask = lineStr.split("~", -1);
            if (ipAndMask.length == 2) {
                String[] ipArr = ipAndMask[0].split("\\.", -1);
                String[] maskArr = ipAndMask[1].split("\\.", -1);
                boolean ipCheck = checkIp(ipArr);
                boolean maskCheck1 = checkIp(maskArr);
                boolean maskCheck2 = false;
                if(!ipCheck){
                    isError++;
                }
                if(!maskCheck1){
                    isError++;
                }
                if(maskCheck1){
                    maskCheck2 = checkMask(maskArr);
                    if(!maskCheck2){
                        if(!"0".equals(ipArr[0]) && !"127".equals(ipArr[0])){
                            isError++;
                        }
                    }
                }
                if(ipCheck && maskCheck1 && maskCheck2){
                    String type = getCommonClassify(ipArr);
                    if("A".equals(type)){
                        aCount++;
                    }
                    if("B".equals(type)){
                        bCount++;
                    }
                    if("C".equals(type)){
                        cCount++;
                    }
                    if("D".equals(type)){
                        dCount++;
                    }
                    if("E".equals(type)){
                        eCount++;
                    }
                    if(getPriClassify(ipArr)){
                        priCount++;
                    }
                }

            }
            
        }
        System.out.println(aCount + " " + bCount + " " + cCount + " " + dCount + " " + eCount + " " + isError + " " + priCount);
    }

    public static boolean checkIp(String[] target) {
        if (target.length != 4) return false;
        try {
            for (int i = 0; i < target.length; i++) {
                long temp = Long.parseLong(target[i]);
                if (temp < 0l || temp > 255l) {
                    throw new Exception("unavailable");
                }
            }
        } catch (Exception e) {
            return false;
        }
        return true;
    }

    public static boolean checkMask(String[] target) {
        String binary1 = String.format("%8s",Long.toBinaryString(Long.parseLong(target[0]))).replace(" ","0");
        String binary2 = String.format("%8s",Long.toBinaryString(Long.parseLong(target[1]))).replace(" ","0");
        String binary3 = String.format("%8s",Long.toBinaryString(Long.parseLong(target[2]))).replace(" ","0");
        String binary4 = String.format("%8s",Long.toBinaryString(Long.parseLong(target[3]))).replace(" ","0");

        String binary = binary1 +binary2 + binary3 + binary4;
        if(binary.contains("01") || !binary.contains("0") || !binary.contains("1")){
            return false;
        }
        return true;
    }

    public static String getCommonClassify(String[] target){
        long starts = Long.parseLong(target[0]);
        if(starts >=1l && starts <= 126l){
            return "A";
        }
        if(starts >=128l && starts <= 191l){
            return "B";
        }
        if(starts >=192l && starts <= 223l){
            return "C";
        }
        if(starts >=224l && starts <= 239l){
            return "D";
        }
        if(starts >=240l && starts <= 255l){
            return "E";
        }
        return "unknown";
    }

    public static boolean getPriClassify(String[] target){
        long starts = Long.parseLong(target[0]);
        long seconds = Long.parseLong(target[1]);
        if(starts == 10l){
            return true;
        }
        if(starts == 192l && seconds == 168l){
            return true;
        }
        if(starts == 172l && seconds >= 16l && seconds <= 31l){
            return true;
        }
        return false;
    }
}