import java.util.*
import java.math.*

fun main(args: Array<String>) {
//    var (R, G, B, N) = readLine()!!.split(" ").map { it.toInt() }
//    var N = readLine()!!.toInt()
    val S = readLine()!!.toInt()
//    val D = readLine()!!.split(" ").map { it.toLong() }
//    val A = readLine()!!.split(" ").map { it.toInt() }.toIntArray()

    var YYMM = false
    var MMYY = false
    if (S in 100 until 1300) MMYY = true
    if (S%100 in 1 until 13) YYMM = true

    println(if (MMYY && YYMM) "AMBIGUOUS" else if (MMYY) "MMYY" else if(YYMM) "YYMM" else "NA")
}
