#include<iostream>
using namespace std;

char field[3][4];

char solve(){
	for(int i=0; i<3; i++){
		if(field[i][0] == field[i][1] && field[i][1] == field[i][2])
			return field[i][0];
	}
	for(int k=0; k<3; k++){
		if(field[0][k] == field[1][k] && field[1][k] == field[2][k])
			return field[0][k];
	}
	if(field[0][0] == field[1][1] && field[1][1] == field[2][2])
		return field[0][0];
	if(field[0][2] == field[1][1] && field[1][1] == field[2][0])
		return field[0][2];
	return 'N';
}

int main(){
	while(true){
		for(int i=0; i<3; i++){
			cin >> field[i];
			if(field[0][0] == '0')
				return 0;
		}
		char ans = solve();
		if(ans != 'w' || ans != 'b')
			cout << "NA\n";
		else
			cout << ans << endl;
	}
}