#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

int main() {
	while (true) {
		string t; cin >> t;
		if (t == "0")break;

		VS s(3); s[0] = t;
		rep(i, 2)cin >> s[i + 1];

		int ans = 0;

		//横
		rep(i, 3) {
			if (count(all(s[i]), 'b') == 3)ans = 1;
			else if (count(all(s[i]), 'w') == 3)ans = 2;
		}
		//縦
		rep(i, 3) {
			if (s[0][i] == s[1][i] && s[1][i] == s[2][i]) {
				if (s[0][i] == 'b')ans = 1;
				else if (s[0][i] == 'w')ans = 2;
			}
		}
		//斜め
		if (s[0][0] == s[1][1] && s[1][1] == s[2][2]) {
			if (s[0][0] == 'b')ans = 1;
			else if (s[0][0] == 'w')ans = 2;
		}
		if (s[0][2] == s[1][1] && s[1][1] == s[2][0]) {
			if (s[0][2] == 'b')ans = 1;
			else if (s[0][2] == 'w')ans = 2;
		}

		puts(ans ? ans == 1 ? "b" : "w" : "NA");
	}
}
