class Integer
  def month?;
    1 <= self && self <= 12
  end
end

s = gets.to_s.to_i

t = s / 100
u = s % 100

if t.month? && u.month?
  puts "AMBIGUOUS"
elsif u.month?
  puts "YYMM"
elsif t.month?
  puts "MMYY"
else
  puts "NA"
end