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

#define P(x,y) ((y)*12+x)

bool field[144];

void flip( int x, int y ){
    field[P(x,y)] = false;
    if( x>0 && field[P(x-1,y)] )
        flip( x-1, y );
    if( x<11 && field[P(x+1,y)] )
        flip( x+1, y );
    if( y>0 && field[P(x,y-1)] )
        flip( x, y-1 );
    if( y<11 && field[P(x,y+1)] )
        flip( x, y+1 );
}

int main(){
    string in;
    do{
        for( int i=0; i<12; i++ ){
            getline( cin, in );
            for( int j=0; j<12; j++ ){
                field[P(j,i)] = (in[j]=='1');
            }
        }
        int cnt = 0;
        for( int i=0; i<144; i++ ){
            if( field[i] ){
                cnt++;
                cout << (i%12) << (i/12) << endl;
                flip( i%12, i/12 );
            }
        }
        cout << cnt << endl;
    }while( getline(cin,in) );
    return 0;
}