S = gets.chomp
head = S[0..1].to_i
tail = S[2..3].to_i

if head < 1 or tail < 1
  ans = 'NA'
elsif head > 12 and tail > 12
  ans = 'NA'
else
  if head <= 12
    if tail <= 12
      ans = 'AMBIGUOUS'
    else
      ans = 'MMYY'
    end
  else
    ans = 'YYMM' if tail <= 12
  end
end

puts ans