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