S = gets.chomp

A = S.chars.take(2).join.to_i
B = S.chars.drop(2).join.to_i

Month = [*1..12]

ans = if Month.include?(A) and Month.include?(B) then
          "AMBIGUOUS"
      elsif Month.include?(A) and (not Month.include?(B)) then
          "MMYY"
      elsif (not Month.include?(A)) and Month.include?(B) then
          "YYMM"
      else
          "NA"
      end

puts ans

