object Main extends App {
	val s = scala.io.StdIn.readLine.toList.toArray

	val t1 = s.take(2).mkString.toInt
	val t2 = s.takeRight(2).mkString.toInt

	if(0 < t1 && t1 < 13 && 0 < t2 && t2 < 13){
		println("AMBIGUOUS")
	}else if(0 < t1 && t1 < 13){
		println("MMYY")
	}else if(0 < t2 && t2 < 13){
		println("YYMM")
	}else{
		println("NA")
	}

}