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

int main(void){
    int s;cin>>s;
    int f=s/100,l=s%=100;
    if(0<f&&f<=12&&0<l&&l<=12)cout<<"AMBIGUOUS\n";
    else if(0<f&&f<=12)cout<<"MMYY\n";
    else if(0<l&&l<=12)cout<<"YYMM\n";
    else cout<<"NA\n";
    
    return 0;
}
