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