fun main(args: Array<String>) {
    val S = readLine()!!
    val a = S.take(2).toInt()
    val b = S.takeLast(2).toInt()
    val am = a in (1..12)
    val bm = b in (1..12)
    val ans = when {
        am && bm -> "AMBIGUOUS"
        am -> "MMYY"
        bm -> "YYMM"
        else -> "NA"
    }
    println(ans)
}