#include<iostream>
using namespace std;

int main(){
  string b[3];
  string ans;

  for(;;){
    cin >> b[0];
    if(b[0] == "0")break;

    cin >> b[1] >> b[2];

    ans = "NA";
    for(int i=0;i<3;i++){
      if(b[0][i] == b[1][i] && b[1][i] == b[2][i]){
	if(b[0][i] == 'b')ans = "b";
	if(b[0][i] == 'w')ans = "w";
      }
      if(b[i][0] == b[i][1] && b[i][1] == b[i][2]){
	if(b[i][0] == 'b')ans = "b";
	if(b[i][0] == 'w')ans = "w";
      }
    }
    if(b[0][0] == b[1][1] && b[1][1] == b[2][2]){
      if(b[1][1] == 'b')ans = "b";
      if(b[1][1] == 'w')ans = "w";
    }
    if(b[0][2] == b[1][1] && b[1][1] == b[2][0]){
      if(b[1][1] == 'b')ans = "b";
      if(b[1][1] == 'w')ans = "w";
    }

    cout << ans << endl;
  }
}