S = gets.chomp

first = S[0..1].to_i
second = S[2..3].to_i

ft = false
ft = true if 01 <= first  || first <= 12

st = false
st = true if 01 <= second  || second <= 12

return 'AMBIGUOUS' if ft && st
return 'NA' if !ft && !st
return 'MMYY' if ft
return 'YYMM'
