#include <bits/stdc++.h>
using namespace std;

int main() {
	char a,b,c,d;
	cin>>a>>b>>c>>d;
	int x=(a-'0')*10+b-'0';
	int y=(c-'0')*10+d-'0';
	if(x>12 or x<=0){
		if(y>12 or y<=0) cout<<"NA";
		else cout<<"YYMM";
	}
	else{
		if(y>12 or y<=0) cout<<"MMYY";
		else cout<<"AMBIGUOUS";
	}
}