import Control.Monad

main :: IO ()
main = do
  s1 <- getLine
  if s1 == "0"
    then return ()
    else do
      s23 <- replicateM 2 getLine
      let ls = s1:s23
          ans = solve ls
      putStrLn ans
      main

solve :: [String] -> String
solve ls
  |solve' ls == 1 = "b"
  |solve' ls == 2 = "w"
  |otherwise = "NA"
  where
    solve' :: [String] -> Int
    solve' ls = max (max (rowC ls) (colC ls)) (slaC ls)
      where
        rowC :: [String] -> Int
        rowC ls = maximum (map check ls)
          where
            check :: String -> Int
            check s
              | s == "bbb" = 1
              | s == "www" = 2
              | otherwise = 0
        colC :: [String] -> Int
        colC ls = rowC (spin ls)
          where
            spin :: [String] -> [String]
            spin [[],[],[]] = []
            spin [(x:xs),(y:ys),(z:zs)] = [x,y,z]:(spin [xs,ys,zs])
        slaC :: [String] -> Int
        slaC ls = rowC (sla ls)
          where
            sla :: [String] -> [String]
            sla [s1,s2,s3] = [(head s1):(head (tail s2)):[last s3], (head s3):(head (tail s2)):[last s1]]