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

struct Answer {
  int y, x, size;
  Answer(int y_, int x_, int size_) : y(y_), x(x_), size(size_) { }
};
int N;
int board[10][10];
vector<Answer> ans;
bool done;

bool check_small(int y, int x) {
  if(y < 0 || y > 7 || x < 1 || x > 8) return false;
  if(board[y][x] < 1)         return false;
  if(board[y + 1][x - 1] < 1) return false;
  if(board[y + 1][x] < 1)     return false;
  if(board[y + 1][x + 1] < 1) return false;
  if(board[y + 2][x] < 1)     return false;
  return true;
}

bool check_middle(int y, int x) {
  if(y < 0 || y > 7 || x < 0 || x > 7) return false;
  for(int i = 0; i < 2; ++i) {
    for(int j = 0; j < 2; ++j) {
      if(board[y + i][x + j] < 1) return false;
    }
  }
  return true;
}

bool check_big(int y, int x) {
  if(y < 0 || y > 5 || x < 2 || x > 7) return false;
  if(board[y][x] < 1)         return false;
  if(board[y + 1][x - 1] < 1) return false;
  if(board[y + 1][x] < 1)     return false;
  if(board[y + 1][x + 1] < 1) return false;
  if(board[y + 2][x - 2] < 1) return false;
  if(board[y + 2][x - 1] < 1) return false;
  if(board[y + 2][x] < 1)     return false;
  if(board[y + 2][x + 1] < 1) return false;
  if(board[y + 2][x + 2] < 1) return false;
  if(board[y + 3][x - 1] < 1) return false;
  if(board[y + 3][x] < 1)     return false;
  if(board[y + 3][x + 1] < 1) return false;
  if(board[y + 4][x] < 1)     return false;
  return true;
}

void solve(int y, int x) {
  if(x > 9) {
    solve(y + 1, 0);
  }
  if(board[y][x] > 0) {
    // small
    if(check_small(y, x)) {
      board[y][x]--;
      board[y + 1][x - 1]--;
      board[y + 1][x]--;
      board[y + 1][x + 1]--;
      board[y + 2][x]--;
      board[y][x]++;
      board[y + 1][x - 1]++;
      board[y + 1][x]++;
      board[y + 1][x + 1]++;
      board[y + 2][x]++;
    }
    // middle
    // big
  }
  solve(y, x + 1);
}

int main() {
  cin >> N;
  for(int i = 0; i < 10; ++i) {
    for(int j = 0; j < 10; ++j) {
      cin >> board[i][j];
    }
  }
  done = false;
  // solve(0, 0);
}