#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

char b[3][3];

bool check(char c) {
	for (int i = 0; i < 3; i++) {
		if (b[i][0] == c && b[i][0] == b[i][1] && b[i][0] == b[i][2]) return true;
		if (b[0][i] == c && b[0][i] == b[1][i] && b[0][i] == b[2][i]) return true;

	}
	if (b[0][0] == c && b[0][0] == b[1][1] && b[0][0] == b[2][2]) return true;
	if (b[0][2] == c && b[0][2] == b[1][1] && b[0][2] == b[2][0]) return true;
	return false;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	while (true) {
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				cin >> b[i][j];
				if (b[i][j] == '0') return 0;
			}
		}

		if (check('b')) {
			cout << 'b' << endl;
		}
		else if (check('w')) {
			cout << 'w' << endl;
		}
		else {
			cout << "NA" << endl;
		}
	}
}