#include <iostream>

using namespace std;

int checkYoko( char stage[4][4], int i )
{
	if( stage[i][0] == stage[i][1] && stage[i][1] == stage[i][2] ) {
		if( stage[i][0] == 'b' ) return 1;
		else if( stage[i][0] == 'w' ) return 2;
		else return 0;
	}

	return 0;
}

int checkTate( char stage[4][4], int i )
{
	if( stage[0][i] == stage[1][i] && stage[1][i] == stage[2][i] ) {
		if( stage[0][i] == 'b' ) return 1;
		else if( stage[0][i] == 'w' ) return 2;
		else return 0;
	}

	return 0;
}


int main(int argc, char const* argv[])
{
	char stage[4][4];

	while( cin >> stage[0] && stage[0][0] != '0' ){
		for( int i = 1;i < 3;i++ ) cin >> stage[i];

		int i;
		for( i = 0;i < 3;i++ ) {
			int answer = checkYoko( stage, i );
			
			if( answer == 0 ) {
				answer = checkTate( stage, i );
			}

			if( answer == 1 ){
				cout << 'b' << endl;
				break;
			} else if( answer == 2 ){
				cout << 'w' << endl;
				break;
			} else {
				if( stage[0][0] == stage[1][1] && stage[1][1] == stage[2][2] || stage[2][0] == stage[1][1] && stage[1][1] == stage[0][2] ) {
					cout << stage[0][0] << endl;
					break;
				}
			}
		}
		if( i == 3 ) cout << "NA" << endl;
	}

	return 0;
}