'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const S = args[0][0]
	const l = parseInt(S.slice(0, 2), 10)
	const r = parseInt(S.slice(2, 4), 10)
	let isYYMM = false 
	let isMMYY = false
	if (0 <= l && l <= 99 && 1 <= r && r <= 12) isYYMM = true
	if (1 <= l && l <= 12 && 0 <= r && r <= 99) isMMYY = true
	if (isYYMM && isMMYY) console.log('AMBIGUOUS')
	else if (isYYMM) console.log('YYMM')
	else if (isMMYY) console.log('MMYY')
	else console.log('NA')
}

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