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