S=int(input())
x=S//100
y=S%100
yymm=1<=y<=12
mmyy=1<=x<=12
ans=""
if yymm and mmyy:
    ans="AMBIGUOUS"
elif yymm:
    ans="YYMM"
elif mmyy:
    ans="MMYY"
else:
    ans="NA"
print(ans) S=int(input()) S int(input()) int input() input x=S//100 x S//100 S 100 y=S%100 y S%100 S 100 yymm=1<=y<=12 yymm 1<=y<=12 1<=y 1 y 12 mmyy=1<=x<=12 mmyy 1<=x<=12 1<=x 1 x 12 ans="" ans "" if yymm and mmyy:
    ans="AMBIGUOUS"
elif yymm:
    ans="YYMM"
elif mmyy:
    ans="MMYY"
else:
    ans="NA" yymm and mmyy yymm mmyy ans="AMBIGUOUS" ans "AMBIGUOUS" elif yymm:
    ans="YYMM" yymm ans="YYMM" ans "YYMM" elif mmyy:
    ans="MMYY" mmyy ans="MMYY" ans "MMYY" ans="NA" ans "NA" print(ans) print ans y=S%100 S%100 y ans="" "" ans ans="YYMM" "YYMM" ans ans="AMBIGUOUS" "AMBIGUOUS" ans ans="NA" "NA" ans x=S//100 S//100 x ans="MMYY" "MMYY" ans S=int(input()) int(input()) S mmyy=1<=x<=12 1<=x<=12 mmyy yymm=1<=y<=12 1<=y<=12 yymm
S=int(input())
x=S//100
y=S%100
yymm=1<=y<=12
mmyy=1<=x<=12
ans=""
if yymm and mmyy:
    ans="AMBIGUOUS"
elif yymm:
    ans="YYMM"
elif mmyy:
    ans="MMYY"
else:
    ans="NA"
print(ans)