S = input()
sform = int(S[:2])
slatt = int(S[2:])

if sform <= 12 and sform >= 1:
    if slatt <= 12 and slatt >= 1:
        print('AMBIGUOUS')
    else:
        print('MMYY')

else:
    if slatt <= 12 and slatt >= 1:
        print('YYMM')
    else:
        print('NA') S = input() S input() input sform = int(S[:2]) sform int(S[:2]) int S[:2] S :2 2 slatt = int(S[2:]) slatt int(S[2:]) int S[2:] S 2: 2 if sform <= 12 and sform >= 1:
    if slatt <= 12 and slatt >= 1:
        print('AMBIGUOUS')
    else:
        print('MMYY')

else:
    if slatt <= 12 and slatt >= 1:
        print('YYMM')
    else:
        print('NA') sform <= 12 and sform >= 1 sform <= 12 sform 12 sform >= 1 sform 1 if slatt <= 12 and slatt >= 1:
        print('AMBIGUOUS')
    else:
        print('MMYY') slatt <= 12 and slatt >= 1 slatt <= 12 slatt 12 slatt >= 1 slatt 1 print('AMBIGUOUS') print 'AMBIGUOUS' print('MMYY') print 'MMYY' if slatt <= 12 and slatt >= 1:
        print('YYMM')
    else:
        print('NA') slatt <= 12 and slatt >= 1 slatt <= 12 slatt 12 slatt >= 1 slatt 1 print('YYMM') print 'YYMM' print('NA') print 'NA' sform = int(S[:2]) int(S[:2]) sform S = input() input() S slatt = int(S[2:]) int(S[2:]) slatt
S = input()
sform = int(S[:2])
slatt = int(S[2:])

if sform <= 12 and sform >= 1:
    if slatt <= 12 and slatt >= 1:
        print('AMBIGUOUS')
    else:
        print('MMYY')

else:
    if slatt <= 12 and slatt >= 1:
        print('YYMM')
    else:
        print('NA')