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

int main(){
    int s;cin>>s;
    int A=s/100,B=s%100;
    if((0<A&&A<=12)||(0<B&&B<=12)){
        if(0<A&&A<=12&&0<B&&B<=12) cout<<"AMBIGUOUS"<<endl;
        else if(0<A&&A<=12) cout<<"MMYY"<<endl;
        else cout<<"YYMM"<<endl;
    }
    else cout<<"NA"<<endl;
}