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

int main(){
  char grid[3][3];
  while(cin >> grid[0][0]){
    if(grid[0][0] == '0')break;
    for(int i = 0 ; i < 3 ; i++ ){
      for(int j = 0 ; j < 3 ; j++ ){
	if(i == 0 && j == 0)continue;
	cin >> grid[j][i];
      }
    }
    char c[2] = {'b','w'},ans = 'S';
    for(int k = 0 ; k < 2 ; k++ ){

      for(int i = 0 ; i < 3 ; i++ ){
	if(grid[i][0] == c[k] &&
	   grid[i][1] == c[k] &&
	   grid[i][2] == c[k] )ans = c[k]; 

	if(grid[0][i] == c[k] &&
	   grid[1][i] == c[k] &&
	   grid[2][i] == c[k] )ans = c[k]; 
      }
      if(ans != 'S')break;
      if(grid[0][0] == c[k] && 
	 grid[1][1] == c[k] && 
	 grid[2][2] == c[k]  )ans = c[k];

      if(grid[0][2] == c[k] && 
	 grid[1][1] == c[k] && 
	 grid[2][0] == c[k]  )ans = c[k];
      if(ans != 'S')break;
    }
    if(ans == 'S')cout << "NA" << endl;
    else cout << ans << endl;
  }
  return 0;
}