import java.io.PrintWriter

val pw = PrintWriter(System.out)
fun main(args: Array<String>) {
    func()
    pw.flush()
}
fun println(value: Any) { pw.println(value) }

//ABC129x_x
fun func() {
    val S = nextInt()
    val s0 = S / 100
    val s1 = S % 100
    var ans: String
    if (s0 in 1..12)
        if (s1 in 1..12) ans = "AMBIGUOUS"
        else ans = "MMYY"
    else if (s1 in 1..12) ans = "YYMM"
    else ans = "NA"
    println("${ans}")
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun listOfString() = next().split(" ")
