
s = input()
a=int(s[0:2])
b=int(s[2:4])
if 0<a<=12 and 0<b<=12:
    print('AMBIGUOUS')
elif 0<b<=12:
    print('YYMM')
elif 0<a<=12 :
    print('MMYY')

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

s = input()
a=int(s[0:2])
b=int(s[2:4])
if 0<a<=12 and 0<b<=12:
    print('AMBIGUOUS')
elif 0<b<=12:
    print('YYMM')
elif 0<a<=12 :
    print('MMYY')

else:
    print('NA')

