#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(void){
	string str[3];
	while(cin >> str[0]){
		if(str[0] == "0") break;
		int r=-1;
		cin >> str[1] >> str[2];
		for(int i=0;i<3;i++){
			if(str[i][0] == str[i][1] && str[i][1] == str[i][2]){
				if(str[i][0] != '+'){
					str[i][0] == 'b'?r=0:r=1;
					break;
				}
			}
			if(str[0][i] == str[1][i] && str[1][i] == str[2][i]){
				if(str[0][i] != '+'){
					str[0][i] == 'b'?r=0:r=1;
					break;
				}
			}
		}
		if((str[0][0] == str[1][1] && str[1][1] == str[2][2]) ||
		(str[2][0] == str[1][1] && str[1][1] == str[0][2])){
			if(str[1][1] != '+'){
				str[1][1] == 'b'?r=0:r=1;
			}
		}
		if(r == -1){
			cout << "NA" << endl;
		}else{
			r==0?cout<<"b"<<endl:cout<<"w"<<endl;
		}
	}
}