S = int(input())

YYMM = 0
MMYY = 0

if S % 100 >= 1 and S % 100 <= 12:
    YYMM = 1

if S // 100 >= 1 and S // 100 <= 12:
    MMYY = 1

if YYMM == 0 and MMYY == 0:
    print('NA')
elif YYMM == 0 and MMYY == 1:
    print('MMYY')
elif YYMM == 1 and MMYY == 0:
    print('YYMM')
else:
    print('AMBIGUOUS') S = int(input()) S int(input()) int input() input YYMM = 0 YYMM 0 MMYY = 0 MMYY 0 if S % 100 >= 1 and S % 100 <= 12:
    YYMM = 1 S % 100 >= 1 and S % 100 <= 12 S % 100 >= 1 S % 100 S 100 1 S % 100 <= 12 S % 100 S 100 12 YYMM = 1 YYMM 1 if S // 100 >= 1 and S // 100 <= 12:
    MMYY = 1 S // 100 >= 1 and S // 100 <= 12 S // 100 >= 1 S // 100 S 100 1 S // 100 <= 12 S // 100 S 100 12 MMYY = 1 MMYY 1 if YYMM == 0 and MMYY == 0:
    print('NA')
elif YYMM == 0 and MMYY == 1:
    print('MMYY')
elif YYMM == 1 and MMYY == 0:
    print('YYMM')
else:
    print('AMBIGUOUS') YYMM == 0 and MMYY == 0 YYMM == 0 YYMM 0 MMYY == 0 MMYY 0 print('NA') print 'NA' elif YYMM == 0 and MMYY == 1:
    print('MMYY') YYMM == 0 and MMYY == 1 YYMM == 0 YYMM 0 MMYY == 1 MMYY 1 print('MMYY') print 'MMYY' elif YYMM == 1 and MMYY == 0:
    print('YYMM') YYMM == 1 and MMYY == 0 YYMM == 1 YYMM 1 MMYY == 0 MMYY 0 print('YYMM') print 'YYMM' print('AMBIGUOUS') print 'AMBIGUOUS' MMYY = 0 0 MMYY YYMM = 0 0 YYMM S = int(input()) int(input()) S YYMM = 1 1 YYMM MMYY = 1 1 MMYY
S = int(input())

YYMM = 0
MMYY = 0

if S % 100 >= 1 and S % 100 <= 12:
    YYMM = 1

if S // 100 >= 1 and S // 100 <= 12:
    MMYY = 1

if YYMM == 0 and MMYY == 0:
    print('NA')
elif YYMM == 0 and MMYY == 1:
    print('MMYY')
elif YYMM == 1 and MMYY == 0:
    print('YYMM')
else:
    print('AMBIGUOUS')
