import java.util.Arrays
import java.util.ArrayList

const val MOD: Long = (1e9+7).toLong()
fun Double.format(digits: Int) = String.format("%.${digits}f", this)
fun <T : Comparable<T>> Iterable<T>.argmax(): Int? = withIndex().maxBy{it.value}?.index
fun <T : Comparable<T>> Iterable<T>.argmin(): Int? = withIndex().minBy{it.value}?.index

fun main(args: Array<String>) {
    val reader = System.`in`.bufferedReader()
    val s = reader.readLine()!!

    val p = s.slice(0..1).toInt()
    val q = s.slice(2..3).toInt()
    if (p == 0) { // p is year
        if (q == 0) {
            println("NA")
        } else if (q <= 12) {
            println("YYMM")
        } else {
            println("NA")
        }
    } else if (p <= 12) {
        if (q == 0) {
            println("MMYY")
        } else if (q <= 12) {
            println("AMBIGUOUS")
        } else {
            println("MMYY")
        }
    } else {
        if (q == 0) {
            println("NA")
        } else if (q <= 12) {
            println("YYMM")
        } else {
            println("NA")
        }
    }
}
