S = gets.chomp
f_yymm = false
f_mmyy = false
case S[0..1]
when '01','02','03','04','05','06','07','08','09','10','11','12'
    f_mmyy = true
end
case S[2..3]
when '01','02','03','04','05','06','07','08','09','10','11','12'
    f_yymm = true
end
if f_yymm && f_mmyy then
    puts 'AMBIGUOUS'
elsif f_yymm then
    puts 'YYMM'
elsif f_mmyy then
    puts 'MMYY'
else
    puts 'NA'
end