fun main(args: Array<String>) {
    val s = readLine()!!.toInt()
    val x = s / 100
    val y = s % 100
    if (y in 1..12 && !(x in 1..12)) println("YYMM")
    else if (y in 1..12 && (x in 1..12)) println("AMBIGUOUS")
    else if (x in 1..12 && !(y in 1..12)) println("MMYY")
    else println("NA")
}
