"use strict";
function main(input) {
  const checkM = num => {
    if (1 <= num && num <= 12) {
      return true;
    } else {
      return false;
    }
  };

  const checkY = num => {
    if (0 <= num && num <= 99) {
      return true;
    } else {
      return false;
    }
  };

  const args = input.split("\n");
  const S = args[0];

  const first = parseInt(S.slice(0, 2));
  const second = parseInt(S.slice(2, 4));

  let firstIsM = checkM(first);
  let firstIsY = checkY(first);

  let secondIsM = checkM(second);
  let secondIsY = checkY(second);

  if (firstIsY && secondIsM && (firstIsM && secondIsY)) {
    console.log("AMBIGUOUS");
  } else if (firstIsY && secondIsM) {
    console.log("YYMM");
  } else if (firstIsM && secondIsY) {
    console.log("MMYY");
  } else {
    console.log("NA");
  }
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));
