import java.util.Scanner

val sc = Scanner(System.`in`)
val s = sc.next()

fun main(args: Array<String>) {
    val mae = "${s[0]}${s[1]}".toInt()
    val usiro = "${s[2]}${s[3]}".toInt()

    if (mae >= 1 && mae <= 12) {
        if (usiro >= 1 && usiro <= 12) {
            println("AMBIGUOUS")
            return
        } else {
            println("MMYY")
            return
        }
    } else {
        if (usiro >= 1 && usiro <= 12) {
            println("YYMM")
            return
        } else {
            println("NA")
            return
        }
    }
}