def f(y, m):
	if y in range(1, 13) and m in range(1, 13):
		return "AMBIGUOUS"
	if m in range(1, 13):
		return "YYMM"
	if y in range(1, 13):
		return "MMYY"
	return "NA"
  
S = input()
y, m = int(S[:2]), int(S[2:])
print(f(y, m))
   def f(y, m):
	if y in range(1, 13) and m in range(1, 13):
		return "AMBIGUOUS"
	if m in range(1, 13):
		return "YYMM"
	if y in range(1, 13):
		return "MMYY"
	return "NA"
   f if y in range(1, 13) and m in range(1, 13):
		return "AMBIGUOUS"
	 y in range(1, 13) and m in range(1, 13) y in range(1, 13) y range(1, 13) range 1 13 m in range(1, 13) m range(1, 13) range 1 13 return "AMBIGUOUS" "AMBIGUOUS" if m in range(1, 13):
		return "YYMM"
	 m in range(1, 13) m range(1, 13) range 1 13 return "YYMM" "YYMM" if y in range(1, 13):
		return "MMYY"
	 y in range(1, 13) y range(1, 13) range 1 13 return "MMYY" "MMYY" return "NA" "NA" y y m m S = input() S input() input y, m = int(S[:2]), int(S[2:]) y int(S[:2]) int S[:2] S :2 2 m int(S[2:]) int S[2:] S 2: 2 print(f(y, m)) print f(y, m) f y m S = input() input() S y, m = int(S[:2]), int(S[2:]) int(S[:2]) y def f(y, m):
	if y in range(1, 13) and m in range(1, 13):
		return "AMBIGUOUS"
	if m in range(1, 13):
		return "YYMM"
	if y in range(1, 13):
		return "MMYY"
	return "NA"
   def f(y, m):
	if y in range(1, 13) and m in range(1, 13):
		return "AMBIGUOUS"
	if m in range(1, 13):
		return "YYMM"
	if y in range(1, 13):
		return "MMYY"
	return "NA"
   f m = int(S[:2]), int(S[2:]) int(S[2:]) m
def f(y, m):
	if y in range(1, 13) and m in range(1, 13):
		return "AMBIGUOUS"
	if m in range(1, 13):
		return "YYMM"
	if y in range(1, 13):
		return "MMYY"
	return "NA"
  
S = input()
y, m = int(S[:2]), int(S[2:])
print(f(y, m))
  
