#include <bits/stdc++.h>
using namespace std;

int main()
{
  string b[3];
  while (cin >> b[0], b[0] != "0"){
    int f = 0;
    cin >> b[1] >> b[2];
    for (int i = 0; i < 3; i++){
      if (b[i] == "bbb"){
        f = 1;
        break;
      }
      else if (b[i] == "www"){
        f = 2;
        break;
      }
      else {
        string str = "";
        str += b[0][i];
        str += b[1][i];
        str += b[2][i];
        if (str == "bbb"){
          f = 1;
          break;
        }
        if (str == "www"){
          f = 2;
          break;
        }
      }
    }
    if (f == 0){
      string str = "";
      str += b[0][0];
      str += b[1][1];
      str += b[2][2];
      if (str == "bbb") f = 1;
      else if (str == "www") f = 2;
      str = "";
      str += b[0][2];
      str += b[1][1];
      str += b[2][0];
      if (str == "bbb") f = 1;
      else if (str == "www") f = 2;
    }

    if (f == 0) cout << "NA\n";
    else if (f == 1) cout << "b\n";
    else if (f == 2) cout << "w\n";
  }
}