#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	string s[3];
	for (; cin >> s[0]&&s[0] != "0";) {
		cin >> s[1] >> s[2];
		bool b, w;
		b = w = false;
		rep(i, 0, 3) {
			if (s[i][0] == s[i][1] && s[i][1] == s[i][2]) {
				if (s[i][0] == 'b')b = true;
				if (s[i][0] == 'w')w = true;
			}
		}
		rep(j, 0, 3) {
			if (s[0][j] == s[1][j] && s[1][j] == s[2][j]) {
				if (s[0][j] == 'b')b = true;
				if (s[0][j] == 'w')w = true;
			}
		}

		if (s[0][0] == s[1][1] && s[1][1] == s[2][2]) {
			if (s[0][0] == 'b')b = true;
			if (s[0][0] == 'w')w = true;
		}

		if (s[0][2] == s[1][1] && s[1][1] == s[2][0]) {
			if (s[0][2] == 'b')b = true;
			if (s[0][2] == 'w')w = true;
		}
		if (b)cout << "b" << endl;
		else if (w)cout << "w" << endl;
		else cout << "NA" << endl;
	}
	return 0;
}