import scala.io.{StdIn => in}

object Main extends App {
  val s = in.readLine

  val month = (1 to 12)
  val first = if(month.contains(s.take(2).toInt)) true else false
  val second = if(month.contains(s.drop(2).toInt)) true else false

  val ans = (first, second) match {
    case (true, true) => "AMBIGUOUS"
    case (true, false) => "MMYY"
    case (false, true) => "YYMM"
    case _ => "NA"
  }
  println(ans)
}