import sys
A=int(sys.stdin.readline(2))
D=int(sys.stdin.readline(2))
if A>=1 and A<=12:
	if D>=1 and D<=12:
		print("AMBIGUOUS")
	else:
		print("MMYY")
elif D>=1 and D<=12:
	print("YYMM")
else:
	print("NA") import sys sys A=int(sys.stdin.readline(2)) A int(sys.stdin.readline(2)) int sys.stdin.readline(2) sys.stdin.readline sys.stdin sys stdin readline 2 D=int(sys.stdin.readline(2)) D int(sys.stdin.readline(2)) int sys.stdin.readline(2) sys.stdin.readline sys.stdin sys stdin readline 2 if A>=1 and A<=12:
	if D>=1 and D<=12:
		print("AMBIGUOUS")
	else:
		print("MMYY")
elif D>=1 and D<=12:
	print("YYMM")
else:
	print("NA") A>=1 and A<=12 A>=1 A 1 A<=12 A 12 if D>=1 and D<=12:
		print("AMBIGUOUS")
	else:
		print("MMYY") D>=1 and D<=12 D>=1 D 1 D<=12 D 12 print("AMBIGUOUS") print "AMBIGUOUS" print("MMYY") print "MMYY" elif D>=1 and D<=12:
	print("YYMM") D>=1 and D<=12 D>=1 D 1 D<=12 D 12 print("YYMM") print "YYMM" print("NA") print "NA" D=int(sys.stdin.readline(2)) int(sys.stdin.readline(2)) D A=int(sys.stdin.readline(2)) int(sys.stdin.readline(2)) A
import sys
A=int(sys.stdin.readline(2))
D=int(sys.stdin.readline(2))
if A>=1 and A<=12:
	if D>=1 and D<=12:
		print("AMBIGUOUS")
	else:
		print("MMYY")
elif D>=1 and D<=12:
	print("YYMM")
else:
	print("NA")