'use strict'
function main(input) {
  input = input.trim()
  const a = Number(input.slice(0, 2))
  const b = Number(input.slice(2, 4))
  const text = ['YYMM','MMYY','AMBIGUOUS','NA']
  let result = ''

  if ((a === 0) || (b === 0) || ((a > 12) && (b > 12))) {
    result = text[3]
  } else if (a < 13) {
    if (b < 13) {
      result = text[2]
    } else {
      result = text[1]
    }
  } else {
    result = text[0]
  }
  console.log(result)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
