import kotlin.comparisons.*
import java.util.*

const val MOD = 1000000007L

fun readI() = readLine()!!.toInt()
fun readL() = readLine()!!.toLong()
fun readD() = readLine()!!.toDouble()
fun readIs() = readLine()!!.split(' ').map(String::toInt)
fun readLs() = readLine()!!.split(' ').map(String::toLong)
fun readDs() = readLine()!!.split(' ').map(String::toDouble)

fun main(args: Array<String>) {
  val s = readLine()!!
  val x = s.substring(0, 2)
  val y = s.substring(2, 4)
  val xnm = x == "00" || x > "12"
  val ynm = y == "00" || y > "12"
  val ans = when {
    xnm && ynm -> "NA"
    xnm -> "YYMM"
    ynm -> "MMYY"
    else -> "AMBIGUOUS"
  }
  println(ans)
}
