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

int main() {
  const static char c[2] = {'b','w'};
  while(1) {
    vector<string> s(3);
    for(int i = 0; i < 3; ++i) {
      cin >> s[i];
      if(s[i] == "0") return 0;
    }
    for(int i = 0; i < 2; ++i) {
      if(s[0][0] == c[i] && s[1][1] == c[i] && s[2][2] == c[i] ||
         s[0][2] == c[i] && s[1][1] == c[i] && s[2][0] == c[i] ||
         s[0][0] == c[i] && s[1][0] == c[i] && s[2][0] == c[i] ||
         s[0][1] == c[i] && s[1][1] == c[i] && s[2][1] == c[i] ||
         s[0][2] == c[i] && s[1][2] == c[i] && s[2][2] == c[i] ||
         s[0][0] == c[i] && s[0][1] == c[i] && s[0][2] == c[i] ||
         s[1][0] == c[i] && s[1][1] == c[i] && s[1][2] == c[i] ||
         s[2][0] == c[i] && s[2][1] == c[i] && s[2][2] == c[i] ) {
        cout << c[i] << endl;
        break;
      }
      if(i+1 == 2) cout << "NA" << endl;
    }
  }
  return 0;
}