import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val s = scanner.next()
    val head = s.substring(0..1).toInt()
    val tail = s.substring(2..3).toInt()
    if (canY(head) && canM(tail)) {
        if (canM(head) && canY(tail)) {
            print("AMBIGUOUS")
        } else {
            print("YYMM")
        }
    } else {
        if (canM(head) && canY(tail)) {
            print("MMYY")
        } else {
            print("NA")
        }
    }
}

fun canY(i: Int): Boolean {
    return i in 0..99
}

fun canM(i: Int): Boolean {
    return i in 1..12
}