import java.util.Scanner


object Main {

  def isYYMM(a: Int, b: Int) = (0 <= a && a <= 99) && (1 <= b && b <= 12)

  def isMMYY(a: Int, b: Int) = isYYMM(b, a)

  def charToInt(c: Char) = c - '0'

  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val s = sc.next()
    val a = charToInt(s(0)) * 10 + charToInt(s(1))
    val b = charToInt(s(2)) * 10 + charToInt(s(3))
    val result = (isYYMM(a, b), isMMYY(a, b)) match {
      case (true, true) => "AMBIGUOUS"
      case (true, false) => "YYMM"
      case (false, true) => "MMYY"
      case (false, false) => "NA"
    }
    println(result)
  }
}