S = input()
if int(S[0: 2]) >= 13 or int(S[0: 2]) == 0:
    if int(S[2: 4]) == 0 or int(S[2: 4]) >= 13:
        print('NA')
    else:
        print('YYMM')
else:
    if int(S[2: 4]) == 0 or int(S[2: 4]) >= 13:
        print('MMYY')
    else:
        print('AMBIGUOUS') S = input() S input() input if int(S[0: 2]) >= 13 or int(S[0: 2]) == 0:
    if int(S[2: 4]) == 0 or int(S[2: 4]) >= 13:
        print('NA')
    else:
        print('YYMM')
else:
    if int(S[2: 4]) == 0 or int(S[2: 4]) >= 13:
        print('MMYY')
    else:
        print('AMBIGUOUS') int(S[0: 2]) >= 13 or int(S[0: 2]) == 0 int(S[0: 2]) >= 13 int(S[0: 2]) int S[0: 2] S 0: 2 0 2 13 int(S[0: 2]) == 0 int(S[0: 2]) int S[0: 2] S 0: 2 0 2 0 if int(S[2: 4]) == 0 or int(S[2: 4]) >= 13:
        print('NA')
    else:
        print('YYMM') int(S[2: 4]) == 0 or int(S[2: 4]) >= 13 int(S[2: 4]) == 0 int(S[2: 4]) int S[2: 4] S 2: 4 2 4 0 int(S[2: 4]) >= 13 int(S[2: 4]) int S[2: 4] S 2: 4 2 4 13 print('NA') print 'NA' print('YYMM') print 'YYMM' if int(S[2: 4]) == 0 or int(S[2: 4]) >= 13:
        print('MMYY')
    else:
        print('AMBIGUOUS') int(S[2: 4]) == 0 or int(S[2: 4]) >= 13 int(S[2: 4]) == 0 int(S[2: 4]) int S[2: 4] S 2: 4 2 4 0 int(S[2: 4]) >= 13 int(S[2: 4]) int S[2: 4] S 2: 4 2 4 13 print('MMYY') print 'MMYY' print('AMBIGUOUS') print 'AMBIGUOUS' S = input() input() S
S = input()
if int(S[0: 2]) >= 13 or int(S[0: 2]) == 0:
    if int(S[2: 4]) == 0 or int(S[2: 4]) >= 13:
        print('NA')
    else:
        print('YYMM')
else:
    if int(S[2: 4]) == 0 or int(S[2: 4]) >= 13:
        print('MMYY')
    else:
        print('AMBIGUOUS')