#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define INF 1<<30

char ba[3][3];

bool judge(char c) {
  REP(i,3) {
    int ct1 = 0, ct2 = 0;
    REP(j,3) {
      if (ba[i][j] == c) ct1++;
      if (ba[j][i] == c) ct2++;
    }
    if (ct1 == 3 || ct2 == 3) return true;
  }
  int ct1 = 0, ct2 = 0;
  REP(i,3) {
    if (ba[i][i] == c) ct1++;
    if (ba[2-i][i] == c) ct2++;
  }
  if (ct1 == 3 || ct2 == 3) return true;
  return false;
}

int main() {
  char a;
  while(cin >> a, a!='0') {
    ba[0][0] = a;
    REP(i,3) {
      REP(j,3) {
        if (i||j)
          cin >> ba[j][i];
      }
    }
    if (judge('b')) cout << 'b' << endl;
    else if (judge('w')) cout << "w" << endl;
    else cout << "NA" << endl;
  }
}