S = int(input())
b=S%100
a=S//100
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 = int(input()) S int(input()) int input() input b=S%100 b S%100 S 100 a=S//100 a S//100 S 100 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' b=S%100 S%100 b a=S//100 S//100 a S = int(input()) int(input()) S
S = int(input())
b=S%100
a=S//100
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')

