#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"

vector<string>sts(3);
bool check(char c) {
	for (int y = 0; y < 3; ++y) {
		bool ok = true;
		for (int x = 0; x < 3; ++x) {
			if (sts[y][x] != c)ok = false;
		}
		if (ok)return true;
	}
	for (int x = 0; x < 3; ++x) {
		bool ok = true;
		for (int y = 0; y < 3; ++y) {
			if (sts[y][x] != c)ok = false;
		}
		if (ok)return true;
	}
	{
		bool ok = true;
		for (int i = 0; i < 3; ++i) {
			if (sts[i][i] != c)ok = false;
		}
		if (ok)return true;
	}
	{
		bool ok = true;
		for (int i = 0; i < 3; ++i) {
			if (sts[i][2-i] != c)ok = false;
		}
		if (ok)return true;
	}
	return false;
	
}

int main() {
	while (cin>>sts[0]) {
		if (sts[0] == "0")break;
		for (int i = 1; i < 3; ++i) {
			cin >> sts[i];
		}
		if (check('b'))cout << "b" << endl;
		else if (check('w'))cout << "w" << endl;
		else cout << "NA" << endl;
		
	}
	return 0;
}