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

int main() {
  int s;
  cin >> s;
  if (100 <= s && s < 1300) {
    if (1 <= (s%100) && (s%100) < 13)
      cout << "AMBIGUOUS";
    else
      cout << "MMYY";
  }
  else {
    if (1 <= (s%100) && (s%100) < 13)
      cout << "YYMM";
    else
      cout << "NA";
  }
}