

function Main(input) {
  input = input.split("\n");
  var S = input[0].split("");
  var a = parseInt(S[0]+S[1]);
  var b = parseInt(S[2]+S[3]);
  var ans="NA";
  if(a<13&&a>0&&b<13&&b>0){
    ans="AMBIGUOUS";
  }else if(a<13&&a>0&&(b>12||b==0)){
    ans="MMYY";
  }else if((a>12||a==0)&&b<13&&b>0){
    ans="YYMM";
  }

  console.log('%s', ans);
  return ans;
}

function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));