fun main(args: Array<String>) {
    val S = readLine()!!
    val S1 = S.slice(0..1)
    val S2 = S.slice(2..3)

    val MMYY = 1 <= S1.toInt() && S1.toInt() <= 12
    val YYMM = 1 <= S2.toInt() && S2.toInt() <= 12

    when {
        MMYY && YYMM -> "AMBIGUOUS"
        MMYY -> "MMYY"
        YYMM -> "YYMM"
        else -> "NA"
    }.let(::println)
}