#include<iostream>
using namespace std;
int orzxy,a,b;
int main(){
	cin>>orzxy;
	a=orzxy/100;
	b=orzxy%100;
	if((a>=1&&a<=12)&&(b>=1&&b<=12)) cout<<"AMBIGUOUS";
	else if((b<=1||b>=12)&&(a>=1&&a<=12)) cout<<"MMYY";
	else if((a<=1||a>=12)&&(b>=1&&b<=12)) cout<<"YYMM";
	else cout<<"NA";
	return 0;
}