S = gets.chomp

f = S[0..1].to_i
s = S[2..3].to_i

def isMonth(m)
  0 < m && m < 13
end

r = [isMonth(f), isMonth(s)]

ans = ""
case r
when [true, true] then
  ans = "AMBIGUOUS"
when [false, true] then
  ans = "YYMM"
when [true, false] then
  ans = "MMYY"
else
  ans = "NA"
end

printf("#{ans}") 
