S = gets.strip
f = S[0..1].to_i
b = S[2..3].to_i
r = 'NA'
r = 'AMBIGUOUS' if (0 < f && f <= 12) && (0 < b && b <= 12)
r = 'YYMM' if f > 12 && (0 < b && b <= 12)
r = 'MMYY' if (0 < f && f <= 12) && b > 12
puts r