import java.util.Scanner;
import java.util.Stack;
public class Main {
public static void main(String[] args) {
int A_address = 0;
int B_address = 0;
int C_address = 0;
int D_address = 0;
int E_address = 0;
int illegal_address = 0;
int private_address = 0;
Scanner sc = new Scanner(System.in);
while(sc.hasNextLine()) {
String line = sc.nextLine();
if(line.length() == 0) break;
String[] split = line.split("\\~");
String ip = split[0];
String mask = split[1];
if(isNeglect(ip)) continue;
if(isIpIllegal(ip)) {
illegal_address++;
continue;
}
if(isMaskIllegal(mask)) {
illegal_address++;
continue;
}
String[] ipArr = ip.split("\\.");
String[] maskArr = mask.split("\\.");
int[] ipNumArr = new int[4];
for(int i = 0;i < 4;i++) {
ipNumArr[i] = Integer.parseInt(ipArr[i]) & Integer.parseInt(maskArr[i]);
}
if(ipNumArr[0]>=1 && ipNumArr[0]<=126) {
A_address++;
if(ipNumArr[0] == 10) private_address++;
continue;
}else if(ipNumArr[0]>=128 && ipNumArr[0]<=191) {
B_address++;
if(ipNumArr[0]==172 && ipNumArr[1]>=16 && ipNumArr[1]<=31) private_address++;
continue;
}else if(ipNumArr[0]>=192 && ipNumArr[0]<=223) {
C_address++;
if(ipNumArr[0]==192 && ipNumArr[1]==168) private_address++;
continue;
}else if(ipNumArr[0]>=224 && ipNumArr[0]<=239) {
D_address++;
continue;
}else if(ipNumArr[0]>=240 && ipNumArr[0]<=255) {
E_address++;
continue;
}
}
System.out.print(A_address+" "+B_address+" "+C_address+" "+D_address+" "+E_address+" "+illegal_address+" "+private_address);
sc.close();
}
private static boolean isNeglect(String ip) {
String[] split = ip.split("\\.");
if(split[0].equals("0") || split[0].equals("127")) return true;
else return false;
}
private static boolean isIpIllegal(String ip) {
String[] split = ip.split("\\.");
boolean flag = false;
for (String s : split) {
if(s.length() == 0) {
flag = true;
break;
}
}
return flag;
}
private static boolean isMaskIllegal(String mask) {
String[] split = mask.split("\\.");
int num255 = 0;
int num0 = 0;
boolean flag = false;
for (String s : split) {
if(s.length()==0) {
flag = true;
return flag;
}
if(s.equals("255")) num255++;
if(s.equals("0")) num0++;
}
if(num255==4 || num0==4) {
flag = true;
return flag;
}
flag = exist1(split);
return flag;
}
private static boolean exist1(String[] str) {
int num_1 = Integer.parseInt(str[0]);
int num_2 = Integer.parseInt(str[1]);
int num_3 = Integer.parseInt(str[2]);
int num_4 = Integer.parseInt(str[3]);
boolean exist_0 = false;
Stack<Integer> stack1 = new Stack<>();
Stack<Integer> stack2 = new Stack<>();
Stack<Integer> stack3 = new Stack<>();
Stack<Integer> stack4 = new Stack<>();
while(num_1>0) {
stack1.push(num_1%2);
num_1 >>= 1;
}
while(num_2>0) {
stack2.push(num_2%2);
num_2 >>= 1;
}
while(num_3>0) {
stack3.push(num_3%2);
num_3 >>= 1;
}
while(num_4>0) {
stack4.push(num_4%2);
num_4 >>= 1;
}
if(stack1.size() < 8) bu0(stack1);
if(stack2.size() < 8) bu0(stack2);
if(stack3.size() < 8) bu0(stack3);
if(stack4.size() < 8) bu0(stack4);
if(stack1.peek() == 0) return true;
while(!stack1.empty()) {
if(!exist_0) {
if(stack1.peek() == 0) exist_0 = true;
}else {
if(stack1.peek() == 1) return true;
}
stack1.pop();
}
while(!stack2.empty()) {
if(!exist_0) {
if(stack2.peek() == 0) exist_0 = true;
}else {
if(stack2.peek() == 1) return true;
}
stack2.pop();
}
while(!stack3.empty()) {
if(!exist_0) {
if(stack3.peek() == 0) exist_0 = true;
}else {
if(stack3.peek() == 1) return true;
}
stack3.pop();
}
while(!stack4.empty()) {
if(!exist_0) {
if(stack4.peek() == 0) exist_0 = true;
}else {
if(stack4.peek() == 1) return true;
}
stack4.pop();
}
return false;
}
private static void bu0(Stack<Integer> stack) {
int bu_0_num = 8 - stack.size();
for(int i = 0;i < bu_0_num;i++) {
stack.push(0);
}
}
}