#include <iostream>
using namespace std;
int main(void)
{
  char table[3][3];

  while(1) {
    cin >> table[0];
    if(table[0][0] == '0') break;
    for(int i = 1 ; i < 3 ; i++) {
      cin >> table[i];
    }
    
    if(table[0][0] == 'b' && table[0][1] == 'b' && table[0][2] == 'b') cout << 'b' << endl;
    else if(table[1][0] == 'b' && table[1][1] == 'b' && table[1][2] == 'b') cout << 'b' << endl;
    else if(table[2][0] == 'b' && table[2][1] == 'b' && table[2][2] == 'b') cout << 'b' << endl;
    else if(table[0][0] == 'b' && table[1][1] == 'b' && table[2][2] == 'b') cout << 'b' << endl;
    else if(table[2][0] == 'b' && table[1][1] == 'b' && table[0][2] == 'b') cout << 'b' << endl;
    else if(table[0][0] == 'b' && table[1][0] == 'b' && table[2][0] == 'b') cout << 'b' << endl;
    else if(table[0][1] == 'b' && table[1][1] == 'b' && table[2][1] == 'b') cout << 'b' << endl;
    else if(table[0][2] == 'b' && table[1][2] == 'b' && table[2][2] == 'b') cout << 'b' << endl;

    else if(table[0][0] == 'w' && table[0][1] == 'w' && table[0][2] == 'w') cout << 'w' << endl;
    else if(table[1][0] == 'w' && table[1][1] == 'w' && table[1][2] == 'w') cout << 'w' << endl;
    else if(table[2][0] == 'w' && table[2][1] == 'w' && table[2][2] == 'w') cout << 'w' << endl;
    else if(table[0][0] == 'w' && table[1][1] == 'w' && table[2][2] == 'w') cout << 'w' << endl;
    else if(table[2][0] == 'w' && table[1][1] == 'w' && table[0][2] == 'w') cout << 'w' << endl;
    else if(table[0][0] == 'w' && table[1][0] == 'w' && table[2][0] == 'w') cout << 'w' << endl;
    else if(table[0][0] == 'w' && table[1][1] == 'w' && table[2][1] == 'w') cout << 'w' << endl;
    else if(table[0][2] == 'w' && table[1][2] == 'w' && table[2][2] == 'w') cout << 'w' << endl;

    else cout << "NA" << endl;
  } 
  return 0;
}