function main(input) {
  const S = input.toString().match(/.{2}/g).map(n => parseInt(n, 10));

  if (S[0] <= 12 && S[1] <= 12 && S[0] > 0 && S[1] > 0) {
    console.log('AMBIGUOUS');
  }
  else if (S[0] <= 12 && S[0] > 0) {
    console.log('MMYY');
  }
  else if (S[1] <= 12 && S[1] > 0) {
    console.log('YYMM');
  }
  else console.log('NA');
}

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