import scala.io.StdIn


object Main extends App {
  val s  = StdIn.readLine()

  def solve(s : String): String = {
    val first = s.slice(0, 2)
    val last = s.slice(2, 4)
    var lm = false
    var fm = false

    // YYMM
    if (1 <= last.toInt && last.toInt <= 12) lm = true
    if (1 <= first.toInt && first.toInt <= 12) fm = true

    if (fm) {
      if (lm) {
        "AMBIGUOUS"
      } else {
        "MMYY"
      }
    } else {
      if (lm) {
        "YYMM"
      } else {
        "NA"
      }
    }

  }


  println(solve(s))

}
  


