#include <stdio.h>
#include<math.h>
#include <algorithm>
using namespace std;

int main(){
	char table[3][4];
	bool FLG;

	while(true){
		scanf("%s",table[0]);
		if(table[0][0] == '0')break;

		scanf("%s",table[1]);
		scanf("%s",table[2]);

		FLG = false;

		//?¨???¨????????????
		for(int i=0; i < 3; i++){
			if((table[i][0] == 'b' || table[i][0] == 'w') && table[i][0] == table[i][1] &&
					table[i][0] == table[i][2]){
				printf("%c\n",table[i][0]);
				FLG = true;
				break;
			}

			if((table[0][i] == 'b' || table[0][i] == 'w') && table[0][i] == table[1][i] &&
					table[0][i] == table[2][i]){
				printf("%c\n",table[0][i]);
				FLG = true;
				break;
			}
		}

		if(!FLG){
			if((table[0][0] == 'b' || table[0][0] == 'w') && table[0][0] == table[1][1] &&
					table[0][0] == table[2][2]){
				printf("%c\n",table[0][0]);
				FLG = true;
			}

			if(!FLG){
				if((table[0][2] == 'b' || table[0][2] == 'w') && table[0][2] == table[1][1] &&
						table[0][2] == table[2][0]){
					printf("%c\n",table[0][2]);
					FLG = true;
				}
			}
		}

		if(!FLG)printf("NA\n");

	}

    return 0;
}