#include <iostream>
#include<stack>
#include<vector>
#include<string.h>
using namespace std;
int board[22][22];
int stone;
int cnt;
int win;
string dir;
int dfs(int y, int x, int color, int move_y, int move_x){
if(board[y+move_y][x+move_x] != color) return 0;
return dfs(y+move_y, x+move_x, color, move_y, move_x)+1;
//메인 함수에서 방향 주기
//내려가는건 재귀
}
int main(){
int n;
for(int i=1; i<=19; i++){
for(int j=1; j<=19; j++){
cin >> n;
board[i][j] = n;
}
}
// (y ,x+1)
// (y+1,x-1) (y+1,x ) (y+1,x+1)
for(int i=1; i<=19; i++){
for(int j=1; j<=19; j++){
int x1 = dfs(i, j, board[i][j], 0, 1);
int x2 = dfs(i, j, board[i][j], 1, 1);
int x3 = dfs(i, j, board[i][j], 1, 0);
int x4 = dfs(i, j, board[i][j], 1, -1);
if(x1==5 || x2==5 || x3==5 || x4==5){
cout << stone << endl << i << " " << j;
i += 20;
j += 20;
}
}
}
return 0;
}
//#include<stdio.h>
//
//int rec(int k) {
// if(k == 1) {
// return 1;
// }
// return rec(k-1) + 1;
//}
///*
//rec(5)
//> rec(4) + 1
// > rec(3) + 1
//= (1) + 1) + 1) +1 )+1
//
//*/
//int main() {
// printf("%d", rec(5));
//}