fun main(args: Array<String>) {
    val S = readLine()!!
    val f = S.substring(0..1).toInt(); val e = S.substring(2..3).toInt()
    when {
        f in 1..12 && e in 1..12 -> println("AMBIGUOUS")
        f in 1..12 && e !in 1..12 -> println("MMYY")
        f !in 1..12 && e in 1..12 -> println("YYMM")
        else -> println("NA")
    }
}