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

void main(){
	auto S = readln.lit.to!(int[]);
	int n = S[0..2].to!int;
	int m = S[2..4].to!int;

	if((1<=n && n<=12) && (1<=m && m<=12)){
		writeln("AMBIGUOUS");
	}
	else if(1<=n && n<=12){
		writeln("MMYY");
	}
	else if(1<=m && m<=12){
		writeln("YYMM");
	}
	else{
		writeln("NA");
	}
}