function main(input) {
  const inArray = input.trim().split(/\s|\n/);
  const pre = parseInt(inArray[0].slice(0, 2));
  const sre = parseInt(inArray[0].slice(2, 4));
  const isYear = (s) => (s >= 0) && (s <= 99);
  const isMonth = (s) => (s >= 1) && (s <= 12);
  if (isYear(pre) && isMonth(sre)) {
    if (isYear(sre) && isMonth(pre)) {
      console.log('AMBIGUOUS');
    } else {
      console.log('YYMM');
    }
  } else {
    if (isYear(sre) && isMonth(pre)) {
      console.log('MMYY');
    } else {
      console.log('NA');
    }
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
