s = gets.chomp
a = s[0,2].to_i
b = s[2,2].to_i
f = g = false
f = true if b <= 12 && b > 0
g = true if a <= 12 && a > 0
if f && g
    puts "AMBIGUOUS"
elsif f
    puts "YYMM"
elsif g
    puts "MMYY"
else
    puts "NA"
end