S=input()
mmyy=1<=int(S[:2])<=12
yymm=1<=int(S[2:])<=12
l=[['AMBIGUOUS','MMYY'],['YYMM','NA']]
print(l[not mmyy][not yymm]) S=input() S input() input mmyy=1<=int(S[:2])<=12 mmyy 1<=int(S[:2])<=12 1<=int(S[:2]) 1 int(S[:2]) int S[:2] S :2 2 12 yymm=1<=int(S[2:])<=12 yymm 1<=int(S[2:])<=12 1<=int(S[2:]) 1 int(S[2:]) int S[2:] S 2: 2 12 l=[['AMBIGUOUS','MMYY'],['YYMM','NA']] l [['AMBIGUOUS','MMYY'],['YYMM','NA']] ['AMBIGUOUS','MMYY'] 'AMBIGUOUS' 'MMYY' ['YYMM','NA'] 'YYMM' 'NA' print(l[not mmyy][not yymm]) print l[not mmyy][not yymm] [not mmyy] l not mmyy mmyy not yymm yymm yymm=1<=int(S[2:])<=12 1<=int(S[2:])<=12 yymm l=[['AMBIGUOUS','MMYY'],['YYMM','NA']] [['AMBIGUOUS','MMYY'],['YYMM','NA']] l mmyy=1<=int(S[:2])<=12 1<=int(S[:2])<=12 mmyy S=input() input() S
S=input()
mmyy=1<=int(S[:2])<=12
yymm=1<=int(S[2:])<=12
l=[['AMBIGUOUS','MMYY'],['YYMM','NA']]
print(l[not mmyy][not yymm])