str = gets.chomp!

if /(\d\d)(\d\d)/ =~ str
   fron = $1.to_i
   back = $2.to_i
end


if fron > 12
  if back > 12 || back == 0
    puts "NA"
  elsif back <= 12 && back >= 1
    puts "YYMM"
  end
elsif fron <= 12 && fron >= 1
  if back > 12 || back == 0
    puts "MMYY"
  elsif back <= 12 && back >= 1
    puts "AMBIGUOUS"
  end
elsif fron == 0
  if back <= 12 && back >= 1
     puts "YYMM"
  else
     puts "NA"
  end
end