#include <iostream>
using namespace std;


int main(){
    int s, f, b;
    cin >> s;
    f = s/100;
    b = s%100;
    if (b > 0 && b < 13 && f > 0 && f < 13) cout <<"AMBIGUOUS";
    else if (b > 0 && b < 13) cout << "YYMM";
    else if (f > 0 && f < 13) cout << "MMYY";
    else cout << "NA";
}