 r = gets.split("")
 k = (r[0].to_s+r[1].to_s).to_i
 t = (r[2].to_s+r[3].to_s).to_i
 kk = 0 < k && k <=12
 tt = 0 < t && t <=12
 
 if tt && kk
     puts "AMBIGUOUS"
 elsif tt 
    puts "YYMM"
 elsif kk
    puts "MMYY"
else
    puts "NA"
end