n = gets.chomp
x = n.chars
for i in 0..x.length-1
    x[i]=x[i].to_i
end
#p x
a = x[0]*10+x[1]
b = x[2]*10+x[3]
#p a
#p b
cnt_a = 0
cnt_b = 0
if a <= 12 && a >= 1
    cnt_a = 1
end
if b <= 12 && b >= 1
    cnt_b = 1
end
#p cnt_a
#p cnt_b
if cnt_a==1&&cnt_b==1
    puts "AMBIGUOUS"
elsif cnt_a==0 &&cnt_b==1
    puts "YYMM"
elsif cnt_a==1&&cnt_b==0
    puts "MMYY"
else
    puts "NA"
end