a,b = gets.each_slice(2).map(&:to_i)
a_status = 
if 1 <= a && a <= 12 
  [:yymm, :mmyy]
elsif 12 < a && a <= 99
  [:yymm]
else
  [:na]
end
 
b_status = 
if 1 <= b && b <= 12 
  [:yymm, :mmyy]
elsif 12 < b && b <= 99
  [:mmyy]
else
  [:na]
end
 
intersection = a_status & b_status
 
result = 
if intersection.length == 1
  intersection.first
elsif intersection.length == 2
  :ambiguous
else
  :na
end
 
puts result.to_s.upcase