S = input()
n1 = int(S[:2])
n2 = int(S[2:])

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

if 1 <= n1 <= 12 and 1 <= n2 <= 12:
    print('AMBIGUOUS')
elif 1 <= n1 <= 12 and (not 1 <= n2 <= 12):
    print('MMYY')
elif (not 1 <= n1 <= 12) and 1 <= n2 <= 12:
    print('YYMM')
else:
    print('NA')
