import java.util.*

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

    println(abc126b(s))
}

fun abc126b(s: String): String {
    var first = s.toInt() / 100
    var second = s.toInt() - first * 100

    var isYYMM = isYear(first) && isMonth(second)
    var isMMYY = isMonth(first) && isYear(second)
    if (isYYMM && isMMYY) {
        return "AMBIGUOUS"
    } else if (isYYMM && !isMMYY) {
        return "YYMM"
    } else if (!isYYMM && isMMYY) {
        return "MMYY"
    } else {
        return "NA"
    }
}

fun isYear(s: Int): Boolean {
    if (0 <= s && s <= 99) return true
    return false
}

fun isMonth(s: Int): Boolean {
    if (1 <= s && s <= 12) return true
    return false
}