#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
template <typename T1>
void print(vector<T1> arr) {
  int l = (int)arr.size();
  cerr << "[";
  for (int i = 0; i < l; i++) {
    (i == l - 1) ? cerr << arr[i] : cerr << arr[i] << ",";
  }
  cerr << "]"
       << "\n";
}
template <typename T1>
void printArr(int arr[], int l) {
  cerr << "[";
  for (int i = 0; i < (int)l; i++) {
    (i == l - 1) ? cerr << arr[i] : cerr << arr[i] << ",";
  }
  cerr << "]"
       << "\n";
}
template <typename T1>
void console(vector<vector<T1>> arr) {
  for (int i = 0; i < (int)arr.size(); ++i) {
    cerr << "\n"
         << " [";
    for (int j = 0; j < (int)arr[i].size(); ++j) {
      (j == (int)arr[i].size() - 1) ? cerr << arr[i][j]
                                    : cerr << arr[i][j] << ",";
    }
    cerr << "]";
  }
  cerr << "\n";
}
template <typename T1, typename T2>
void mapped(map<T1, T2> m) {
  for (auto ite = m.begin(); ite != m.end(); ++ite) {
    cerr << "'" << ite->first << "'"
         << " : " << ite->second << "\n";
  }
}
template <typename T1, typename T2>
void mappedArr(map<T1, vector<T2>> m) {
  for (auto ity = m.begin(); ity != m.end(); ++ity) {
    cerr << "'" << ity->first << "'"
         << " : "
         << "[";
    for (int i = 0; i < (int)ity->second.size(); ++i) {
      (i == (int)ity->second.size() - 1) ? cerr << ity->second[i]
                                         : cerr << ity->second[i] << ",";
    }
    cerr << "]"
         << "\n";
  }
}
string int_to_string(int x) {
  stringstream ss;
  ss << x;
  string ni = ss.str();
  return ni;
}
int char_to_int(char c) {
  int n = (int)c - 48;
  return n;
}
int string_to_int(string x) {
  int n;
  stringstream s(x);
  s >> n;
  return n;
}
template <typename T1, typename T2>
void vectPair(vector<pair<T1, T2>> vp) {
  for (int arrp = 0; arrp < (int)vp.size(); ++arrp) {
    cerr << "(" << vp[arrp].first << "," << vp[arrp].second << ")"
         << "\n";
  }
}
long long power(long long a, long long n) {
  long long ans = 1;
  for (long long i = 0; pow(2, i) <= n; ++i) {
    if ((n >> i) & 1) {
      ans *= a;
    }
    a = a * a;
  }
  return ans;
}
void inverse(vector<long long>& v, long long w, long long p) {
  v[1] = 1;
  for (long long i = 2; i < w; ++i) {
    v[i] = (p - (p / i) * v[p % i] % p) % p;
  }
}
long long __gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return __gcd(b, a % b);
}
long long lcm(long long a, long long b) {
  long long ans = a * b / __gcd(a, b);
  return ans;
}
const long long INF = 1e18L + 5;
const int MOD = 1e9 + 7;
string c_str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string s_str = "abcdefghijklmnopqrstuvwxyz";
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  string s;
  cin >> s;
  int a = (s[0] - '0') * 10 + (s[1] - '0');
  int b = (s[2] - '0') * 10 + (s[3] - '0');
  if ((a > 12 && b > 12) || (a == 0 || b == 0)) {
    cout << "NA";
  } else if (a <= 12 && b <= 12) {
    cout << "AMBIGUOUS";
  } else if (a > 12) {
    cout << "YYMM";
  } else {
    cout << "MMYY";
  }
  return 0;
}
