s = gets.chomp
d1 = s[0,2].to_i
d2 = s[2,2].to_i
if (1..12).include?(d1) && (1..12).include?(d2)
  puts 'AMBIGUOUS'
elsif (1..12).include?(d1)
  puts 'MMYY'
elsif (1..12).include?(d2)
  puts 'YYMM'
else
  puts 'NA'
end
