#include<bits/stdc++.h>

    ///--------------------------------------------------------------------------------
    #define     T()                 ll t;    cin>>t;        while(t--)
    #define        ll                  long long
    #define        vi                     vector<ll>
    #define     pii                 pair<ll,ll>
    #define     vpair                 vector< pii >
    #define     fast                 ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    #define     repp(i,a,n)         for(ll i= a ; i < n ; ++i)
    #define     rep(i,n)            for(ll i= 0 ; i < n ; ++i)
    #define     p_b                     push_back
    #define     p_f                 push_front
    #define     pop_b                 pop_back()
    #define     pop_f                 pop_front()
    #define     m_p                 make_pair
    #define      sumv(v)              accumulate(v.begin(),v.endd(),0);
    #define     sortv(v)             sort(v.begin(),v.endd())
    #define     sort_dec(v)         sort(v.begin(),v.endd(),greater<ll>() )
    #define     l_b(v,l)               lower_bound (v.begin(), v.endd(), l)
    #define     u_b(v,l)               upper_bound (v.begin(), v.endd(), l)
    #define     pq                     priority_queue
    #define     ff                     first
    #define     ss                     second
    #define     len                 length()
    #define     all(v)              v.begin(),v.endd()
    #define     mset(a,b)           memset(a,b,sizeof(a));

    ///==========INPUT=============///
    #define     sc(a)           cin>>a;
    #define     sc2(a,b)        cin>>a>>b;
    #define     sc3(a,b,c)      cin>>a>>b>>c;
    #define     sc4(a,b,c,d)    cin>>a>>b>>c>>d;
    ///==========PRINTING=============///
    #define     prarr(arr)      rep(i,sizeof(arr)/sizeof(ll)) cout<<arr[i]<<" "; nl
    #define     prvec(v)        rep(i,v.size()) cout<<v[i]<<" "; nl
    #define     pr(x)           cout<<x<<"\n";
    #define     pr2(x, y)       cout<<x<<" "<<y<<"\n";
    #define     pr3(x, y, z)    cout<<x<<" "<<y<<" "<<z<<"\n";

    ///==========DEBUGGING=============///
    #define     debug(a)             cout<<"*"<<a<<enddl;
    #define     debug2(a,b)         cout<<"$"<<a<<" "<<b<<enddl;
    #define     debug3(a,b,c)         cout<<"$"<<a<<" "<<b<<" "<<c<<enddl;
    #define     bug                 cout<<"#"<<enddl;
    #define     nl                     cout<<'\n';
    #define     enddl                '\n'

    ///==========CONSTANTS=============///
    #define     max6     1000005
    #define     max5     100004
    #define     max4     10003
    #define     mod       1000000007
    #define     inf      1e9
    ll powermod(ll _a,ll _b,ll _m)    {ll _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}

    using namespace std;

    int main()
    {
        fast
        string s;
        cin>>s;
        ll a=(s[0]-'0')*10+s[1]-'0';
        ll b=(s[2]-'0')*10+s[3]-'0';
        if(a<=12&&b<=12&&a!=0&&b!=0)
            cout<<"AMBIGUOUS";
        else if((a>12&&b>12)||(a>12&&b==0)||(a==0&&b>12)||(a==0&&b==0))
            cout<<"NA";
        else if(a<=12&&a!=0)
            cout<<"MMYY";
        else
            cout<<"YYMM";
    }


Measured memory_bytes: 256