fun main(args: Array<String>) {
    val s = readLine()!!
    val canMM1 = s.take(2).toInt() in 1..12
    val canMM2 = s.drop(2).toInt() in 1..12
    var a = "NA"
    if (canMM1) a = "MMYY"
    if (canMM2) a = "YYMM"
    if (canMM1 && canMM2) a = "AMBIGUOUS"
    print(a)
}