object Main {

  def main(args: Array[String]): Unit = {
    import scala.io.StdIn._

    val (_before, _after) = readLine().splitAt(2)
    val before = _before.toInt
    val after = _after.toInt

    if (before >= 1 && before <= 12 && after >= 1 && after <= 12) {
      println("AMBIGUOUS")
    } else if (before >= 1 && before <= 12) {
      println("MMYY")
    } else if (after >= 1 && after <= 12) {
      println("YYMM")
    } else {
      println("NA")
    }

  }

}