void solve(){
}
void main(){
	string s = instr();
	int head = s[0..2].to!int();
	int tail = s[2..4].to!int();
	int stat;
	if(1<=head && head<=12){
		stat = stat|1;
	}
	if(1<=tail && tail<=12 ){
		stat = stat|2;
	}
	switch(stat){
		case 1:
			writeln("MMYY"); break;
		case 2:
			writeln("YYMM"); break;
		case 3:
			writeln("AMBIGUOUS"); break;
		default:
			writeln("NA");
	}

}
     
import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math, std.range;
const long mod = 10^^9+7;
alias instr = () => readln().chomp();
T inelm(T= int)(){ return to!(T)( readln().chomp() ); }
T[] inary(T = int)(){ return readln().chomp().split().to!(T[])(); }

