import java.util.*

fun main(args:Array<String>){
    val s = readLine()!!
    val a = Integer.parseInt(s.substring(0, 2))
    val b = Integer.parseInt(s.substring(2,4))
    println(
    if((a == 0 && b == 0) || (a > 12 && b > 12)){
        "NA"
    }
    else if(a == 0){
        if(b > 12) "NA"
        else "YYMM"
    }
    else if(b == 0){
        if(a > 12) "NA"
        else "MMYY"
    }
    else if(a <= 12 && b <= 12){
        "AMBIGUOUS"
    }
    else if(a > 12){
        "YYMM"
    }
    else if(b > 12){
        "MMYY"
    }
    else{
        "NA"
    })
}
