s = gets.chomp!

head = s[0, 2].to_i
tail = s[2, 2].to_i

case head
when 0
    head_mm = 0
when 1..12
    head_mm = 1
when 13..99
    head_mm = 2
end

case tail
when 0
    tail_mm = 0
when 1..12
    tail_mm = 1
when 13..99
    tail_mm = 2
end

if head_mm == 0 || tail_mm == 0
    puts "NA"
elsif head_mm == 1 && tail_mm == 1
    puts "AMBIGUOUS"
elsif head_mm == 1 && tail_mm == 2
    puts "MMYY"
elsif head_mm == 2 && tail_mm == 1
    puts "YYMM"
else
    puts "NA"
end
