s = STDIN.gets.chomp

splits = s.scan(/.{1,2}/)

yy_mm = true
mm_yy = true

if splits[0].to_i > 12
  mm_yy = false
elsif splits[0].to_i == 0
  mm_yy = false
end

if splits[1].to_i  > 12
  yy_mm = false
elsif splits[1].to_i == 0
  yy_mm = false
end


result = if yy_mm
           if mm_yy
             "AMBIGUOUS"
           else
             "YYMM"
           end

         else
           if mm_yy
             "MMYY"
           else
             "NA"
           end
         end

puts result