
import std.stdio;

void main() {
  while(true) {
    uint[][][char] mapping;
    char[3][3] field;
    foreach (c; ['b', 'w', '+'])
      mapping[c] = new uint[][](3, 3);
    for(int i = 0; i < 3; i++)
      for(int j = 0; j < 3; j++) {
        scanf(j == 2 ? "%c\n" : "%c", &field[i][j]);
        if (field[i][j] == '0') goto end;
      }

    for(int i = 0; i < 3; i++)
      for(int j = 0; j < 3; j++) {
        mapping[field[i][j]][0][j]++;
        mapping[field[i][j]][1][i]++;
      }

    for(int i = 0; i < 3; i++) {
      mapping[field[i][i]][2][0]++;
      mapping[field[2 - i][i]][2][1]++;
    }
    
    for(int i = 0; i < 3; i++)
      for (int j = 0; j < 3; j++)
        foreach (c; ['b', 'w'])
          if (mapping[c][i][j] == 3) {writeln(c); goto next;}
    
    writeln("NA");
  next:;
  }
end:;
}