s = input()
m = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
if s[:2] not in m and s[2:] not in m:
    print('NA')
elif s[:2] not in m:
    print('YYMM')
elif s[2:] not in m:
    print('MMYY')
else:
    print('AMBIGUOUS') s = input() s input() input m = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'] m ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'] '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' if s[:2] not in m and s[2:] not in m:
    print('NA')
elif s[:2] not in m:
    print('YYMM')
elif s[2:] not in m:
    print('MMYY')
else:
    print('AMBIGUOUS') s[:2] not in m and s[2:] not in m s[:2] not in m s[:2] s :2 2 m s[2:] not in m s[2:] s 2: 2 m print('NA') print 'NA' elif s[:2] not in m:
    print('YYMM') s[:2] not in m s[:2] s :2 2 m print('YYMM') print 'YYMM' elif s[2:] not in m:
    print('MMYY') s[2:] not in m s[2:] s 2: 2 m print('MMYY') print 'MMYY' print('AMBIGUOUS') print 'AMBIGUOUS' s = input() input() s m = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'] ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'] m
s = input()
m = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
if s[:2] not in m and s[2:] not in m:
    print('NA')
elif s[:2] not in m:
    print('YYMM')
elif s[2:] not in m:
    print('MMYY')
else:
    print('AMBIGUOUS')