s = gets.chomp.to_s
n = 2
x = s.scan(/.{1,#{n}}/)

if s.include?("00")
    puts 'NA'
elsif x[0].to_i >= 1 && x[0].to_i <= 12 
    puts 'YYMM'
elsif x[1].to_i >= 1 && x[1].to_i <= 12
    puts 'MMYY'
else puts 'AMBIGUOUS'
end