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