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

int main(){
    string s1,s2,s3,mas;
    bool judge;
    while(1){
        cin >> s1;
        if(s1 == "0") break;
        cin >> s2 >> s3;
        mas = s1 + s2 + s3;
        judge = false;
        for(int i=0;i<9;i+=3){
            if(mas.substr(i,3) == "bbb"){
                cout << "b" << endl;
                judge = true;
                break;
            }
            if(mas.substr(i,3) == "www"){
                cout << "w" << endl;
                judge = true;
                break;
            }
        }
        for(int i=0;i<3;i++){
            if(mas[i] == mas[i+3] && mas[i+3] == mas[i+6] && !judge && mas[i] != '+'){
                cout << mas[i] << endl;
                judge = true;
                break;
            }
        }
        if(mas[0] == mas[4] && mas[4] == mas[8] && !judge && mas[0] != '+') {
            cout << mas[0] << endl;
            judge = true;
        }
        else if(mas[2] == mas[4] && mas[4] == mas[6] && !judge && mas[2] != '+'){
            cout << mas[2] << endl;
            judge = true;
        }
        else if(!judge) cout << "NA" << endl;
    }
}