#include<iostream>
#include<string>

using namespace std;

char s[3][3];

int judgeB(){
  for(int i = 0; i < 3; i++){
    if(s[i][0] == 'b' && s[i][1] == 'b' && s[i][2] == 'b') return 1;
  }
  for(int i = 0; i < 3; i++){
    if(s[0][i] == 'b' && s[1][i] == 'b' && s[2][i] == 'b') return 1;
  }
  if(s[0][0] == 'b' && s[1][1] == 'b' && s[2][2] == 'b') return 1;
  if(s[0][2] == 'b' && s[1][1] == 'b' && s[2][0] == 'b') return 1;

  return 0;
}

int judgeW(){
  for(int i = 0; i < 3; i++){
    if(s[i][0] == 'w' && s[i][1] == 'w' && s[i][2] == 'w') return 1;
  }
  for(int i = 0; i < 3; i++){
    if(s[0][i] == 'w' && s[1][i] == 'w' && s[2][i] == 'w') return 1;
  }
  if(s[0][0] == 'w' && s[1][1] == 'w' && s[2][2] == 'w') return 1;
  if(s[0][2] == 'w' && s[1][1] == 'w' && s[2][0] == 'w') return 1;

  return 0;
}


int main(){
 
  while(1){

    for(int j = 0; j < 3; j++){
      for(int k = 0; k < 3; k++){
	cin >> s[j][k];
	if(s[j][k] == '0') return 0;
      }
    }

    int x = judgeB();
    int y = judgeW();

    if(x == 1) cout << "b" << endl;
    else if(y == 1) cout << "w" << endl;
    else cout << "NA" << endl;
  }
  
  return 0;
}