S = input()
S1, S2 = S[0:2], S[2:5]
if (int(S1) >= 1 and int(S1) <=12) and (int(S2) >= 1 and int(S2) <=12):
	print('AMBIGUOUS')
elif int(S2) >= 1 and int(S2) <= 12:
	print('YYMM')
elif int(S1) >= 1 and int(S1) <=12:
	print('MMYY')
else:
	print('NA')
 S = input() S input() input S1, S2 = S[0:2], S[2:5] S1 S[0:2] S 0:2 0 2 S2 S[2:5] S 2:5 2 5 if (int(S1) >= 1 and int(S1) <=12) and (int(S2) >= 1 and int(S2) <=12):
	print('AMBIGUOUS')
elif int(S2) >= 1 and int(S2) <= 12:
	print('YYMM')
elif int(S1) >= 1 and int(S1) <=12:
	print('MMYY')
else:
	print('NA') (int(S1) >= 1 and int(S1) <=12) and (int(S2) >= 1 and int(S2) <=12) int(S1) >= 1 and int(S1) <=12 int(S1) >= 1 int(S1) int S1 1 int(S1) <=12 int(S1) int S1 12 int(S2) >= 1 and int(S2) <=12 int(S2) >= 1 int(S2) int S2 1 int(S2) <=12 int(S2) int S2 12 print('AMBIGUOUS') print 'AMBIGUOUS' elif int(S2) >= 1 and int(S2) <= 12:
	print('YYMM') int(S2) >= 1 and int(S2) <= 12 int(S2) >= 1 int(S2) int S2 1 int(S2) <= 12 int(S2) int S2 12 print('YYMM') print 'YYMM' elif int(S1) >= 1 and int(S1) <=12:
	print('MMYY') int(S1) >= 1 and int(S1) <=12 int(S1) >= 1 int(S1) int S1 1 int(S1) <=12 int(S1) int S1 12 print('MMYY') print 'MMYY' print('NA') print 'NA' S2 = S[0:2], S[2:5] S[2:5] S2 S = input() input() S S1, S2 = S[0:2], S[2:5] S[0:2] S1
S = input()
S1, S2 = S[0:2], S[2:5]
if (int(S1) >= 1 and int(S1) <=12) and (int(S2) >= 1 and int(S2) <=12):
	print('AMBIGUOUS')
elif int(S2) >= 1 and int(S2) <= 12:
	print('YYMM')
elif int(S1) >= 1 and int(S1) <=12:
	print('MMYY')
else:
	print('NA')

