#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

string s[3];
int main()
{
    while(cin >> s[0])
    {
        if(s[0] == "0" ) break;
         cin >> s[1] >> s[2];
         bool b = false, w = false;
         REP(3)
         {
             if(s[i][0] == 'b' && s[i][1] == 'b' && s[i][2] == 'b') b = true; 
             if(s[i][0] == 'w' && s[i][1] == 'w' && s[i][2] == 'w') w = true; 
             if(s[0][i] == 'b' && s[1][i] == 'b' && s[2][i] == 'b') b = true; 
             if(s[0][i] == 'w' && s[1][i] == 'w' && s[2][i] == 'w') w = true; 

         }
         if(s[0][0] == 'b' && s[1][1] == 'b' && s[2][2] == 'b' ) b = true;
         if(s[0][0] == 'w' && s[1][1] == 'w' && s[2][2] == 'w' ) w = true;
         if(s[0][2] == 'b' && s[1][1] == 'b' && s[2][0] == 'b' ) b = true;
         if(s[0][2] == 'w' && s[1][1] == 'w' && s[2][0] == 'w' ) w = true;

         if(w){ cout << "w" << endl; continue;}
         if(b){ cout << "b" << endl; continue;}
         cout << "NA" << endl; 
    }
    return 0;
}