#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cctype>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>

using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 999999
#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<k;i++)
typedef long long ll;
typedef unsigned long long ull;
int main(){
    char stage[4][4]={{0}};
    while(scanf("%s",stage[0]), stage[0][0] != '0'){
        reps(i,1,3)scanf("%s",stage[i]);
        /*Check*/
        bool f = false;
        rep(i,3){
            if(stage[i][0] == 'b' && stage[i][1] == 'b' && stage[i][2] == 'b'){
                puts("b");
                f = true;
            }
            if(stage[i][0] == 'w' && stage[i][1] == 'w' && stage[i][2] == 'w'){
                puts("w");
                f = true;
            }
            if(stage[0][i] == 'b' && stage[1][i] == 'b' && stage[2][i] =='b'){
                puts("b");
                f = true;
            }
            if(stage[0][i] == 'w' && stage[1][i] =='w' && stage[2][i] == 'w'){
                puts("w");
                f = true;
            }
        }
        if(stage[0][0] == stage[1][1] && stage[1][1] ==stage[2][2] &&stage[0][0] == 'b'){
            puts("b");
            f = true;
        }
        if(stage[0][0] == stage[1][1] && stage[1][1] ==stage[2][2] &&stage[0][0] == 'w'){
            puts("w");
            f = true;
        }
        if(stage[0][2] == stage[1][1] && stage[1][1] ==stage[1][0] &&stage[0][2] == 'b'){
            puts("b");
            f = true;
        }
        if(stage[0][2] == stage[1][1] && stage[1][1] ==stage[1][0] &&stage[0][2] == 'w'){
            puts("w");
            f = true;
        }
        if(!f)puts("NA");
    }
    return 0;
}