"use strict"

const arg_str = require('fs').readFileSync('/dev/stdin', 'UTF-8')
const target_str = arg_str

let return_val = ''
let head_str = target_str.slice(0, 2)
let head_int = parseInt(head_str)
let tail_str = target_str.slice(2, 4)
let tail_int = parseInt(tail_str)
let head_status = 0 // 0:MでもYでもない
let tail_status = 0 // 0:MでもYでもない

if(0 < head_int && head_int <= 12){
  head_status = 1 // Mの可能性もあるしYの可能性もある
}
if(0 < tail_int && tail_int <= 12){
  tail_status = 1 // Mの可能性もあるしYの可能性もある
}

if(head_status == 1 && tail_status == 1){
  return_val = 'AMBIGUOUS'
}else if(head_status == 0 && tail_status == 1){
  return_val = 'YYMM'
}else if(head_status == 1 && tail_status == 0){
  return_val = 'MMYY'
}else{
  return_val = 'NA'
}

console.log(return_val)