#include<bits/stdc++.h>
using namespace std;
int main()
  {
    int n,i,k,l;
  cin>>n;
  k=n/100;
  l=n%100;
  if(0<l && l<13 && 0<k && k<13)
    cout<<"AMBIGUOUS";
  else if(0<l && l<13)
    cout<<"YYMM";
  else if( 0<k && k<=12)
    cout<<"MMYY";
  else
    cout<<"NA";
}