S = input()

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

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