S = gets.chomp

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

ft = false
ft = true if (1 <= first  && first <= 12)

st = false
st = true if (1 <= second  && second <= 12)

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