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

bool check(char bw[3][3], char x){
	for(int i=0;i<3;i++)
		if((bw[i][0] == x) && (bw[i][1] == x) && (bw[i][2] == x))
			return true;
		else if((bw[0][i] == x) && (bw[1][i] == x) && (bw[2][i] == x))
			return true;
	
	if((bw[0][0] == x) && (bw[1][1] == x) && (bw[2][2] == x))
		return true;

	if((bw[0][2] == x) && (bw[1][1] == x) && (bw[2][0] == x))
		return true;

	return false;
}

int main(){
	while(1){
		string str;
		char bw[3][3];

		cin>>str;
		if(str == "0")
			break;

		for(int j=0;j<3;j++)
			bw[0][j] = str[j];

		for(int i=1;i<3;i++){
			cin>>str;
			for(int j=0;j<3;j++)
				bw[i][j] = str[j];
		}

		if(check(bw, 'b'))
			cout<<"b"<<endl;
		else if(check(bw, 'w'))
			cout<<"w"<<endl;
		else
			cout<<"NA"<<endl;
	}

	return 0;
}