import java.util.*

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

    val s = scanner.next()

    val head = Integer.parseInt(s.substring(0,2))
    val tail = Integer.parseInt(s.substring(2,4))
    
    if (head in 1..12) {
        if (tail in 1..12) {
            println("AMBIGUOUS")
        } else {
            println("MMYY")
        }
    } else {
        if (tail in 1..12) {
            println("YYMM")
        } else {
            println("NA")
        }
    }
}