S=input()
s1,s2=int(S[:2]),int(S[2:])
if 1<=s1<=12 and 1<=s2<=12:print('AMBIGUOUS')
elif 1<=s1<=12:print('MMYY')
elif 1<=s2<=12:print('YYMM')
else:print('NA') S=input() S input() input s1,s2=int(S[:2]),int(S[2:]) s1 int(S[:2]) int S[:2] S :2 2 s2 int(S[2:]) int S[2:] S 2: 2 if 1<=s1<=12 and 1<=s2<=12:print('AMBIGUOUS')
elif 1<=s1<=12:print('MMYY')
elif 1<=s2<=12:print('YYMM')
else:print('NA') 1<=s1<=12 and 1<=s2<=12 1<=s1<=12 1<=s1 1 s1 12 1<=s2<=12 1<=s2 1 s2 12 elif 1<=s1<=12:print('MMYY') 1<=s1<=12 1<=s1 1 s1 12 elif 1<=s2<=12:print('YYMM') 1<=s2<=12 1<=s2 1 s2 12 s2=int(S[:2]),int(S[2:]) int(S[2:]) s2 S=input() input() S s1,s2=int(S[:2]),int(S[2:]) int(S[:2]) s1
S=input()
s1,s2=int(S[:2]),int(S[2:])
if 1<=s1<=12 and 1<=s2<=12:print('AMBIGUOUS')
elif 1<=s1<=12:print('MMYY')
elif 1<=s2<=12:print('YYMM')
else:print('NA')