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