fun main(args : Array<String>) {
    val S = readLine()!!

    val s1 = S.substring(0, 2)
    val s2 = S.substring(2, 4)


    val isYYMM = isYY(s1) && isMM(s2)
    val isMMYY = isMM(s1) && isYY(s2)

    // ANBUIVIOUG
    if (isMMYY && isYYMM) {
        println("AMBIGUOUS")
        return
    }

    if (isMMYY) {
        println("MMYY")
        return
    }

    if (isYYMM) {
        println("YYMM")
        return
    }

    println("NA")
}


fun isMM(string: String) : Boolean {
    val int = string.toInt()
    return 1 <= int && int <= 12
}

fun isYY(string: String) : Boolean {
    val int = string.toInt()
    return 0 <= int && int <= 99
}