#include<stdio.h>
int main()
{
	int S, T, U;
	scanf("%d", &S);
	int c = 0;
	
	T = S % 100;
	U = (S - T) / 100;
	
	if(1 <= T && T<= 12) c = c+1;
	if(1 <= U && U<= 12) c = c+2;
	
	if(c==1) printf("YYMM");
	else if(c==2) printf("MMYY");
	else if(c==3) printf("AMBIGUOUS");
	else printf("NA");
	
	return 0;
	
}