#include<iostream>
#include<cstdio>

using namespace std;

int main()
{
	
	for(;;){
		char ban[3][3];
		char result = 'N';
		
		for(int i = 0; i < 3; i++){
			for(int j = 0; j < 3; j++){
				cin >> ban[i][j];
				if(ban[i][j] == '0'){
					goto FIN;
				}
			}
		}
		
		for(int i = 0; i < 3; i++){
			if(ban[i][0] == ban[i][1] && ban[i][1] == ban[i][2]){	//ツ可。ツ板サツ津ィ
				if(ban[i][0] == 'b'){
					result = 'b';
				}
				else if(ban[i][0] == 'w'){
					result = 'w';
				}
			}
		}
		for(int i = 0; i < 3; i++){
			if(ban[0][i] == ban[1][i] && ban[1][i] == ban[2][i]){	//ツ可。ツ板サツ津ィ
				if(ban[0][i] == 'b'){
					result = 'b';
				}
				else if(ban[0][i] == 'w'){
					result = 'w';
				}
			}
		}
		
		if(ban[0][0] == ban[1][1] && ban[1][1] == ban[2][2]){	//ツづ按づ按づ淞板サツ津ィ
			if(ban[0][0] == 'b'){
				result = 'b';
			}
			else if(ban[0][0] == 'w'){
				result = 'w';
			}
		}
		if(ban[0][2] == ban[1][1] && ban[1][1] == ban[2][0]){	//ツづ按づ按づ淞板サツ津ィ
			if(ban[0][2] == 'b'){
				result = 'b';
			}
			else if(ban[0][2] == 'w'){
				result = 'w';
			}
		}
		
		if(result == 'N'){
			cout << "NA" << endl;
		}
		else{
			cout << result << endl;
		}
	}
	FIN:;
	getchar();
	return 0;
}