#include <iostream>

using namespace std;

void solve()
{

	char field[3][3];
	while(cin >> field[0][0])
	{
		if(field[0][0] == '0')
		{
			break;
		}
		cin >> field[0][1] >> field[0][2];
		for(int i = 1; i < 3; ++i)
		{
			for(int j = 0; j < 3; ++j)
			{
				cin >> field[i][j];
			}
		}
		bool flag = false;
		for(int i = 0; i < 3; ++i)
		{
			if(field[i][0] == 'b' && field[i][1] == 'b' && field[i][2] == 'b' ||
			   field[0][i] == 'b' && field[1][i] == 'b' && field[2][i] == 'b')
			{
				cout << 'b' << endl;
				flag = true;
				break;
			}
			else if(field[i][0] == 'w' && field[i][1] == 'w' && field[i][2] == 'w' ||
					field[0][i] == 'w' && field[1][i] == 'w' && field[2][i] == 'w')
			{
				cout << 'w' << endl;
				flag = true;
				break;
			}
		}
		if(!flag)
		{
			if(field[0][0] == 'b' && field[1][1] == 'b' && field[2][2] == 'b' ||
			   field[0][2] == 'b' && field[1][1] == 'b' && field[2][0] == 'b')
			{
				cout << 'b' << endl;
				flag = true;
			}
			else if(field[0][0] == 'w' && field[1][1] == 'w' && field[2][2] == 'w' ||
				    field[0][2] == 'w' && field[1][1] == 'w' && field[2][0] == 'w')
			{
				cout << 'w' << endl;
				flag = true;
			}
		}
		if(!flag)
		{
			cout << "NA" << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}