function myOut(text){console.log(text);}//standard output
function Main(input) {
	input = input.trim();
	//input = input.trim().split(" ");
	//input = input.trim().split("\n");
	//input = input.trim().split(" ").map((a)=>Number(a));
	//input = input.trim().split("\n").map((a)=>Number(a));
  var left = parseInt(input.slice(0,2));
  var right = parseInt(input.slice(2,4));
  //しらみつぶしで
  if(left == 0){
     if(right == 0){
        console.log("NA");
     }else if(right >= 1 && right < 13){
        console.log("YYMM");
     }else{
        console.log("NA");
     }
  }else if(left >= 1 && left < 13){
     if(right == 0){
        console.log("MMYY");
     }else if(right >= 1 && right < 13){
        console.log("AMBIGUOUS");
     }else{
        console.log("MMYY");
     }    
  }else{
     if(right == 0){
        console.log("NA");
     }else if(right >= 1 && right < 13){
        console.log("YYMM");
     }else{
        console.log("NA");
     }      
  }
}

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