fun main(args: Array<String>) {
    abc126B()
}

fun abc126B() {
    val s = readLine()!!
    val left = s.substring(0..1).toInt()
    val right = s.substring(2..3).toInt()
    val answer = if (left in 1..12) {
        if (right in 1..12) {
            "AMBIGUOUS"
        } else {
            "MMYY"
        }
    } else {
        if (right in 1..12) {
            "YYMM"
        } else {
            "NA"
        }
    }
    
    println(answer)
}
