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

int main(){
  int n;
  cin>>n;
  int l  = n/100;
  int r =n%100;

  if(1<=l && l<=12){
  	if(1<=r && r<=12) cout<<"AMBIGUOUS";
    else cout<<"MMYY";
  }
  else{
  	if(1<=r && r<=12) cout<<"YYMM";
    else cout<<"NA";
  }
}
