s = gets.chomp
u = s[0, 2].to_i
d = s[2, 2].to_i
def maybe_month(m)
  1 <= m && m <= 12
end
result = ''
if maybe_month(u) && maybe_month(d)
  result = 'AMBIGUOUS'
elsif maybe_month(u)
  result= 'MMYY'
elsif maybe_month(d)
  result = 'YYMM'
else
  result = 'NA'
end

puts result
