s = input()
a = int(s[:2])
b = int(s[2:])


if 1 <= a <= 12 and 1 <= b <= 12:
    print('AMBIGUOUS')
elif 1 <= a <= 12 and (b == 0 or b > 12):
    print('MMYY')
elif 1 <= b <= 12 and (a == 0 or a > 12):
    print('YYMM')
else:
    print('NA') s = input() s input() input a = int(s[:2]) a int(s[:2]) int s[:2] s :2 2 b = int(s[2:]) b int(s[2:]) int s[2:] s 2: 2 if 1 <= a <= 12 and 1 <= b <= 12:
    print('AMBIGUOUS')
elif 1 <= a <= 12 and (b == 0 or b > 12):
    print('MMYY')
elif 1 <= b <= 12 and (a == 0 or a > 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 and (b == 0 or b > 12):
    print('MMYY') 1 <= a <= 12 and (b == 0 or b > 12) 1 <= a <= 12 1 <= a 1 a 12 b == 0 or b > 12 b == 0 b 0 b > 12 b 12 print('MMYY') print 'MMYY' elif 1 <= b <= 12 and (a == 0 or a > 12):
    print('YYMM') 1 <= b <= 12 and (a == 0 or a > 12) 1 <= b <= 12 1 <= b 1 b 12 a == 0 or a > 12 a == 0 a 0 a > 12 a 12 print('YYMM') print 'YYMM' print('NA') print 'NA' s = input() input() s b = int(s[2:]) int(s[2:]) b a = int(s[:2]) int(s[:2]) a
s = input()
a = int(s[:2])
b = int(s[2:])


if 1 <= a <= 12 and 1 <= b <= 12:
    print('AMBIGUOUS')
elif 1 <= a <= 12 and (b == 0 or b > 12):
    print('MMYY')
elif 1 <= b <= 12 and (a == 0 or a > 12):
    print('YYMM')
else:
    print('NA')
