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

string m[3];

string solve(){
	for(int i=0 ; i < 3 ; i++ ){
		if( m[i] == "bbb" )
			return "b";
		if( m[i] == "www" )
			return "w";
		if( m[0][i] == 'b' && m[1][i] == 'b' && m[2][i] == 'b' )
			return "b";
		if( m[0][i] == 'w' && m[1][i] == 'w' && m[2][i] == 'w' )
			return "w";
	}
	if( m[0][0] == 'b' && m[1][1] == 'b' && m[2][2] == 'b' )
		return "b";
	if( m[0][0] == 'w' && m[1][1] == 'w' && m[2][2] == 'w' )
		return "w";
	if( m[0][2] == 'b' && m[1][1] == 'b' && m[2][0] == 'b' )
		return "b";
	if( m[0][2] == 'w' && m[1][1] == 'w' && m[2][0] == 'w' )
		return "w";
	return "NA";
}

int main(){
	string s;
	while( cin >> s , s != "0" ){
		m[0] = s;
		cin >> s;
		m[1] = s;
		cin >> s;
		m[2] = s;
		cout << solve() << endl;
	}
}