// #pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
const double EPS=1e-7;
const int MOD=1e9+7;
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);
#define VI vector<int>
#define VD vector<double>
#define VC vector<char>
#define VS vector<string>
#define VVI vector<VI>
#define VVD vector<VD>
#define VVC vector<VC>
#define VVS vector<VS>
#define PII pair<int,int>
#define PIII pair<int,PII>
#define VPII vector<PII>
#define VPIII vector<PIII>
#define emb emplace_back
#define pub push_back
#define pob pop_back
#define mp make_pair
#define mp3(a,b,c) mp(a,mp(b,c))
#define fi first
#define se second
#define fir fi
#define sec se.fi
#define thr se.se
#define fou(i,a,n) for(int i=a;i<n;i++)
#define fod(i,a,n) for(int i=n-1;i>=a;i--)
#define rep(n) fou(_,0,n)
#define tra(a,x) for(auto& a : x)
#define elif(c) else if(c)
#define si(vec) ((int)(vec).size())
#define all(vec) vec.begin(),vec.end()
#define lla(vec) vec.rbegin(),vec.rend()
#define range(vec,x,y) vec.begin()+x,vec.begin()+y
#define sortup(vec) sort(all(vec))
#define sortdown(vec) sort(lla(vec))
#define eraseif(vec,condition_VAR) vec.erase(remove_if(all(vec),[&](auto VAR){return condition_VAR;}),vec.end())
#define erase_unique(vec) vec.erase(unique(all(vec)),vec.end())
#define rotateleft(vec,n) rotate(vec.begin(),vec.begin()+n,vec.end())
#define rotateright(vec,n) rotate(vec.rbegin(),vec.rbegin()+n,vec.rend())
template<class C>int minelement(vector<C>&vec){int s=si(vec);C m=0;fou(i,1,s)if(vec[i]<vec[m])m=i;return m;}
template<class C>int maxelement(vector<C>&vec){int s=si(vec);C m=0;fou(i,1,s)if(vec[i]>vec[m])m=i;return m;}
template<class C>void mini(C&a,const C&b){a=min(a,b);}
template<class C>void maxi(C&a,const C&b){a=max(a,b);}
// make_pair,vector calculate
#define opall(calc) calc(+)calc(-)calc(*)calc(/)calc(%)calc(<<)calc(>>)calc(&)calc(|)calc(^)
#define paircalc(op) template<class C1,class C2,class C3>pair<C1,C2>operator op(const pair<C1,C2>&l,const C3&r){return mp(l.first op r,l.second op r);}
#define pair2calc(op) template<class C1,class C2>pair<C1,C2>operator op(const pair<C1,C2>&l,const pair<C1,C2>&r){return mp(l.first op r.first,l.second op r.second);}
#define vectorcalc(op) template<class C1,class C2>vector<C1>operator op(const vector<C1>&l,const C2&r){int s=si(l);vector<C1> v(s);fou(i,0,s)v[i]=l[i] op r;return v;}
#define vector2calc(op) template<class C>vector<C>operator op(const vector<C>&l,const vector<C>&r){int s=min(si(l),si(r));vector<C>v(s);fou(i,0,s)v[i]=l[i] op r[i];return v;}
#define opeq(op) template<class C1,class C2>C1 operator op ## =(C1&l,const C2&r){return l=l op r;}
opall(paircalc)opall(pair2calc)opall(vectorcalc)opall(vector2calc)opall(opeq)
// iostream
#define in(T,...) T __VA_ARGS__;_cin(__VA_ARGS__)
#define out(...) _cout(__VA_ARGS__)
void _cin(){}template<class Head,class...Tail>void _cin(Head&head,Tail&&...tail){cin>>head;_cin(forward<Tail>(tail)...);}
template<class Head>void _cout(const Head&head){cout<<head<<endl;}template<class Head,class...Tail>void _cout(const Head&head,Tail...tail){cout<<head<<" ";_cout(forward<Tail>(tail)...);}
template<class C1,class C2>istream&operator>>(istream&is,pair<C1,C2>&p){return is>>p.fi>>p.se;}
template<class C>istream&operator>>(istream&is,vector<C>&vec){tra(v,vec)is>>v;return is;}
template<class C1,class C2>ostream&operator<<(ostream&os,const pair<C1,C2>&p){os<<p.fi<<" "<<p.se;return os;}
template<class C>ostream&operator<<(ostream&os,const vector<C>&vec){int vecsize=si(vec);fou(i,0,vecsize-1)os<<vec[i]<<" ";os<<vec[vecsize-1];return os;}
// math
int gcd_sub(const int&a,const int&b){if(b)return gcd_sub(b,a%b);else return a;}int gcd(const int&a,const int&b){return gcd_sub(max(a,b),min(a,b));}
int lcm(const int&a,const int&b){return a/gcd(a,b)*b;}
int fact(const int&n){return n==0?1:n*fact(n-1);}
PII comb_sub(const int&m,const int&n){return n==0?mp(1,1):mp(m,n)*comb_sub(m-1,n-1);}int comb(const int&m,const int&n){PII p=comb_sub(m,min(n,m-n));return p.fi/p.se;}
int mnum(const int&a){return a%MOD+(a<0?MOD:0);}
int minv(int a){a=mnum(a);int b=MOD,u=0,v=1;while(a>1){u-=b/a*v;b%=a;swap(a,b);swap(u,v);}return mnum(v);}
int madd(const int&a,const int&b){return (mnum(a)+mnum(b))%MOD;}
int msub(const int&a,const int&b){return (mnum(a)-mnum(b))%MOD;}
int mmul(const int&a,const int&b){return (mnum(a)*mnum(b))%MOD;}
int mdiv(const int&a,const int&b){return mmul(a,minv(b));}
int mpow(int a,int b){int r=1;while(b>0){if(b&1)r=mmul(r,a);a=mmul(a,a);b>>=1;}return r;}
// algorithm
template<class C>vector<C>cumsum(vector<C>vec){int s=si(vec);fou(i,1,s)vec[i]+=vec[i-1];return vec;}
template<class C>vector<vector<C>>cumsum2(vector<vector<C>>vec){int s=si(vec);fou(i,1,s)vec[i]+=vec[i-1];fou(i,0,s)vec[i]=cumsum(vec[i]);return vec;}
template<class C>int binarysearch(const vector<C>vec,const C&n,const char&c){
  int left=-1;int right=si(vec);bool outleft=(c=='d'||c=='U');int getmin=(c=='u'||c=='d')?1:-1;
  while(right-left>1){
    int mid=left+(right-left)/2;
    bool OK=vec[mid]*getmin>=n*getmin;
    if(outleft==OK) left=mid;else right=mid;
  }
  return outleft?left:right;
}

class unionfind{vector<int> p;int n;public:unionfind(int _n):n(_n){p.resize(n);iota(all(p),0);}int get(const int&x){return (x==p[x]?x:(p[x]=get(p[x])));}void unite(int x,int y){x=get(x);y=get(y);if(x!=y)p[x]=y;}bool same(int x,int y){x=get(x);y=get(y);return x==y;}};
template<typename T>class BIT{vector<T> tree;int n;public:BIT(int _n):n(_n){tree.resize(n);}void add(int x,T v){while(x<n){tree[x]+=v;x|=(x+1);}}T sum(int x){T v=0;while(x>=0){v+=tree[x];x=(x&(x+1))-1;}return v;}};
// part,set,get,mul



#define int int64_t
// #define double long double

signed main(){
  in(string,s);
  bool flag1=false;
  bool flag2=false;

  if(s[0]=='0'&&s[1]=='1')flag1=true;
  if(s[0]=='0'&&s[1]=='2')flag1=true;
  if(s[0]=='0'&&s[1]=='3')flag1=true;
  if(s[0]=='0'&&s[1]=='4')flag1=true;
  if(s[0]=='0'&&s[1]=='5')flag1=true;
  if(s[0]=='0'&&s[1]=='6')flag1=true;
  if(s[0]=='0'&&s[1]=='7')flag1=true;
  if(s[0]=='0'&&s[1]=='9')flag1=true;
  if(s[0]=='1'&&s[1]=='0')flag1=true;
  if(s[0]=='1'&&s[1]=='1')flag1=true;
  if(s[0]=='1'&&s[1]=='2')flag1=true;

  if(s[2]=='0'&&s[3]=='1')flag2=true;
  if(s[2]=='0'&&s[3]=='2')flag2=true;
  if(s[2]=='0'&&s[3]=='3')flag2=true;
  if(s[2]=='0'&&s[3]=='4')flag2=true;
  if(s[2]=='0'&&s[3]=='5')flag2=true;
  if(s[2]=='0'&&s[3]=='6')flag2=true;
  if(s[2]=='0'&&s[3]=='7')flag2=true;
  if(s[2]=='0'&&s[3]=='9')flag2=true;
  if(s[2]=='1'&&s[3]=='0')flag2=true;
  if(s[2]=='1'&&s[3]=='1')flag2=true;
  if(s[2]=='1'&&s[3]=='2')flag2=true;

  string ans;
  if(flag1&&flag2) ans="AMBIGUOUS";
  if(flag1&&!flag2) ans="MMYY";
  if(!flag1&&flag2) ans="YYMM";
  if(!flag1&&!flag2) ans="NA";

  out(ans);


}

Measured memory_bytes: 256