fun main(args: Array<String>){

  val S = readLine()!!
  val AB = S.substring(0,2).toInt()
  val CD = S.substring(2).toInt()

  when {
    (0 < AB && AB <=12 ) && (0 < CD && CD <=12) -> println("AMBIGUOUS")
    (0 < AB && AB <=12 ) && (CD ==0 || 12 < CD) -> println("MMYY")
    (AB ==0 || 12 < AB ) && (0 < CD && CD <=12) -> println("YYMM")
    (AB ==0 || 12 < AB ) && (CD ==0 || 12 < CD) -> println("NA")
  }

}
