'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']
  const isMonth = num => ((0 < num) && (num < 13))
  const am = isMonth(a)
  const bm = isMonth(b)
  let result = ''

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