fun toDigit(a:Char) :Int{
    return a.toInt() - '0'.toInt()
}
fun dig2(a:Char,b:Char):Int{
    return toDigit(a)*10+toDigit(b)
}

fun isMonth(x:Int):Boolean{
    return (x in 1..12);
}

fun main(args:Array<String>){
    val s = readLine()!!
    val a = dig2(s[0],s[1]);
    val b = dig2(s[2],s[3]);
    
    val isYYMM = isMonth(b);
    val isMMYY = isMonth(a);

    if(isYYMM && isMMYY) println("AMBIGUOUS")
    else if(isYYMM) println("YYMM")
    else if(isMMYY) println("MMYY")
    else println("NA")
}
