fun main(args: Array<String>) {
    var input = readLine()!!
    val n = (input.split("")[1]+input.split("")[2]).toInt()
    val k = (input.split("")[3]+input.split("")[4]).toInt()

    var nm = n in 1..12
    var km = k in 1..12
    print(
        if (nm) {
            if (km) "AMBIGUOUS"
            else "MMYY"
        }else{
            if (km) "YYMM"
            else "NA"
        }
    )
}