fun main() {
  val S = readString()
  val a = S.substring(0..1).toInt()
  val b = S.substring(2..3).toInt()
  if (a in 1..12 && b !in 1..12) println("MMYY")
  if (a !in 1..12 && b in 1..12) println("YYMM")
  if (a in 1..12 && b in 1..12) println("AMBIGUOUS")
  if (a !in 1..12 && b !in 1..12) println("NA")
}

fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readLong() = readString().toLong()
fun readInts() = readStrings().map { it.toInt() }
fun readLongs() = readStrings().map { it.toLong() }
