s = str(input())
a = int(s[0]) * 10 + int(s[1])
b = int(s[2]) * 10 + int(s[3])
if 1 <= a <= 12 and 1 <= b <= 12:
    print('AMBIGUOUS')
elif 1 <= a <= 12:
    print('MMYY')
elif 1 <= b <= 12:
    print('YYMM')
else:
    print('NA') s = str(input()) s str(input()) str input() input a = int(s[0]) * 10 + int(s[1]) a int(s[0]) * 10 + int(s[1]) int(s[0]) * 10 int(s[0]) int s[0] s 0 10 int(s[1]) int s[1] s 1 b = int(s[2]) * 10 + int(s[3]) b int(s[2]) * 10 + int(s[3]) int(s[2]) * 10 int(s[2]) int s[2] s 2 10 int(s[3]) int s[3] s 3 if 1 <= a <= 12 and 1 <= b <= 12:
    print('AMBIGUOUS')
elif 1 <= a <= 12:
    print('MMYY')
elif 1 <= b <= 12:
    print('YYMM')
else:
    print('NA') 1 <= a <= 12 and 1 <= b <= 12 1 <= a <= 12 1 <= a 1 a 12 1 <= b <= 12 1 <= b 1 b 12 print('AMBIGUOUS') print 'AMBIGUOUS' elif 1 <= a <= 12:
    print('MMYY') 1 <= a <= 12 1 <= a 1 a 12 print('MMYY') print 'MMYY' elif 1 <= b <= 12:
    print('YYMM') 1 <= b <= 12 1 <= b 1 b 12 print('YYMM') print 'YYMM' print('NA') print 'NA' s = str(input()) str(input()) s a = int(s[0]) * 10 + int(s[1]) int(s[0]) * 10 + int(s[1]) a b = int(s[2]) * 10 + int(s[3]) int(s[2]) * 10 + int(s[3]) b
s = str(input())
a = int(s[0]) * 10 + int(s[1])
b = int(s[2]) * 10 + int(s[3])
if 1 <= a <= 12 and 1 <= b <= 12:
    print('AMBIGUOUS')
elif 1 <= a <= 12:
    print('MMYY')
elif 1 <= b <= 12:
    print('YYMM')
else:
    print('NA')