#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main( void )
{
	while ( 1 )
	{
		vector <string> M(3);
		bool not_found;

		cin >> M[0];
		if ( M[0] == "0" ) break;
		cin >> M[1] >> M[2];

		not_found = true;
		for ( int i = 0; not_found && i < 3; i++ )
		{
			if ( M[i][0] == M[i][1] && M[i][1] == M[i][2] )
			{
				if ( M[i][0] == 'b' || M[i][0] == 'w' )
				{
					cout << M[i][0] << endl;
					not_found = false;
				}
			}
			if ( M[0][i] == M[1][i] && M[1][i] == M[2][i] )
			{
				if ( M[0][i] == 'b' || M[0][i] == 'w' )
				{
					cout << M[0][i] << endl;
					not_found = false;
				}
			}
		}
		if ( not_found && M[0][0] == M[1][1] && M[1][1] == M[2][2] )
		{
			if ( M[0][0] == 'b' || M[0][0] == 'w' )
			{
				cout << M[0][0] << endl;
				not_found = false;
			}
		}
		if ( not_found && M[0][2] == M[1][1] && M[1][1] == M[2][0] )
		{
			if ( M[0][2] == 'b' || M[0][2] == 'w' )
			{
				cout << M[0][2] << endl;
				not_found = false;
			}
		}

		if ( not_found ) cout << "NA" << endl;
	}
	return 0;
}