#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int a[3][3];

void bw(string str,int n){
  for(int i=0;i<3;i++){
    if(str[i] == 'b') a[n][i] = 1;
    else if(str[i] == 'w') a[n][i] = 2;
    else if(str[i] == '+') a[n][i] = 0;
  }
}

int main(){
  int i,j,tate1,tate2,yoko1,yoko2,na1,na2,nan1,nan2,ans;
  string str;
  while(1){
    cin >> str;
    if(str == "0") break;
    bw(str,0);

    for(i=1;i<3;i++){
      cin >> str;
      bw(str,i);
    }

    ans = 0;
    for(i=0;i<3;i++){
     nan1 = nan2 = na1 = na2 = tate1 = yoko1 = tate2 = yoko2 = 0;
      for(j=0;j<3;j++){
	if(a[i][j] == 1) yoko1++;
	else if(a[i][j] == 2) yoko2++;
	if(a[j][i] == 1) tate1++;
	else if(a[j][i] == 2) tate2++;
	if(a[j][j] == 1) na1++;
	else if(a[j][j] == 2) na2++;
	if(a[2-j][j] == 1) nan1++;
	else if(a[2-j][j] == 2) nan2++;
      }
      if(yoko1 == 3 || tate1 == 3 || na1 == 3 || nan1 == 3){
	ans = 1;
	break;
      }
      else if(yoko2 == 3 || tate2 == 3 || na2 == 3 || nan2 == 3){
	ans = 2;
	break;
      }
    }

    if(ans == 2) cout << "w" << endl;
    else if(ans == 1) cout << "b" << endl;
    else cout << "NA" << endl;

  }
  return 0;
}