#include <iostream>
using namespace std;

int main(){
    char s[3][3];
    
    while(true){
        cin >> s[0][0];
        if(s[0][0]=='0') break;
        for(int i = 0 ; i < 3 ; i++){
            for(int j = 0 ; j < 3 ; j++){
                if(!i&&!j) continue;
                else cin >> s[i][j];
            }
        }
        
        int j = 0;
        bool flg = false;
        for(int i = 0 ; i < 3 ; i++){
            if(s[i][j]=='b'){
                if(s[i][j]==s[i][j+1]&&s[i][j+1]==s[i][j+2]){
                    cout << 'b' << endl;
                    flg = true;
                    break;
                }
            }
            else if(s[i][j]=='w'){
                if(s[i][j]==s[i][j+1]&&s[i][j+1]==s[i][j+2]){
                    cout << 'w' << endl;
                    flg = true;
                    break;
                }
            }
        }
        if(flg) continue;
        
        int i = 0;
        for(int j = 0 ; j < 3 ; j++){
            if(s[i][j]=='b'){
                if(s[i][j]==s[i+1][j]&&s[i+1][j]==s[i+2][j]){
                    cout << 'b' << endl;
                    flg = true;
                    break;
                }
            }
            else if(s[i][j]=='w'){
                if(s[i][j]==s[i+1][j]&&s[i+1][j]==s[i+2][j]){
                    cout << 'w' << endl;
                    flg = true;
                    break;
                }
            }
        }
        if(flg) continue;
        
        if(s[1][1]=='b'){
            if((s[0][0]==s[1][1]&&s[1][1]==s[2][2])||
               (s[0][2]==s[1][1]&&s[1][1]==s[2][0])){
                cout << 'b' << endl;
                flg = true;
            }
        }
        else if(s[1][1]=='w'){
            if((s[0][0]==s[1][1]&&s[1][1]==s[2][2])||
               (s[0][2]==s[1][1]&&s[1][1]==s[2][0])){
                cout << 'w' << endl;
                flg = true;
            }
        }
        
        if(flg) continue;
        
        cout << "NA" << endl;
    }

    return 0;
}