s = input()
months = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
if s[:2] in months and s[2:] in months:
	print("AMBIGUOUS")
elif s[:2] in months and s[2:] not in months:
	print("MMYY")
elif s[:2] not in months and s[2:] in months:
	print("YYMM")
else:
	print("NA") s = input() s input() input months = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'] months ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'] '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' if s[:2] in months and s[2:] in months:
	print("AMBIGUOUS")
elif s[:2] in months and s[2:] not in months:
	print("MMYY")
elif s[:2] not in months and s[2:] in months:
	print("YYMM")
else:
	print("NA") s[:2] in months and s[2:] in months s[:2] in months s[:2] s :2 2 months s[2:] in months s[2:] s 2: 2 months print("AMBIGUOUS") print "AMBIGUOUS" elif s[:2] in months and s[2:] not in months:
	print("MMYY") s[:2] in months and s[2:] not in months s[:2] in months s[:2] s :2 2 months s[2:] not in months s[2:] s 2: 2 months print("MMYY") print "MMYY" elif s[:2] not in months and s[2:] in months:
	print("YYMM") s[:2] not in months and s[2:] in months s[:2] not in months s[:2] s :2 2 months s[2:] in months s[2:] s 2: 2 months print("YYMM") print "YYMM" print("NA") print "NA" months = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'] ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'] months s = input() input() s
s = input()
months = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
if s[:2] in months and s[2:] in months:
	print("AMBIGUOUS")
elif s[:2] in months and s[2:] not in months:
	print("MMYY")
elif s[:2] not in months and s[2:] in months:
	print("YYMM")
else:
	print("NA")