import std.stdio, std.conv, std.string, std.math, std.regex, std.range, std.ascii, std.algorithm;

void main(){
	auto S = readln.chomp;
	auto F = S[0..2].to!int;
	auto R = S[2..$].to!int;

	if((1<=F&&F<=12) && (1<=R&&R<=12)) writeln("AMBIGUOUS");
	else if(1<=F&&F<=12) writeln("MMYY");
	else if(1<=R&&R<=12) writeln("YYMM");
	else writeln("NA");
}