#include <iostream>

using namespace std;

bool judge(char a[3][3], char c)
{
	if(a[0][0] == c && a[0][1] == c && a[0][2] == c ||
	   a[1][0] == c && a[1][1] == c && a[1][2] == c ||
	   a[2][0] == c && a[2][1] == c && a[2][2] == c ||
	   a[0][0] == c && a[1][0] == c && a[2][0] == c ||
	   a[0][1] == c && a[1][1] == c && a[2][1] == c ||
	   a[0][2] == c && a[1][2] == c && a[2][2] == c ||
	   a[0][0] == c && a[1][1] == c && a[2][2] == c ||
	   a[0][2] == c && a[1][1] == c && a[2][0] == c)
	{
		return(true);
	}
	else
	{
		return(false);
	}
}

void solve()
{
	char a[3][3];
	while(cin >> a[0][0], a[0][0] != '0')
	{
		cin >> a[0][1] >> a[0][2];
		for(int i = 1; i < 3; ++i)
		{
			for(int j = 0; j < 3; ++j)
			{
				cin >> a[i][j];
			}
		}
		if(judge(a, 'b'))
		{
			cout << "b" << endl;
		}
		else if(judge(a, 'w'))
		{
			cout << "w" << endl;
		}
		else
		{
			cout << "NA" << endl;
		}
	}
}

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