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