"use strict";

const readData = input => {
  return {
    former: parseInt(input.substr(0, 2)),
    latter: parseInt(input.substr(2, 2))
  };
};

const mayBeMonth = n => n >= 1 && n <= 12;

const getType = data => {
  if (mayBeMonth(data.former)) {
    if (mayBeMonth(data.latter)) return "AMBIGUOUS";
    else return "MMYY";
  } else {
    if (mayBeMonth(data.latter)) return "YYMM";
    else return "NA";
  }
};

function Main(input) {
  let data = readData(input);
  console.log(getType(data));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));