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

int main(void){
  int S;
  cin>>S;
  if(S%100>0&&S%100<13){
    if(S/100>0&&S/100<13)cout<<"AMBIGUOUS";
    else cout<<"YYMM";
  }
  else{
    if(S/100>0&&S/100<13)cout<<"MMYY";
    else cout<<"NA";
  }
}