#include <stdio.h>

#define NON 0
#define BLK 1
#define WHT -1
#define SIZE 3

int isGameSet(int iField[SIZE][SIZE]);

int main(void){
    int board[SIZE][SIZE];
    char buf[4];
    
    while(1){
        for (int y=0; y<SIZE; y++){
            scanf("%s", buf);
            if (buf[0]=='0') return 0;
            for (int x=0; x<SIZE; x++){
                if (buf[x]=='b') board[x][y]=BLK;
                else if (buf[x]=='w') board[x][y]=WHT;
                else if (buf[x]=='+') board[x][y]=NON;
            }
        }
        switch (isGameSet(board)){
        case BLK:
            puts("b"); break;
        case WHT:
            puts("w"); break;
        case NON:
            puts("NA"); break;
        }
    }
    return 0;
}

int isGameSet(int iField[SIZE][SIZE]){
	int i, j;
	int tmp;

	// vertical
	for (i = 0; i < SIZE; i++){
		for (j = 0, tmp = 0; j < SIZE; j++){
			tmp += iField[i][j];
		}
		if (tmp == SIZE*WHT) return WHT;
		if (tmp == SIZE*BLK) return BLK;
	}
	// horizontal
	for (i = 0; i < SIZE; i++){
		for (j = 0, tmp = 0; j < SIZE; j++){
			tmp += iField[j][i];
		}
		if (tmp == SIZE*WHT) return WHT;
		if (tmp == SIZE*BLK) return BLK;
	}
	// diagonal
	for (i = 0, tmp = 0; i < SIZE; i++){
		tmp += iField[i][i];
	}
	if (tmp == SIZE*WHT) return WHT;
	if (tmp == SIZE*BLK) return BLK;
	for (i = 0, tmp = 0; i < SIZE; i++){
		tmp += iField[i][SIZE - 1 - i];
	}
	if (tmp == SIZE*WHT) return WHT;
	if (tmp == SIZE*BLK) return BLK;
	return NON;
}