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

int main(void)
{
	string board[3];
	string set[2];
	string y_comp;
	string t_comp;
	string l_comp;
	string r_comp;
	char str[4];
	bool flag = false, n_flag = false;
	
	set[0] = "bbb";
	set[1] = "www";
	
	while (1){
		for (int i = 0; i < 3; i++){
			scanf("%s", str);
			if (str[0] == '0') {
				flag = true;
				break;
			}
			board[i] = str;					
		}
		if (flag) break;
		
		for (int i = 0; i < 3; i++){
			for (int j = 0; j < 3; j++){
				y_comp += board[i][j];
				t_comp += board[j][i];
				if (i + j == 2) l_comp += board[i][j];
			}
			if (y_comp == set[0] || t_comp == set[0]) {
				printf("b\n");
				n_flag = true;
			}
			else if (y_comp == set[1] || t_comp == set[1]) {
				printf("w\n");
				n_flag = true;
			}
			y_comp.clear();
			t_comp.clear();
			
			r_comp += board[i][i];
		}
		if (r_comp == set[0] || l_comp == set[0]) {
			printf("b\n");
			n_flag = true;
		}
		else if (r_comp == set[1] || l_comp == set[1]) {
			printf("w\n");
			n_flag = true;
		}
		r_comp.clear();
		l_comp.clear();
		if (!n_flag) puts("NA");
	}
	
	return (0);
}