S=gets.chomp
a=S[0..1].to_i
b=S[2..3].to_i

if a == 0 || b == 0
    puts 'NA'
elsif a <= 12 && b <= 12
    puts 'AMBIGUOUS'
elsif a <= 12 && b > 12
    puts 'MMYY'
elsif a > 12 && b <= 12
     puts 'YYMM'
else
    puts 'NA'
end
