#include <iostream>
#include <string>
using namespace std;
const int black =  1;
const int white =  0;
const int NaN   = -1;

int check(string f[]){

	if( f[0][0] == f[1][1] && f[1][1] == f[2][2]){
		if( f[0][0] == 'w' ) return white;
		if( f[0][0] == 'b' ) return black;
	}
	
	for(int i=0 ; i<3 ; i++){
		if( f[i][0] == f[i][1] && f[i][1] == f[i][2]){
			if( f[i][0] == 'w' ) return white;
			if( f[i][0] == 'b' ) return black;
		}
		if( f[0][i] == f[1][i] && f[1][i] == f[2][i]){
			if( f[0][i] == 'w' ) return white;
			if( f[0][i] == 'b' ) return black;
		}
	}
	return NaN;
}

int main(){
	string map[3];
	bool flag = true;
	
	while(flag){
		for(int i=0 ; i<3 ; i++){
			cin >> map[i];
			if( map[i] == "0" ){
				flag = false;
				break;
			}
		}
		if(flag == false) break;
		
		if( check( map ) == white){
			cout << "w" << endl;
		}else if( check( map ) == black){
			cout << "b" << endl;
		}else{
			cout << "NA" << endl;
		}
	}
}