
import std.stdio;

void main() {
  while(true) {
    uint[3][3] black, white;
    char[3][3] field;
    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++) {
        if (field[i][j] == 'b') {
          black[0][i]++;
          black[1][j]++;
        }
        else if (field[i][j] == 'w') {
          white[0][i]++;
          white[1][j]++;
        }
      }
    }

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