import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List
import Data.Char (digitToInt)
import Test.HUnit

main :: IO ()
-- main = runTestTT (TestList tests) >> return ()
main = do
  xs <- getc solve
  mapM_ putStrLn xs

solve :: String -> String
solve xs = maybe "NA" id $ decode "" xs

decode :: String -> String -> Maybe String
decode acc [] = Just $ reverse acc
decode acc (s1:s2:ss) = decode ((tr s1 s2) : acc) ss
decode _ _ = Nothing

tr :: Char -> Char -> Char
tr i j = tbl !! (((digitToInt i) - 1) * 5 + ((digitToInt j) - 1))
  where
    tbl = "abcdefghijklmnopqrstuvwxyz.?! "

getc :: (String -> a) -> IO [a]
getc f = map f . lines <$> getContents