object Main {
  def main(args: Array[String]): Unit = {
    val array = Array("YYMM", "MMYY", "AMBIGUOUS", "NA")
    val sc = new java.util.Scanner(System.in)
    val nk = sc.nextLine()
    val f = nk.substring(0, 2)
    val l = nk.substring(2, 4)
    val fb = f.toInt >= 1 && f.toInt < 13
    val lb = l.toInt >= 1 && l.toInt < 13

    if (fb && lb) { println(array(2)) }
    else if (!fb && !lb){ println(array(3)) }
    else if (!fb && lb) { println(array(0)) }
    else if (fb && !lb) { println(array(1)) }
  }
}