function Main(input) {
  let first = input.substr(0, 2)
  let last = input.substr(2, 2)
  if (first < 13 && first > 0) {
    if (last < 13 && last > 0) {
      console.log('AMBIGUOUS')
      return
    }
    console.log('MMYY')
  } else if (last < 13 && last > 0) {
    console.log('YYMM')
  } else {
    console.log('NA')
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
