// #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef map<int, int> MAPII;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;

#define MP make_pair
#define fastIO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}

// ------------------- include, typedef, define END. -------------------

string solve(vector<vector<char> > in){
	char mozi[3] = { 'b', 'w', '+' };
	string ret;
	FOR(i, 0, 3){
		FOR(j, 0, 3){
			bool flg = true;
			// 横に見る
			FOR(k, 0, 3){
				if (in[j][k] != mozi[i]){
					flg = false;
				}
			}
			if (flg)
				if (mozi[i] != '+')
					return ret=mozi[i];
			
			// 縦に見る
			flg = true;
			FOR(k, 0, 3){
				if (in[k][j] != mozi[i]){
					flg = false;
				}
			}
			if (flg)
				if (mozi[i] != '+')
					return ret = mozi[i];
		}
	}
	// 斜めに見る
	FOR(i, 0, 3){
		bool flg = true;
		for (int j = 0, k = 0; j < 3, k < 3; j++, k++){
			if (in[j][k] != mozi[i])
				flg = false;
		}
		if (flg)
			if (mozi[i] != '+')
				return ret = mozi[i];

		flg = true;
		for (int j = 2, k = 0; j >=0, k <3; j--, k++){
			if (in[j][k] != mozi[i])
				flg = false;
		}
		if (flg)
			if (mozi[i] != '+')
				return ret = mozi[i];
	}
	return "NA";
}

int main(){
	int n = 0;
	string firstLine;

	while (getline(cin, firstLine), firstLine != "0"){
		vector<vector<char> > in(3,vector<char>(3));
		// 最初の行
		istringstream stream(firstLine);
		char temp;
		int count = 0;
		while (stream >> temp,!stream.eof()){
			in[0][count] = temp;
			count++;
		}
		// 2行目・3行目
		FOR(i, 1, 3){
			FOR(j, 0, 3){
				cin >> temp;
				in[i][j] = temp;
			}
		}
		cout << solve(in) << endl;
		//cin >> temp; 
		cin.ignore();
	}

	return 0;
}