function Main(input) {
  "use strict";
	const lines = input.split("\n");
  let S = lines[0]
  let L = Number.parseInt(S.substring(0,2))
  let R = Number.parseInt(S.substring(2))
  if (0 < L && L <= 12 && 0 < R && R <= 12) {
    console.log("AMBIGUOUS")
    return;
  }
  if ((L > 12 || L === 0) && (R > 12 || R === 0)) {
    console.log("NA")
    return;
  }
  if (L <= 12 && ( R > 12 || R === 0)) {
    console.log("MMYY")
    return;
  }
  console.log("YYMM")



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