'use strict'
function main(input) {
  input = String(input).trim().split('');
  let a = Number(input[0]+input[1])
  let b = Number(input[2]+input[3])
  if ((a < 1 || b < 1) || (a > 12 && b > 12)) {
    console.log('NA')
    return
  } else if (a < 13 && b < 13) {
    console.log('AMBIGUOUS')
    return
  } else if (a < 13) {
    console.log('MMYY')
    return
  } else {
    console.log('YYMM')
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
