import java.util.Scanner

object Main extends App  {
  val sc = new Scanner(System.in)

  val s = sc.next

  val s1 = s.substring(0,2).toInt
  val s2 = s.substring(2).toInt

  val res = (isYYMM(s1, s2), isMMYY(s1,s2)) match{
    case (true, true) => "AMBIGUOUS"
    case (true, false) => "YYMM"
    case (false, true) => "MMYY"
    case (false, false) => "NA"
  }


  println(res)

  def isMonth(mm:Int):Boolean={
    1 <= mm && mm <= 12
  }

  def isYear(yy: Int): Boolean={
    0 <= yy && yy <= 99
  }

  def isYYMM(s1: Int, s2: Int) :Boolean ={
    isYear(s1) && isMonth(s2)
  }

  def isMMYY(s1: Int, s2: Int) :Boolean ={
    isMonth(s1) && isYear(s2)
  }

}
