arg    = gets.chomp
first  = arg[0.. 1].to_i
second = arg[2..3].to_i

if 1 <= first && first <= 12 then
  if 1 <= second && second <= 12 then
    print "AMBIGUOUS"
  else
    print "MMYY"
  end
else
  if 1 <= second && second <= 12 then
    print "YYMM"
  else
    print "NA"
  end
end