function Main(input){
	input = Number(input.trim());
	const L = ~~(input/100),R = input %100;

	if(L >= 1 && L <= 12){
		if(R >= 1 && R <= 12) console.log('AMBIGUOUS');
		else console.log('MMYY');
	}else{
		if(R >= 1 && R <= 12) console.log('YYMM');
		else console.log('NA');
	}
}

Main(require('fs').readFileSync('/dev/stdin','utf8'));
// Main(require('fs').readFileSync('./input.txt','utf8'));
