s=input()
a=int(s[:2])
b=int(s[2:])
if (a > 12 or a == 0) and (b > 12 or b == 0):
	print("NA")
elif a > 12 or a == 0:
	print("YYMM")
elif b > 12 or b == 0:
	print("MMYY")
else: print("AMBIGUOUS") s=input() s input() input a=int(s[:2]) a int(s[:2]) int s[:2] s :2 2 b=int(s[2:]) b int(s[2:]) int s[2:] s 2: 2 if (a > 12 or a == 0) and (b > 12 or b == 0):
	print("NA")
elif a > 12 or a == 0:
	print("YYMM")
elif b > 12 or b == 0:
	print("MMYY")
else: print("AMBIGUOUS") (a > 12 or a == 0) and (b > 12 or b == 0) a > 12 or a == 0 a > 12 a 12 a == 0 a 0 b > 12 or b == 0 b > 12 b 12 b == 0 b 0 print("NA") print "NA" elif a > 12 or a == 0:
	print("YYMM") a > 12 or a == 0 a > 12 a 12 a == 0 a 0 print("YYMM") print "YYMM" elif b > 12 or b == 0:
	print("MMYY") b > 12 or b == 0 b > 12 b 12 b == 0 b 0 print("MMYY") print "MMYY" s=input() input() s b=int(s[2:]) int(s[2:]) b a=int(s[:2]) int(s[:2]) a
s=input()
a=int(s[:2])
b=int(s[2:])
if (a > 12 or a == 0) and (b > 12 or b == 0):
	print("NA")
elif a > 12 or a == 0:
	print("YYMM")
elif b > 12 or b == 0:
	print("MMYY")
else: print("AMBIGUOUS")