#include<iostream>
using namespace std;
int main()
{
	int n,a=0,b=0,k=0;
	cin>>n;
    a=n%10;
    n=n/10;
    a+=(10*(n%10));
    n=n/10;
	
	b=n%10;
	n=n/10;
	b+=(10*(n%10));

	
	if(a>0&&a<13&&b>0&&b<13) cout<<"AMBIGUOUS";
	else if(a>0&&a<13) cout<<"YYMM";
	else if(b>0&&b<13) cout<<"MMYY";
	else cout<<"NA";
	
	
}