#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>
using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;

#define rep(i,n) for(int i=0; i<n; i++)
#define repa(i,s,e) for(int i=s; i<=e; i++)
#define repd(i,s,e) for(int i=s; i>=e; i--)

char B[3][3];

bool isbw(char c) {
	return c == 'b' || c == 'w';
}

char check() {
	bool ok = false;
	rep(i,3) {
		if(!isbw(B[i][0])) continue;
		ok = true;
		rep(j,3) {
			if(B[i][0] != B[i][j]) {
				ok = false;
				break;
			}
		}
		if(ok) return B[i][0];
	}

	rep(i,3) {
		if(!isbw(B[0][i])) continue;
		ok = true;
		rep(j,3) {
			if(B[0][i] != B[j][i]) {
				ok = false;
				break;
			}
		}
		if(ok) return B[0][i];
	}

	ok = true;
	rep(i,3) {
		if(B[1][1] != B[i][i]) {
			ok = false;
			break;
		}
	}
	if(ok && isbw(B[1][1])) return B[1][1];

	ok = true;
	rep(i,3) {
		if(B[1][1] != B[i][2-i]) {
			ok = false;
			break;
		}
	}
	if(ok && isbw(B[1][1])) return B[1][1];
	
	return '+';
}

int main() {
	while( 1 ) {
		rep(i,3) {
			rep(j,3) {
				cin >> B[i][j];
				if(i==0 && j==0 && B[i][j] == '0') return 0;
			}
		}

		char a = check();
		if(a != 'b' && a != 'w') printf("NA\n");
		else printf("%c\n", a);
	}
}