s = gets.chomp

aa = s[0..1].to_i
bb = s[2..3].to_i

a_ism = (0 < aa && aa <= 12)
b_ism = (0 < bb && bb <= 12)

if a_ism && b_ism
  puts "AMBIGUOUS"
elsif a_ism && !b_ism
  puts "MMYY"
elsif !a_ism && b_ism
  puts "YYMM"
else
  puts "NA"
end
