#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int solve(string s[3]){
  if(s[0][0] == s[0][1] && s[0][1] == s[0][2] && s[0][0] != '+') return (s[0][0] == 'w' ? 0 : 1);
  if(s[1][0] == s[1][1] && s[1][1] == s[1][2] && s[1][0] != '+') return (s[1][0] == 'w' ? 0 : 1);
  if(s[2][0] == s[2][1] && s[2][1] == s[2][2] && s[2][0] != '+') return (s[2][0] == 'w' ? 0 : 1);

  if(s[0][0] == s[1][0] && s[1][0] == s[2][0] && s[0][0] != '+') return (s[0][0] == 'w' ? 0 : 1);
  if(s[0][1] == s[1][1] && s[1][1] == s[2][1] && s[0][1] != '+') return (s[0][1] == 'w' ? 0 : 1);
  if(s[0][2] == s[1][2] && s[1][2] == s[2][2] && s[0][2] != '+') return (s[0][2] == 'w' ? 0 : 1);

  if(s[0][0] == s[1][1] && s[1][1] == s[2][2] && s[0][0] != '+') return (s[0][0] == 'w' ? 0 : 1);
  if(s[0][2] == s[1][1] && s[1][1] == s[2][0] && s[0][2] != '+') return (s[0][2] == 'w' ? 0 : 1);

  return -1;
}
 
int main() {
  string s[3];
  while(cin >>s[0] && s[0] != "0"){
    cin >>s[1] >>s[2];
    int ans = solve(s);
    if(ans == 0) cout <<"w" <<endl;
    else if(ans == 1) cout <<"b" <<endl;
    else cout <<"NA" <<endl;
  }
  return 0;
}