#include <iostream>
#include <string>
using namespace std;

int main() {
  string line;
  int a[3][3];
  int winner;
  cin >> line;
  while (1) {
    if (line == "0") {
      break;
    }
    for (int i=0; i<3; i++) {
      for (int j=0; j<3; j++) {
        char c = line[j];
        if (c == 'b') {
          a[i][j] = 1;
        } else if (c == 'w') {
          a[i][j] = -1;
        } else {
          a[i][j] = 0;
        }
      }
      cin >> line;
    }
    winner= 0;
    for (int i=0; i<3; i++) {
      if (a[i][0] && a[i][0] == a[i][1] && a[i][1] == a[i][2]) {
        winner = a[i][0];
      }
    }
    for (int j=0; j<3; j++) {
      if (a[0][j] && a[0][j] == a[1][j] && a[1][j] == a[2][j]) {
        winner = a[0][j];
      }
    }
    if (a[0][0] && a[0][0] == a[1][1] && a[1][1] == a[2][2]) {
      winner = a[0][0];
    }
    if (a[0][2] && a[0][2] == a[1][1] && a[1][1] == a[2][0]) {
      winner = a[0][2];
    }
    if (winner == 1) {
      cout << "b" << endl;
    } else if (winner == -1) {
      cout << "w" << endl;
    } else {
      cout << "NA" << endl;
    }
  }
  return 0;
}