include <bits/stdc++.h>
using namespace std;
 
int main()
{
  string str1, str2, str3;
  while (cin >> str1, str1 != "0"){
    bool b, w;
    b = w = false;
    cin >> str2 >> str3;
 
    if (str1[0] == str1[1] && str1[0] == str1[2]){
      if (str1[0] == 'b') b = true;
      if (str1[0] == 'w') w = true;
    }
    else if (str2[0] == str2[1] && str2[0] == str2[2]){
      if (str2[0] == 'b') b = true;
      if (str2[0] == 'w') w = true;
    }
    else if (str3[0] == str3[1] && str3[0] == str3[2]){
      if (str3[0] == 'b') b = true;
      if (str3[0] == 'w') w = true;
    }
    else if (str1[0] == str2[0] && str1[0] == str3[0]){
      if (str1[0] == 'b') b = true;
      if (str1[0] == 'w') w = true;
    }
    else if (str1[1] == str2[1] && str1[1] == str3[1]){
      if (str1[1] == 'b') b = true;
      if (str1[1] == 'w') w = true;
    }
    else if (str1[2] == str2[2] && str1[2] == str3[2]){
      if (str1[2] == 'b') b = true;
      if (str1[2] == 'w') w = true;
    }
    else if (str1[0] == str2[1] && str1[0] == str3[2]){
      if (str1[0] == 'b') b = true;
      if (str1[0] == 'w') w = true;
    }
    else if (str1[2] == str2[1] && str1[2] == str3[0]){
      if (str1[2] == 'b') b = true;
      if (str1[2] == 'w') w = true;
    }
 
    if (b)  cout << 'b';
    if (w) cout << 'w';
    if (!b && !w)cout << "NA";
    cout << endl;
  }
}
  