import java.util.*

fun canBeMM(lc: Char, rc: Char): Boolean {
    val l = Integer.parseInt(lc.toString())
    val r = Integer.parseInt(rc.toString())
    if (l*10 + r > 0 && 12 >= l*10 + r) {
        return true
    }
    return false
}
fun main(args: Array<String>){
	val cin = Scanner(System.`in`)
    val s = cin.next()
    val le: Boolean = canBeMM(s[0], s[1])
    val ri: Boolean = canBeMM(s[2], s[3])

    if (le && ri) {
        println("AMBIGUOUS")
    } else if (le) {
        println("MMYY")
    } else if (ri) {
        println("YYMM")
    } else {
        println("NA")
    }
}