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

int v[] = {7,56,73,84,146,273,292,448};

int main() {
	char c;
	while (cin >> c, c != '0') {
		int b = c=='b';
		int w = c=='w';
		for (int i=1; i<9; ++i) {
			cin >> c;
			b = b*2+(c=='b');
			w = w*2+(c=='w');
		}
		string res = "NA";
		for (int i=0; i<8; ++i) {
			if ((b|v[i])==b) res = "b";
			if ((w|v[i])==w) res = "w";
		}
		cout << res << endl;
	}
}