s = $stdin.read.to_i

zenhan = s / 100
kouhan = s % 100


tuki = nil
if zenhan <=  12 && zenhan > 0
  tuki = true
end

if kouhan <= 12 && kouhan > 0
  if tuki
    puts "AMBIGUOUS"
    exit
  else
    puts "YYMM"
    exit
  end
end

if tuki
  puts "MMYY"
else
  puts "NA"
end

