#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int board[3][3];

int main(){
	char c;
 	while(cin >> c){
		
		if(c == '0'){
			return 0;
		}
		
		//テ、ツスツソテァツ板ィテ」ツδ愿」ツδシテ」ツδ嘉」ツつ?テ」ツ?ァテ・ツ按敕ヲツ慊淌・ツ個?
		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				board[i][j] = 0;
			}
		}
		
		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				if(c == 'b'){
					board[i][j] = 1;
				}else if(c == 'w'){
					board[i][j] = -1;
				}
				if((i == 2) && (j == 2)){
				}else{
					cin >> c;
				}
			}
		}
		
		int n=0;
		for(int i=0;i<3;i++){
			if((board[i][0] == board[i][1]) && (board[i][0] == board[i][2])){
				if(board[i][0] == 1){
					cout << "b" << endl;
				}else{
					cout << "w" << endl;
				}
				n = 1;
			}
		}
		for(int j=0;j<3;j++){
			if((board[0][j] == board[1][j]) && (board[0][j] == board[2][j]) && (n != 1)){
				if(board[0][j] == 1){
					cout << "b" << endl;
				}else{
					cout << "w" << endl;
				}
				n = 1;
			}
		}
		if((board[1][1] == board[0][0]) && (board[1][1] == board[2][2]) && (n != 1)){
			if(board[1][1] == 1){
				cout << "b" << endl;
			}else{
				cout << "w" << endl;
			}
			n = 1;
		}
		if((board[0][2] == board[1][1]) && (board[0][2] == board[2][0]) && (n != 1)){
			if(board[0][2] == 1){
				cout << "b" << endl;
			}else{
				cout << "w" << endl;
			}
			n = 1;
		}
		if(n == 0){
			cout << "NA" << endl;
		}
	}
		
		return 0;
}