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