object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val s = sc.next
    sc.close()

    val s1 = s.splitAt(2)._1.toInt
    val s2 = s.splitAt(2)._2.toInt

    val result = (under12(s1), under12(s2)) match {
      case (true, true) => "AMBIGUOUS"
      case (false, true) => "YYMM"
      case (true, false) => "MMYY"
      case _ => "NA"
    }
    println(result)
  }

  def under12(v: Int): Boolean = 0 < v && v <= 12
}