#include<iostream>
using namespace std;
int main()
{
  
  while(true)
    {
string str,str_x="";
 int count=0;
      for(int i=0;i<3;i++)
	{
      cin>>str;
      if(str=="0")return 0;
      str_x+=str;
	}
      for(int i=0;i<9;i+=3)
	{
	  if(str_x.at(i)=='b'&&str_x.at(i+1)=='b'&&str_x.at(i+2)=='b')
	    {
	      cout<<'b'<<endl;
 count++;
	    }
	  else if(str_x.at(i)=='w'&&str_x.at(i+1)=='w'&&str_x.at(i+2))
	    {
cout<<'w'<<endl;
 count++;
	    }
	}
  for(int i=0;i<3;i++)
    {
      if(str_x.at(i)=='b'&&str_x.at(i+3)=='b'&&str_x.at(i+6)=='b')
	{
	  cout<<'b'<<endl;
 count++;
	}
      else if(str_x.at(i)=='w'&&str_x.at(i+3)=='w'&&str_x.at(i+6)=='w')
	{
cout<<'w'<<endl;
 count++;
	}
    }
  if(str_x.at(0)=='b'&&str_x.at(4)=='b'&&str_x.at(8)=='b')
    {
cout<<'b'<<endl;
 count++;
    }
  else if(str_x.at(2)=='b'&&str_x.at(4)=='b'&&str_x.at(6)=='b')
    {
cout<<'b'<<endl;
 count++;
    }
  else if(str_x.at(0)=='w'&&str_x.at(4)=='w'&&str_x.at(8)=='w')
    {
cout<<'w'<<endl;
 count++;
    }
  else if(str_x.at(2)=='w'&&str_x.at(4)=='w'&&str_x.at(6)=='w')
    {
cout<<'w'<<endl;
 count++;
    }
  if(count==0)cout<<"NA"<<endl;
    }
}