#include<bits/stdc++.h>
using namespace std;
#define f(b) ((s[b]=='0'&&s[b+1]>'0')||(s[b]=='1'&&s[b+1]<'3'))
int main(){
  string s;
  cin>>s;
  if(f(0)&&f(2))cout<<"AMBIGUOUS\n";
  else if(f(0))cout<<"MMYY\n";
  else if(f(2))cout<<"YYMM\n";
  else cout<<"NA\n";
  return 0;
}