main :: IO ()
main = do
  s <- getLine
  let first = read $ take 2 s
      second = read $ drop 2 s
  if first == 0 || second == 0 then putStrLn "NA"
    else if 12 < first && 12 < second then putStrLn $ "NA"
      else if (1 <= first && first <= 12) && 12 < second then putStrLn "MMYY"
        else if (1 <= second && second <= 12) && 12 < first then putStrLn "YYMM"
          else putStrLn "AMBIGUOUS"