function Main(input){
  var S = input.split("");
  var a = S.splice(0,2);
  var lef = a.join("");
  var rig = S.join("");
  lef = parseInt(lef,10);
  rig = parseInt(rig,10);
  
  if((0<lef&&lef<=12)&&rig>12){
    console.log('MMYY');
  }else if(lef>12&&(0<rig&&rig<=12)){
    console.log('YYMM');
  }else if((0<=lef&&lef<=12)&&(0<=rig&&rig<=12)){
    if(lef===0&&rig>0){
      console.log('YYMM');
    }else if(lef>0&&rig===0){
      console.log('MMYY');
    }else{
      console.log('AMBIGUOUS');
    }
  }else{
    console.log('NA');
  }



}  

Main(require("fs").readFileSync("/dev/stdin", "utf8"));