fun main(argc:Array<String>){
    var S = readLine()!!.toInt()
    var XX = S/100
    var YY = S%100
    if(0 < XX && XX <= 12){
        if( 0 < YY && YY <= 12){
            println("AMBIGUOUS")
        }else{
            println("MMYY")
        }
    }else{
        if(0 < YY && YY <= 12){
            println("YYMM")
        }else{
            println("NA")
        }
    }
}