
gets =~ /(\d{2})(\d{2})/
a, b = $~.captures.map{ |s| (1..12).cover?(s.to_i) ? 'MM' : 'YY' }

result = if a == b
  if a == 'YY'
    'NA'
  else
    'AMBIGUOUS'
  end
else
  "#{a}#{b}"
end

puts result
