S = input()
l,r = int(S[:2]),int(S[2:])
if 1 <= l <= 12 and 1 <= r <= 12:
	print("AMBIGUOUS")
elif 1<=r<=12:
	print("YYMM")
elif 1<=l<=12:
	print("MMYY")
else:
	print("NA") S = input() S input() input l,r = int(S[:2]),int(S[2:]) l int(S[:2]) int S[:2] S :2 2 r int(S[2:]) int S[2:] S 2: 2 if 1 <= l <= 12 and 1 <= r <= 12:
	print("AMBIGUOUS")
elif 1<=r<=12:
	print("YYMM")
elif 1<=l<=12:
	print("MMYY")
else:
	print("NA") 1 <= l <= 12 and 1 <= r <= 12 1 <= l <= 12 1 <= l 1 l 12 1 <= r <= 12 1 <= r 1 r 12 print("AMBIGUOUS") print "AMBIGUOUS" elif 1<=r<=12:
	print("YYMM") 1<=r<=12 1<=r 1 r 12 print("YYMM") print "YYMM" elif 1<=l<=12:
	print("MMYY") 1<=l<=12 1<=l 1 l 12 print("MMYY") print "MMYY" print("NA") print "NA" l,r = int(S[:2]),int(S[2:]) int(S[:2]) l r = int(S[:2]),int(S[2:]) int(S[2:]) r S = input() input() S
S = input()
l,r = int(S[:2]),int(S[2:])
if 1 <= l <= 12 and 1 <= r <= 12:
	print("AMBIGUOUS")
elif 1<=r<=12:
	print("YYMM")
elif 1<=l<=12:
	print("MMYY")
else:
	print("NA")