#include <bits/stdc++.h>

using namespace std;

#define TEMP_T template<typename T>
TEMP_T void sort(T& v){ sort(v.begin(), v.end()); }
TEMP_T void revs(T& v){ reverse(v.begin(), v.end()); }
TEMP_T void uniq(T& v){ sort(v); v.erase(unique(v.begin(), v.end()), v.end()); }
TEMP_T T    cums(T& v){ T r(v.size()); partial_sum(v.begin(), v.end(), r.begin()); return r; }
TEMP_T void show(T& v, char delim=' ', char end='\n'){ for(int i=0; i<v.size()-1; i++) cout << v[i] << delim; cout << v[v.size()-1] << end; }
TEMP_T T    acum(vector<T>& v){ return accumulate(v.begin(), v.end()); }
TEMP_T vector<T> inpt(int n){ vector<T> v(n); for (int i=0; i<n; i++) cin >> v[i]; return v; }

static inline int in(){ int x; scanf("%d", &x); return x; }
static const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
static const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};

struct Field {
  Field(int w, int h) : w(w), h(h) {}
  bool invalid(int x, int y){ return x < 0 || w <= x || y < 0 || h <= y; }
  const int w, h;
};

struct Solver {
  Solver(){}
  int solve(){
  }
};

int main()
{
  int masks[] = {0700, 0070, 0007, 0444, 0222, 0111, 0124, 0421};
  string s;
  while (cin >> s, s != "0"){
    vector<string> f;
    f.push_back(s);
    cin >> s;
    f.push_back(s);
    cin >> s;
    f.push_back(s);
    int black = 0;
    int white = 0;
    for (int y = 0; y < 3; y++){
      for (int x = 0; x < 3; x++){
        char c = f[y][x];
        if (c == 'w'){
          white |= 1 << (y * 3 + x);
        }
        else if (c == 'b'){
          black |= 1 << (y * 3 + x);
        }
      }
    }
    bool na = false;
    for (int i = 0; i < 8; i++){
      if ((white & masks[i]) == masks[i]){
        puts("w");
        break;
      }
      if ((black & masks[i]) == masks[i]){
        puts("b");
        break;
      }
      if (i == 7) na = true;
    }
    if (na) puts("NA");
  }
  return (0);
}