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

// - - - - - - Data Types - - - - - - //

#define SF1(A)              scanf("%d", &A)
#define SF2(A,B)            SF1(A);SF1(B)
#define SF3(A,B,C)          SF2(A,B);SF1(C)

typedef long long int LLI;
#define SL1(A)              scanf("%lld", &A)
#define SL2(A,B)            SL1(A);SL1(B)
#define SL3(A,B,C)          SL2(A,B);SL1(C)

typedef long int LI;
typedef long long LL;

#define SD1(A)              scanf("%lf", &A)
#define SD2(A,B)            SD1(A);SD1(B)
#define SD3(A,B,C)          SD2(A,B);SD1(C)

// - - - - - - Vectors - - - - - - //
typedef vector<int> VI;
typedef vector<LLI> VLLI;
typedef vector<string> VS;
typedef vector<double> VD;
typedef vector<VI> VVI;

#define scanVI(V, N)        for(int I=0; I<N; I++){ int X; SF1(X); V.PB(X); }
#define scanVLLI(V, N)      for(int I=0; i<N; I++){ LLI X; SL1(X); V.PB(X); }
#define scanVS(V, N)        for(int I=0; i<N; I++){ string X; cin >> X; V.PB(X); }
#define scanVD(V, N)        for(int I=0; i<N; I++){ double X; SD1(X); V.PB(X); }

// - - - - - - Maps - - - - - - //
typedef map<int, int> MII;
typedef map<int, string> MIS;
typedef map<int, char> MIC;
typedef map<string, int> MSI;
typedef map<char, int> MCI;
typedef map<int, VI> MIVI;

// - - - - - - Pairs - - - - - - //
typedef pair<int, int> PII;
typedef pair<string, string> PSS;
typedef pair<char, char> PCC;
typedef pair<int, string> PIS;
typedef pair<int, char> PIC;
typedef pair<string, char> PSC;

// - - - - - - Sets - - - - - - //
typedef set<int> SI;
typedef set<LLI> SLLI;
typedef set<string> SS;
typedef set<char> SC;
// - - - - - - - - - - - - - - - - - - //

//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")

#define PF                  printf
#define PB                  push_back
#define POP                 pop_back()
#define PP                  prev_permutation
#define NP                  next_permutation
#define MP                  make_pair
#define CLRN(a, b)          memset(a, b, sizeof(a))
#define CLR(a)              memset(a, 0, sizeof(a))
#define ALL(a)              a.begin(), a.end()
#define ALLN(a, n)          (a, a+n)
#define BSRCN(a, n, x)      binary_search(ALLN(a, n), x)
#define BSRC(a, z)          binary_search(ALL(a), z)
#define MAX                 10000007
#define MIN                 -10000007
#define PI                  acos(-1)
#define BR                  PF("\n")
#define FastIO              { ios_base::sync_with_stdio(false); cin.tie(nullptr); cin.tie(nullptr); }
#define READ()              freopen("input.txt", "r", stdin)
#define WRITE()             freopen("output.txt", "w", stdout)
#define IO                  READ(); WRITE();
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
/*----------------------Graph Moves----------------*/
int ROW[]={+1,-1,+0,+0};
int COL[]={+0,+0,+1,-1};

int X[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
int Y[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move

int KX[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
int KY[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

int GCD(int a, int b) { return b == 0 ? a : GCD(b , a % b); }
int LCM(int a, int b) { return a * (b/GCD(a, b)); }
bool CMP(int a, int b) { return a>b; }
template<class T>inline bool fastread(T &x) {
        int c=getchar(); int sgn=1; while(~c&&c<'0'||c>'9'){ if(c=='-')sgn=-1; c=getchar(); }
        for(x=0; ~c&&'0'<=c&&c<='9'; c=getchar()) x=x*10+c-'0'; x*=sgn; return ~c;
    }

//clock_t Start=clock(); void Time(){ printf("\n>>Runtime: %.10fs\n", (double) (clock() - Start) / CLOCKS_PER_SEC); }

// - - - - - - - - - - - - - - - - - - - - - - - - - - - END - - - - - - - - - - - - - - - - - - - - - - - - - //



int main()
{
    string s; cin >> s;

    int a = s[0]-48;
    a = a*10+s[1]-48;

    int b = s[2]-48;
    b = b*10+s[3]-48;

    if(!a and !b)
    {
        PF("NA\n");
        return 0;
    }
    if(a==0)
    {
        if(b>12) PF("NA\n");
        else PF("YYMM\n");
        return 0;
    }

    if(b==0)
    {
        if(a>12) PF("NA\n");
        else PF("MMYY\n");
        return 0;
    }

    if(a<13 and b<13)
    {
        PF("AMBIGUOUS\n");
        return 0;
    }

    if(a>12 and b<=12) PF("YYMM\n");
    else if(a<=12 and b>12) PF("MMYY\n");
    else PF("NA\n");

    return 0;
}



Measured memory_bytes: 256