s = readline.chomp
i1 = s[0..1].to_i
i2 = s[2..3].to_i
if i1 >= 1 and i1 <= 12
  if i2 >= 1 and i2 <= 12
    puts 'AMBIGUOUS'
  else
    puts 'MMYY'
  end
else
  if i2 >= 1 and i2 <= 12
    puts 'YYMM'
  else
    puts 'NA'
  end
end

