#include<iostream>
#include<string>
using namespace std;
bool b00l;
void check(char c) {
	if (c == 'b') { cout << "b\n"; b00l = true; }
	else if (c == 'w') { cout << "w\n"; b00l = true; }
	return;
}
int main() {
	string a, b, c;
	while (cin >> a) {
		if (a.size() == 1)return 0;
		cin >> b >> c;
		b00l = false;
		if (a[0] == a[1] && a[1] == a[2])check(a[0]);
		if (b[0] == b[1] && b[1] == b[2])check(b[0]);
		if (c[0] == c[1] && c[1] == c[2])check(c[0]);
		if (a[0] == b[0] && b[0] == c[0])check(a[0]);
		if (a[1] == b[1] && b[1] == c[1])check(a[1]);
		if (a[2] == b[2] && b[2] == c[2])check(a[2]);
		if (a[0] == b[1] && b[1] == c[2])check(a[0]);
		if (c[0] == b[1] && b[1] == a[2])check(a[2]);
		if (!b00l)cout << "NA\n";
	}
}