import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        int a = 0, b = 0, c = 0, d = 0, e = 0, error = 0, person = 0;
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String str;
        while ((str = bufferedReader.readLine()) != null) {
            if (str.equals("")) {
                break;
            }
            if (str.startsWith("0.") || str.startsWith("127")) {
                continue;
            }
            String[] ipMask = str.split("~");
            if (!checkMask(ipMask[1])) {
                error++;
                continue;
            }
            if (!checkIp(ipMask[0])) {
                error++;
            } else {
                int ipStart = Integer.parseInt(ipMask[0].split("\\.")[0]);
                if (ipStart >= 1 && ipStart <= 126) {
                    if (checkIsPersonIp(ipMask[0])) {
                        person++;
                    }
                    a++;
                } else if (ipStart >= 128 && ipStart <= 191) {
                    if (checkIsPersonIp(ipMask[0])) {
                        person++;
                    }
                    b++;
                } else if (ipStart >= 192 && ipStart <= 223) {
                    if (checkIsPersonIp(ipMask[0])) {
                        person++;
                    }
                    c++;
                } else if (ipStart >= 224 && ipStart <= 239) {
                    d++;
                } else if (ipStart >= 240 && ipStart <= 255) {
                    e++;
                } else {
                    error++;
                }
            }
        }
        System.out.println(a + " " + b + " " + c + " " + d + " " + e + " " + error + " " + person);
    }

    private static boolean checkMask(String mask) {
        String[] maskArray = mask.split("\\.");
        if (maskArray.length != 4) {
            return false;
        }
        StringBuffer stringBuffer = new StringBuffer();
        for (int i = 0; i < maskArray.length; i++) {
            String binary = Integer.toBinaryString(Integer.parseInt(maskArray[i]));
            // 不足八位补0
            for (int j = 0; j < 8 - binary.length(); j++) {
                stringBuffer.append("0");
            }
            stringBuffer.append(binary);
        }
        String maskBinary = stringBuffer.toString();
        return maskBinary.indexOf("0") > maskBinary.lastIndexOf("1");

    }

    private static boolean checkIp(String ip) {
        String[] ipArray = ip.split("\\.");
        if (ipArray.length != 4) {
            return false;
        }
        for (int i = 0; i < ipArray.length; i++) {
            try {
                int item = Integer.parseInt(ipArray[i]);
                if ((ipArray[i].length() != ("" + item).length() || item < 0 || item > 255)) {
                    return false;
                }
            } catch (NumberFormatException e) {
                return false;
            }
        }
        return true;
    }

    private static boolean checkIsPersonIp(String ip) {
        if (ip.startsWith("10.") || ip.startsWith("172.") || ip.startsWith("192.")) {
            String[] ipArray = ip.split("\\.");
            int[] intArray = new int[3];
            for (int i = 1; i < ipArray.length; i++) {
                int item = Integer.parseInt(ipArray[i]);
                intArray[i - 1] = item;
            }
            if (ip.startsWith("10")) {
                return true;
            } else if (ip.startsWith("172")) {
                return intArray[0] >= 16 && intArray[0] <= 31;
            } else {
                return intArray[0] == 168;
            }
        }
        return false;
    }
}