import scala.io.StdIn._
object Main extends App {

  val str = readLine.trim
  println(
    if (isYYMM(str) && isMMYY(str)) "AMBIGUOUS"
    else if (isYYMM(str)) "YYMM"
    else if (isMMYY(str)) "MMYY"
    else "NA"
  )
  def isYYMM(str: String): Boolean = {
    (1 to 12).contains(str.substring(2, 4).toInt)
  }
  def isMMYY(str: String): Boolean = {
    (1 to 12).contains(str.substring(0, 2).toInt)
  }
}