#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

bool iswin(vs& field,char c)
{
	int a,b;
	rep(i,3){
		a=b=0;
		rep(j,3){
			a+=field[i][j]==c;
			b+=field[j][i]==c;
		}
		if(a==3 || b==3)
			return true;
	}
	a=b=0;
	rep(i,3){
		a+=field[i][i]==c;
		b+=field[i][2-i]==c;
	}
	return a==3 || b==3;
}

int main()
{
	for(vs field(3);cin>>field[0],field[0][0]!='0';){
		cin>>field[1]>>field[2];
		bool winb=iswin(field,'b');
		bool winw=iswin(field,'w');
		if(winb)
			puts("b");
		else if(winw)
			puts("w");
		else
			puts("NA");
	}
	
	return 0;
}