object Main extends App {

  val s = scala.io.StdIn.readLine()


  def solve() =  {
    val first = s.splitAt(2)._1.toInt
    val second = s.splitAt(2)._2.toInt

    (isMonth(first), isMonth(second)) match {
      case (true,  true)  => "AMBIGUOUS"
      case (false, true)  => "YYMM"
      case (true,  false) => "MMYY"
      case (false, false) => "NA"
    }
  }

  def isMonth(num: Int) = {
    if(1 <= num && num <= 12) true else false
  }


  println(solve)

}