#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

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

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

string s[3];

int main(){
	while (cin >> s[0]){
		bool f1 = 0, f2 = 0;
		if (s[0] == "0")break;
		cin >> s[1] >> s[2];
		REP(i, 3){
			if (s[i][0] == s[i][1] && s[i][1] == s[i][2]){
				if (s[i][0] == 'w')f1 = 1;
				if (s[i][0] == 'b')f2 = 1;
			}
			if (s[0][i] == s[1][i] && s[1][i] == s[2][i]){
				if (s[0][i] == 'w')f1 = 1;
				if (s[0][i] == 'b')f2 = 1;
			}
		}
		if (s[0][0] == s[1][1] && s[1][1] == s[2][2]){
			if (s[0][0] == 'w')f1 = 1;
			if (s[0][0] == 'b')f2 = 1;
		}
		if (s[0][2] == s[1][1] && s[1][1] == s[2][0]){
			if (s[0][2] == 'w')f1 = 1;
			if (s[0][2] == 'b')f2 = 1;
		}
		if (f1)cout << "w" << endl;
		else if (f2)cout << "b" << endl;
		else cout << "NA" << endl;
	}
}