#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pll> pip;
const ll INF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS  = 1e-9;

int main() {
	while (true) {
		string maps[3];
		cin >> maps[0];
		if (maps[0][0] == '0') break;
		cin >> maps[1] >> maps[2];
		
		int ans = -1;
		REP(i, 3) {
			if (maps[i][0] == maps[i][1] && maps[i][1] == maps[i][2] && maps[i][0] != '+') ans = maps[i][0] == 'b';
			if (maps[0][i] == maps[1][i] && maps[1][i] == maps[2][i] && maps[0][i] != '+') ans = maps[0][i] == 'b';
		}
		if (maps[0][0] == maps[1][1] && maps[1][1] == maps[2][2] && maps[1][1] != '+') ans = maps[1][1] == 'b';
		if (maps[2][0] == maps[1][1] && maps[1][1] == maps[0][2] && maps[1][1] != '+') ans = maps[1][1] == 'b';
		
		if (ans == -1) puts("NA");
		else if (ans == 1) puts("b");
		else puts("w");
	}
	return 0;
}