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