s = input()
if s == '0000' or (int(s[:2]) >= 13 and int(s[-2:]) >= 13):
    print('NA')
elif 1 <= int(s[:2]) <= 12 and 1 <= int(s[-2:]) <= 12:
    print('AMBIGUOUS')
elif 1 <= int(s[:2]) <= 12:
    print('MMYY')
elif 1 <= int(s[-2:]) <= 12:
    print('YYMM')
else:
    print('NA') s = input() s input() input if s == '0000' or (int(s[:2]) >= 13 and int(s[-2:]) >= 13):
    print('NA')
elif 1 <= int(s[:2]) <= 12 and 1 <= int(s[-2:]) <= 12:
    print('AMBIGUOUS')
elif 1 <= int(s[:2]) <= 12:
    print('MMYY')
elif 1 <= int(s[-2:]) <= 12:
    print('YYMM')
else:
    print('NA') s == '0000' or (int(s[:2]) >= 13 and int(s[-2:]) >= 13) s == '0000' s '0000' int(s[:2]) >= 13 and int(s[-2:]) >= 13 int(s[:2]) >= 13 int(s[:2]) int s[:2] s :2 2 13 int(s[-2:]) >= 13 int(s[-2:]) int s[-2:] s -2: -2 13 print('NA') print 'NA' elif 1 <= int(s[:2]) <= 12 and 1 <= int(s[-2:]) <= 12:
    print('AMBIGUOUS') 1 <= int(s[:2]) <= 12 and 1 <= int(s[-2:]) <= 12 1 <= int(s[:2]) <= 12 1 <= int(s[:2]) 1 int(s[:2]) int s[:2] s :2 2 12 1 <= int(s[-2:]) <= 12 1 <= int(s[-2:]) 1 int(s[-2:]) int s[-2:] s -2: -2 12 print('AMBIGUOUS') print 'AMBIGUOUS' elif 1 <= int(s[:2]) <= 12:
    print('MMYY') 1 <= int(s[:2]) <= 12 1 <= int(s[:2]) 1 int(s[:2]) int s[:2] s :2 2 12 print('MMYY') print 'MMYY' elif 1 <= int(s[-2:]) <= 12:
    print('YYMM') 1 <= int(s[-2:]) <= 12 1 <= int(s[-2:]) 1 int(s[-2:]) int s[-2:] s -2: -2 12 print('YYMM') print 'YYMM' print('NA') print 'NA' s = input() input() s
s = input()
if s == '0000' or (int(s[:2]) >= 13 and int(s[-2:]) >= 13):
    print('NA')
elif 1 <= int(s[:2]) <= 12 and 1 <= int(s[-2:]) <= 12:
    print('AMBIGUOUS')
elif 1 <= int(s[:2]) <= 12:
    print('MMYY')
elif 1 <= int(s[-2:]) <= 12:
    print('YYMM')
else:
    print('NA')