#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> PI;
#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 MP make_pair
#define PB push_back

char ban[3][3];


main(){
  while(cin>>ban[0]){
    if(ban[0][0]=='0')break;
    cin>>ban[1];
    cin>>ban[2];


    int br=0,bl=0,wr=0,wl=0;
    rep(i,3){
      int bh=0,wh=0,bv=0,wv=0;
      rep(j,3){
        if(ban[i][j]=='b')++bh;
        if(ban[i][j]=='w')++wh;
        if(ban[j][i]=='b')++bv;
        if(ban[j][i]=='w')++wv;
      }
      if(bv==3 || bh==3){
        cout<<'b'<<endl;
        goto END;
      }
      if(wv==3 || wh==3){
        cout<<'w'<<endl;
        goto END;
      }
      if(ban[i][i]=='b')++br;
      if(ban[i][i]=='w')++wr;
      if(ban[i][2-i]=='b')++bl;
      if(ban[i][2-i]=='w')++wl;
    }

    if(br==3 || bl==3){
      cout<<'b'<<endl;
      goto END;
    }
    if(wr==3 || wl==3){
      cout<<'w'<<endl;
      goto END;
    }
    puts("NA");
END:;
  }
}