const main = (input) => {
  var S = input.trim();
  var isAYY=false,isBYY=false,isAMM=false,isBMM=false;

  var A = Number(S[0]+S[1]);
  var B = Number(S[2]+S[3]);

  if(A>=1 && A<=12){
    isAMM = true;
  }
  if(B>=1 && B<=12){
    isBMM = true;
  }
  if(isAMM && isBMM){
    console.log('AMBIGUOUS');
  }else if(isAMM){
    console.log('MMYY');
  }else if(isBMM){
    console.log('YYMM');
  }else{
    console.log('NA');
  }
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
