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

int main() {
    for(string s1, s2, s3; cin >> s1, s1 != "0"; ) {
        cin >> s2 >> s3;
        string s = s1 + s2 + s3;
        string bit[] = {
            "111000000",
            "000111000",
            "000000111",
            "100100100",
            "010010010",
            "001001001",
            "100010001",
            "001010100"
        };

        int winner = -1;
        for(int i = 0; i < 8; i++) {
            string t;
            for(int j = 0; j < 9; j++) {
                if(bit[i][j] == '1') t.push_back(s[j]);
            }
            if(t[0] == 'w' && t[1] == 'w' && t[2] == 'w') winner = 0;
            if(t[0] == 'b' && t[1] == 'b' && t[2] == 'b') winner = 1;
        }
        if(winner == 0) {
            cout << 'w' << endl;
        }
        else if(winner == 1) {
            cout << 'b' << endl;
        }
        else {
            cout << "NA" << endl;
        }
    }
}