S=input().strip()
a=int(S[:2])
b=int(S[2:])
aa = a < 13 and a != 0
bb = b < 13 and b != 0

if aa and bb:
    ans = 'AMBIGUOUS'
elif aa and not bb:
    ans = 'MMYY'
elif bb and not aa:
    ans = 'YYMM'
else:
    ans = 'NA'
print(ans) S=input().strip() S input().strip() ().strip () input strip a=int(S[:2]) a int(S[:2]) int S[:2] S :2 2 b=int(S[2:]) b int(S[2:]) int S[2:] S 2: 2 aa = a < 13 and a != 0 aa a < 13 and a != 0 a < 13 a 13 a != 0 a 0 bb = b < 13 and b != 0 bb b < 13 and b != 0 b < 13 b 13 b != 0 b 0 if aa and bb:
    ans = 'AMBIGUOUS'
elif aa and not bb:
    ans = 'MMYY'
elif bb and not aa:
    ans = 'YYMM'
else:
    ans = 'NA' aa and bb aa bb ans = 'AMBIGUOUS' ans 'AMBIGUOUS' elif aa and not bb:
    ans = 'MMYY' aa and not bb aa not bb bb ans = 'MMYY' ans 'MMYY' elif bb and not aa:
    ans = 'YYMM' bb and not aa bb not aa aa ans = 'YYMM' ans 'YYMM' ans = 'NA' ans 'NA' print(ans) print ans bb = b < 13 and b != 0 b < 13 and b != 0 bb a=int(S[:2]) int(S[:2]) a ans = 'NA' 'NA' ans aa = a < 13 and a != 0 a < 13 and a != 0 aa ans = 'AMBIGUOUS' 'AMBIGUOUS' ans b=int(S[2:]) int(S[2:]) b ans = 'MMYY' 'MMYY' ans ans = 'YYMM' 'YYMM' ans S=input().strip() input().strip() S
S=input().strip()
a=int(S[:2])
b=int(S[2:])
aa = a < 13 and a != 0
bb = b < 13 and b != 0

if aa and bb:
    ans = 'AMBIGUOUS'
elif aa and not bb:
    ans = 'MMYY'
elif bb and not aa:
    ans = 'YYMM'
else:
    ans = 'NA'
print(ans)
