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

int main()
{
	string s[3];
	
	while (cin >> s[0], s[0] != "0"){
		cin >> s[1] >> s[2];
		
		
		for (int i = 0; i < 3; i++){
			if (s[i] == "www"){
				cout << "w" << endl;
				break;
			}
			else if (s[i] == "bbb"){
				cout << "b" << endl;
				break;
			}
			else if (s[0][i] == 'w' && s[1][i] == 'w' && s[2][i] == 'w'){
				cout << "w" << endl;
				break;
			}
			else if (s[0][i] == 'b' && s[1][i] == 'b' && s[2][i] == 'b'){
				cout << "b" << endl;
				break;
			}
			else if (s[0][0] == 'w' && s[1][1] == 'w' && s[2][2] == 'w'){
				cout << "w" << endl;
				break;
			}
			else if (s[0][0] == 'b' && s[1][1] == 'b' && s[2][2] == 'b'){
				cout << "b" << endl;
				break;
			}
			else {
				cout << "NA" << endl;
				break;
			}
		}
		
	}
	
	return (0);
}