#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
    vector<string> field(3);
    string s;
    while (cin >> s, s != "0") {
        field[0] = s;
        cin >> field[1];
        cin >> field[2];

        string res = "NA";
        for (int i = 0; i < 3; i++) {
            if (field[i] == "www") {
                res = "w";
                break;
            } else if (field[i] == "bbb") {
                res = "b";
                break;
            }
        }
    
        for (int i = 0; i < 3; i++) {
            if (field[0][i] == field[1][i] && field[1][i] == field[2][i]) {
                if (field[0][i] == 'w') {
                    res = "w";
                    break;
                } else if (field[0][i] == 'b') {
                    res = "b";
                    break;
                }
            }
        }
    
        if (field[0][0] == field[1][1] && field[1][1] == field[2][2]) {
            if (field[0][0] == 'w') res = "w";
            else if (field[0][0] == 'b') res = "b";
        }
    
        if (field[0][2] == field[1][1] && field[1][1] == field[2][0]) {
            if (field[0][2] == 'w') res = "w";
            else if(field[0][2] == 'b') res = "b";
        }
    
        cout << res << endl;
    }
    return 0;
}