import std.stdio;
import std.string;
import std.conv;

void main() {
	auto l = readln.chomp;
	auto fst = l[0..2].to!int;
	auto snd = l[2..4].to!int;
	auto fM = fst > 0 && fst <= 12;
	auto sM = snd > 0 && snd <= 12;
	auto fY = fst > 0;
	auto sY = snd > 0;
	if (fM && sM)
		write("AMBIGUOUS");
	else if (fY && sM)
		write("YYMM");
	else if (fM && sY)
		write("MMYY");
	else
		write("NA");
}
