#include<iostream>
using namespace std;

int main(){
	char b[3][3];
	int x,y;
	int check;
	int boolean = 1;

	while(boolean){
		x = 0;
		y = 0;
		check = 1;
		for(int i = 0; i < 3; i++){
			cin >> b[i];
			if(b[0][0] == '0'){
				 boolean = 0;
				 check = 0;
				 break;
			}
		}
		for(int i = 0; i <= 2; i++){
			if(b[i][0] == 'b' && b[i][1] == 'b' && b[i][2] == 'b'){
		cout << 'b' << endl;
		check = 0; break;
			}
			if(b[0][i] == 'b' && b[1][i] == 'b' && b[2][i] == 'b'){
		cout << 'b' << endl;
		check = 0; break;
			}
			if(b[0][0] == 'b' && b[1][1] == 'b' && b[2][2] == 'b'){
		cout << 'b' << endl;
		check = 0; break;
			}
			if(b[0][2] == 'b' && b[1][1] == 'b' && b[2][0] == 'b'){
		cout << 'b' << endl;
		check = 0; break;
			}

		}
		for(int i = 0; i <= 2; i++){
			if(b[i][0] == 'w' && b[i][1] == 'w' && b[i][2] == 'w'){
		cout << 'w' << endl;
		check = 0; break;
			}
			if(b[0][i] == 'w' && b[1][i] == 'w' && b[2][i] == 'w'){
		cout << 'w' << endl;
		check = 0; break;
			}
			if(b[0][0] == 'w' && b[1][1] == 'w' && b[2][2] == 'w'){
		cout << 'w' << endl;
		check = 0; break;
			}
			if(b[0][2] == 'b' && b[1][1] == 'b' && b[2][0] == 'b'){
		cout << 'w' << endl;
		check = 0; break;
			}

		}
		if(check) cout << "NA" << endl;
	}
}