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