"use strict";

!function () {
  !function (input) {
    var S = input.split("\n")[0];
    var fst = parseInt(S.slice(0, 2), 10);
    var snd = parseInt(S.slice(2), 10);
    var isYYMM = 1 <= snd && snd <= 12;
    var isMMYY = 1 <= fst && fst <= 12;
    if (isYYMM && isMMYY) console.log("AMBIGUOUS");else if (isYYMM) console.log("YYMM");else if (isMMYY) console.log("MMYY");else console.log("NA");
  }(require("fs").readFileSync("/dev/stdin", "utf8"));
}();
