'use strict';

function main(stdin) {
  const input = stdin;
  const former = parseInt(input.slice(0, 2), 10);
  const latter = parseInt(input.slice(2), 10);

  function test(n) {
    if (n < 1 || n > 12) return false;
    else return true;
  }

  const f = test(former);
  const l = test(latter);

  if (f) {
    if (l) console.log('AMBIGUOUS');
    else console.log('MMYY');
  } else {
    if (l) console.log('YYMM');
    else console.log('NA');
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));