#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int a=(s[0]-'0')*10+s[1]-'0';
	int b=(s[2]-'0')*10+s[3]-'0';
	if(a>=1&&a<=12&&b>=1&&b<=12){
		puts("AMBIGUOUS");
	}
	else if(a>=1&&a<=12){
		puts("MMYY");
	}
	else if(b>=1&&b<=12){
		puts("YYMM");
	}
	else puts("NA");
}