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