fun main(args:Array<String>) {
    println(isYYMM(readLine()!!))
}


fun isYYMM(s:String):String {
    if(s.take(2).toInt() in (1..12)) {
        if(s.drop(2).toInt() in (1..12)) {
            return "AMBIGUOUS"
        } else {
            return "MMYY"
        }
    } else if(s.drop(2).toInt() in (1..12)) {
        return "YYMM"
    } else {
        return "NA"
    }
}
