S = input()
f = int(S[:2])
b = int(S[2:])
if (not 0 < f <= 12) and 0 < b <= 12:
    print('YYMM')
elif (not 0 < b <= 12) and 0 < f <= 12:
    print('MMYY')
elif 0 < f <= 12 and 0 < b <= 12:
    print('AMBIGUOUS')
else:
    print('NA') S = input() S input() input f = int(S[:2]) f int(S[:2]) int S[:2] S :2 2 b = int(S[2:]) b int(S[2:]) int S[2:] S 2: 2 if (not 0 < f <= 12) and 0 < b <= 12:
    print('YYMM')
elif (not 0 < b <= 12) and 0 < f <= 12:
    print('MMYY')
elif 0 < f <= 12 and 0 < b <= 12:
    print('AMBIGUOUS')
else:
    print('NA') (not 0 < f <= 12) and 0 < b <= 12 not 0 < f <= 12 0 < f <= 12 0 < f 0 f 12 0 < b <= 12 0 < b 0 b 12 print('YYMM') print 'YYMM' elif (not 0 < b <= 12) and 0 < f <= 12:
    print('MMYY') (not 0 < b <= 12) and 0 < f <= 12 not 0 < b <= 12 0 < b <= 12 0 < b 0 b 12 0 < f <= 12 0 < f 0 f 12 print('MMYY') print 'MMYY' elif 0 < f <= 12 and 0 < b <= 12:
    print('AMBIGUOUS') 0 < f <= 12 and 0 < b <= 12 0 < f <= 12 0 < f 0 f 12 0 < b <= 12 0 < b 0 b 12 print('AMBIGUOUS') print 'AMBIGUOUS' print('NA') print 'NA' f = int(S[:2]) int(S[:2]) f b = int(S[2:]) int(S[2:]) b S = input() input() S
S = input()
f = int(S[:2])
b = int(S[2:])
if (not 0 < f <= 12) and 0 < b <= 12:
    print('YYMM')
elif (not 0 < b <= 12) and 0 < f <= 12:
    print('MMYY')
elif 0 < f <= 12 and 0 < b <= 12:
    print('AMBIGUOUS')
else:
    print('NA')
