#include <iostream>
using namespace std;

char board[8][8] = {{'+'}};
string ans = "NA";

int main(){
        while (1){
	bool end = false;
	for (int i = 0; i < 3 && !end; i++){
	    for (int j = 0; j < 3 && !end; j++){
		cin >> board[i][j];
		if (board[0][0] == '0') end = true;
	    }
	}

	if (end) break;
	ans = "NA";
	char c = 'b';
	for (int x = 0; x < 3; x++){
	    for (int y = 0; y < 3; y++){
		if (board[x][y] == c && board[x+1][y] == c && board[x+2][y] == c) ans = c;
		if (board[x][y] == c && board[x+1][y+1] == c && board[x+2][y+2] == c) ans = c;
		if (board[x][y] == c && board[x][y+1] == c && board[x][y+2] == c) ans = c;
	    }
	}
	c = 'w';
	for (int x = 0; x < 3; x++){
	    for (int y = 0; y < 3; y++){
		if (board[x][y] == c && board[x+1][y] == c && board[x+2][y] == c) ans = c;
		if (board[x][y] == c && board[x+1][y+1] == c && board[x+2][y+2] == c) ans = c;
		if (board[x][y] == c && board[x][y+1] == c && board[x][y+2] == c) ans = c;
	    }
	}
	cout << ans << endl;
	}
}