'use strict';
(function(input){
  input=input.trim();
  var A=(input[0]+input[1])-0;
  var B=(input[2]+input[3])-0;
  var a=(A<=12&&A>=1);
  var b=(B<=12&&B>=1);
  var ans=(a&&b)?'AMBIGUOUS':a?'MMYY':b?'YYMM':'NA';
  console.log(ans);
})(require('fs').readFileSync('/dev/stdin','utf8'));