process.stdin.resume();
process.stdin.setEncoding('utf8'); 
var lines = [];
var reader = require('readline').createInterface({
	input: process.stdin,
	output: process.stdout
});
 
reader.on('line', (line) => {
	lines.push(line);
});

reader.on('close', () => {
	"use strict"
	const S = lines[0];
	
	const format = [+(S[0]+S[1]), +(S[2]+S[3])].
		map(a => +(a>=1 && a<=12));
	let ans = (new Map(
		[["00", "NA"],
		["01", "YYMM"],
		["10", "MMYY"],
		["11", "AMBIGUOUS"]])).get(format.join(""))
		
	console.log(ans);
});