S = input()

first = int(S[0:2])
last = int(S[2:4])

if (0 < first < 13):
	if (0 < last < 13):
		print("AMBIGUOUS")
	else:
		print("MMYY")
else:
	if (0 < last < 13):
		print("YYMM")
	else:
		print("NA") S = input() S input() input first = int(S[0:2]) first int(S[0:2]) int S[0:2] S 0:2 0 2 last = int(S[2:4]) last int(S[2:4]) int S[2:4] S 2:4 2 4 if (0 < first < 13):
	if (0 < last < 13):
		print("AMBIGUOUS")
	else:
		print("MMYY")
else:
	if (0 < last < 13):
		print("YYMM")
	else:
		print("NA") 0 < first < 13 0 < first 0 first 13 if (0 < last < 13):
		print("AMBIGUOUS")
	else:
		print("MMYY") 0 < last < 13 0 < last 0 last 13 print("AMBIGUOUS") print "AMBIGUOUS" print("MMYY") print "MMYY" if (0 < last < 13):
		print("YYMM")
	else:
		print("NA") 0 < last < 13 0 < last 0 last 13 print("YYMM") print "YYMM" print("NA") print "NA" last = int(S[2:4]) int(S[2:4]) last first = int(S[0:2]) int(S[0:2]) first S = input() input() S
S = input()

first = int(S[0:2])
last = int(S[2:4])

if (0 < first < 13):
	if (0 < last < 13):
		print("AMBIGUOUS")
	else:
		print("MMYY")
else:
	if (0 < last < 13):
		print("YYMM")
	else:
		print("NA")