#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int x[][3]={0,1,2,0,1,2,0,1,2,0,0,0,1,1,1,2,2,2,0,1,2,0,1,2};
int y[][3]={0,0,0,1,1,1,2,2,2,0,1,2,0,1,2,0,1,2,0,1,2,2,1,0};

int main() {
	char ban[3][3];
	while(cin>>ban[0][0],ban[0][0]!='0'){
		cin>>ban[0][1]>>ban[0][2]>>ban[1][0]>>ban[1][1]>>ban[1][2]>>ban[2][0]>>ban[2][1]>>ban[2][2];
		int i;
		bool win=false;
		for(i=0;i<8;i++){
			if(ban[y[i][0]][x[i][0]]=='b'&&ban[y[i][1]][x[i][1]]=='b'&&ban[y[i][2]][x[i][2]]=='b'){cout<<"b"<<endl;win=true;}
			if(ban[y[i][0]][x[i][0]]=='w'&&ban[y[i][1]][x[i][1]]=='w'&&ban[y[i][2]][x[i][2]]=='w'){cout<<"w"<<endl;win=true;}
		}
		if(win==false)cout<<"NA"<<endl;
	}
	return 0;
}