#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

#define reps(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reps(i,0,n)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int main()
{
	for(;;){
		char str[3][8];
		rep(i, 3){
			scanf("%s", str[i]);
			if(str[i][0] == '0')
				return 0;
		}
		
		const int sy[] = {0, 1, 2, 0, 0, 0, 0, 0};
		const int sx[] = {0, 0, 0, 0, 1, 2, 0, 2};
		const int dy[] = {0, 0, 0, 1, 1, 1, 1, 1};
		const int dx[] = {1, 1, 1, 0, 0, 0, 1,-1};
		int winner = 0;
		rep(i, 8){
			int y = sy[i], x = sx[i];
			int b = 0, w = 0;
			rep(j, 3){
				b += str[y][x] == 'b';
				w += str[y][x] == 'w';
				y += dy[i];
				x += dx[i];
			}
			if(b == 3){
				winner = 1;
				break;
			}
			if(w == 3){
				winner = 2;
				break;
			}
		}
		
		if(winner == 0)
			puts("NA");
		else
			puts(winner == 1 ? "b" : "w");
	}
}