fun main(args: Array<String>) = println(run {
    val s = readLine()!!
    val x = s.take(2)
    val y = s.takeLast(2)
    when {
        x !in "01".."12" && y in "01".."12" -> "YYMM"
        x in "01".."12" && y !in "01".."12" -> "MMYY"
        x in "01".."12" && y in "01".."12" -> "AMBIGUOUS"
        else -> "NA"
    }

})

