fun main(args: Array<String>) {
    val s = readLine()!!
    val a = s.take(2)
    val b = s.drop(2)
    when {
        check(a) && check(b) -> println("AMBIGUOUS")
        check(a) && !check(b) -> println("MMYY")
        !check(a) && check(b) -> println("YYMM")
        !check(a) && !check(b) -> println("NA")
    }

}

fun check(s:String) = s in "01".."12"