object Main extends App {
  val in = scala.io.Source.stdin.getLines.toSeq
  val S = in.head
  val f = S.take(2).toInt
  val s = S.drop(2).toInt
  private def month(n:Int):Boolean = {
    1 <= n && n <= 12
  }
  val mx = month(f)
  val xm = month(s) 
  
  if(mx && xm) println("AMBIGUOUS")
  else if(xm) println("YYMM")
  else if(mx) println("MMYY")
  else if(!(mx || xm)) println("NA")
  else println("XXXXXXXXX")
}
