S = gets.chomp
x = S[0..1].to_i
y = S[2..3].to_i
# p x
# p y
if (1 <= x) && (x <= 12) && (1 <= y) && (y <= 12) then
  puts 'AMBIGUOUS'  
elsif (1 <= x) && (x <= 12) then
  puts 'MMYY'
elsif (1 <= y) && (y <= 12) then
  puts 'YYMM'
else
  puts 'NA'
end