'use strict'
function Main(input) {
	const a = parseInt(input.slice(0,2));
	const b = parseInt(input.slice(2,4));
  	let ans = "";
  	let has_monthpotential_a = false;
    let has_monthpotential_b = false;
  	if((a > 0)&& (a <= 12)){
    	has_monthpotential_a = true;
    }
    if((b > 0) && (b <= 12)){
    	has_monthpotential_b = true;
    }
	if((has_monthpotential_a === true) && (has_monthpotential_b === false)){
	    ans = "YYMM";
    } else if((has_monthpotential_a === false) && (has_monthpotential_b === true)){
      	ans = "MMYY";
    } else if((has_monthpotential_a === true) && (has_monthpotential_b === true)){
        ans = "AMBIGUOUS";
    } else if((has_monthpotential_a === false) && (has_monthpotential_b === false)){
        ans = "NA";
    }
    
    console.log('%s', ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
