#include<bits/stdc++.h>
using namespace std;
int a;
int x,y;
bool p=0,q=0;

int main(){
	scanf("%d",&a);
	x=a/100;
	y=a%100;
	if(x>0&&x<=12) p=1;
	if(y>0&&y<=12) q=1;
	if(p==1&&q==1) printf("AMBIGUOUS\n");
	else if(p==1) printf("MMYY\n");
	else if(q==1) printf("YYMM\n");
	else printf("NA\n");
	
	return 0;
}