function main(input){
  const S=parseInt(input,10);
  if((Math.floor(S/100)>=13 || Math.floor(S/100)==0) && ((S%100)>=13)||(S%100)==0){
    console.log("NA");
  }else if(Math.floor(S/100)>=13 || Math.floor(S/100)==0){
    console.log("YYMM");
  }else if((S%100)>=13 || (S%100)==0){
    console.log("MMYY");
  }else{
    console.log("AMBIGUOUS");
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));