input = gets.chomp.scan(/.{1,#{2}}/).map(&:to_i)
if input[0] > 12 then
  a = 1
else
  if input[0] == 0 then
    a = 1
  else
    a = 0
  end
end
if input[1] > 12 then
  b = 1
else
  if input[1] == 0 then
    b = 1
  else
    b = 0
  end
end
if a == 1 then
  if b == 1 then
    print "NA"
  else
    print "YYMM"
  end
else
  if b == 1 then
    print "MMYY"
  else
    print "AMBIGUOUS"
  end
end