fun main(args:Array<String>) {
    val dateString = readLine()!!
    val num1 = dateString.substring(0,2).toInt()
    val num2 = dateString.substring(2).toInt()
    var ans = "NA"
    if (num1 in 1..12) {
        if(num2 in 1..12) {
            ans = "AMBIGUOUS"
        } else {
            ans = "MMYY"
        }
    } else {
        if(num2 in 1..12) {
            ans = "YYMM"
        } else {

        }
    }
    println(ans)

}
