#include<iostream>
using namespace std;
int main() {
  int s;
  cin >> s;
  int a = s / 100;
  int b = s % 100;
  if(a>12 || a<1){
    if(b>12 || b<1){
      cout << "NA";
    }else{
      cout << "YYMM";
    }
  }else{
    if(b>12 || b<1){
      cout << "MMYY";
    }else{
      cout << "AMBIGUOUS";
    }
  }
}