#include<bits/stdc++.h>
using namespace std;
int main(){
    int S;
  	cin >> S;
    int L = S/100;
    int R = S%100;
    if(L>=1&&L<=12){
        if(R>=1&&R<=12) cout<<"AMBIGUOUS";
        else cout<<"MMYY";
    }
    else if(R>=1&&R<=12)cout<<"YYMM";
    else cout<<"NA";
    return 0;
}