#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

string s[3];

string solve() {
  const char p[2] = { 'b', 'w' };
  string res = " ";
  rep (z,2) {
    const char c = p[z];
    bool ok = false;
    for (int i = 0; i < 3; ++i) {
      if (s[0][i] == c && s[1][i] == c && s[2][i] == c) ok = true;
      if (s[i][0] == c && s[i][1] == c && s[i][2] == c) ok = true;
    }
    if (s[0][0] == c && s[1][1] == c && s[2][2] == c) ok = true;
    if (s[0][2] == c && s[1][1] == c && s[2][0] == c) ok = true;
    if (ok) {
      res[0] = c; return res;
    }
  }
  return string("NA");
}

int main() {
  while (cin >> s[0]) {
    if (s[0][0] == '0') break;
    for (int i = 1; i < 3; ++i) cin >> s[i];
    cout << solve() << endl;
  }
  return 0;
}