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

int main() {
  int s,a,b,count=0;
  cin >> s;
  a = s/100;
  b = s%100;
  vector<string> ans{"NA","MMYY","YYMM","AMBIGUOUS"};
  if(1 <= a && a <= 12) count += 1;
  if(1 <= b && b <= 12) count += 2;
  cout << ans[count] << endl;
}