s = input()
s1 = int(s[:2])
s2 = int(s[2:])
if 1 <= s1 <= 12 and 1 <= s2 <= 12:
    print('AMBIGUOUS')
elif 1 <= s1 <= 12:
    print('MMYY')
elif 1 <= s2 <= 12:
    print('YYMM')
else:
    print('NA') s = input() s input() input s1 = int(s[:2]) s1 int(s[:2]) int s[:2] s :2 2 s2 = int(s[2:]) s2 int(s[2:]) int s[2:] s 2: 2 if 1 <= s1 <= 12 and 1 <= s2 <= 12:
    print('AMBIGUOUS')
elif 1 <= s1 <= 12:
    print('MMYY')
elif 1 <= s2 <= 12:
    print('YYMM')
else:
    print('NA') 1 <= s1 <= 12 and 1 <= s2 <= 12 1 <= s1 <= 12 1 <= s1 1 s1 12 1 <= s2 <= 12 1 <= s2 1 s2 12 print('AMBIGUOUS') print 'AMBIGUOUS' elif 1 <= s1 <= 12:
    print('MMYY') 1 <= s1 <= 12 1 <= s1 1 s1 12 print('MMYY') print 'MMYY' elif 1 <= s2 <= 12:
    print('YYMM') 1 <= s2 <= 12 1 <= s2 1 s2 12 print('YYMM') print 'YYMM' print('NA') print 'NA' s2 = int(s[2:]) int(s[2:]) s2 s = input() input() s s1 = int(s[:2]) int(s[:2]) s1
s = input()
s1 = int(s[:2])
s2 = int(s[2:])
if 1 <= s1 <= 12 and 1 <= s2 <= 12:
    print('AMBIGUOUS')
elif 1 <= s1 <= 12:
    print('MMYY')
elif 1 <= s2 <= 12:
    print('YYMM')
else:
    print('NA')