#include<iostream>
#include<vector>
using namespace std;

int main(void){
  vector < vector <int> > square;
  square.resize(14);
  for(int i=0; (int)i<square.size(); i++){
    square[i].resize(14);
  }
  for(int i=0; i<(int)square.size(); i++){
    for(int j=0; j<(int)square[i].size(); j++){
      square[i][j] =0;
    }
  }

  int x, y, size;
  int min=0, max=0;
  char c;

  while( cin >> x >> c >> y >> c >> size ){
    x+=2;
    y+=2;
    if(size>=1 && size<=3){
      square[y][x]++;
      square[y][x-1]++;
      square[y-1][x]++;
      square[y+1][x]++;
      square[y][x+1]++;
    }
    if(size==2 || size==3){
      square[y-1][x-1]++;
      square[y+1][x-1]++;
      square[y-1][x+1]++;
      square[y+1][x+1]++;
    }
    if(size==3){
      square[y][x-2]++;
      square[y-2][x]++;
      square[y+2][x]++;
      square[y][x+2]++;
    }
  }

  for(int i=2; (int)i<square.size()-2; i++){
    for(int j=2; (int)j<square.size()-2; j++){
      cout << square[i][j];
      if((int)j==square.size()-3){
        cout << endl;
      }else{
        cout << " ";
      }
    }
  }

  cout << min << endl << max << endl;
  return 0;
}