import java.util.*


fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)

    var S: Long
    S = sc.nextLong()
    solve(S)
}

fun f(n: Long) = n in 1..12

fun solve(S: Long) {
    val a = S / 100
    val b = S % 100

    if (f(a) && f(b)) {
        println("AMBIGUOUS")
    } else if (f(a)) {
        println("MMYY")
    } else if (f(b)) {
        println("YYMM")
    } else {
        println("NA")
    }
}
