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

int main() {
	while(1) {
		vector<string> v;
		for(int i = 0; i < 3; i++) {
			string str;
			cin >> str;
			if(str == "0")
				goto EXIT;
			v.push_back(str);
		}

		for(int i = 0; i < 2; i++) {
			bool tate, yoko;
			bool naname0, naname1;
			char c;
			naname0 = naname1 = false;
			c = i ? 'b': 'w';
			for(int j = 0; j < 3; j++) {
				tate = yoko = true;
				for(int k = 0; k < 3; k++) {
					tate &= v[k][j] == c;
					yoko &= v[j][k] == c;
				}
				naname0 &= v[j][2-j] == c;
				naname1 &= v[j][j] == c;
				if(tate || yoko) {
					cout << c << endl;
					goto NEXT;
				}
			}
			if(naname0 || naname1) {
				cout << c << endl;
				goto NEXT;
			}
		}
		cout << "NA" << endl;
NEXT:;
	}
EXIT:;
}