a=input()
n=int(a[0:2])
m=int(a[2:4])
if 0<n<=12 and 0<m<=12:
    print('AMBIGUOUS')
elif 0<n<=12:
    print('MMYY')
elif 0<m<=12:
    print('YYMM')
else:
    print('NA') a=input() a input() input n=int(a[0:2]) n int(a[0:2]) int a[0:2] a 0:2 0 2 m=int(a[2:4]) m int(a[2:4]) int a[2:4] a 2:4 2 4 if 0<n<=12 and 0<m<=12:
    print('AMBIGUOUS')
elif 0<n<=12:
    print('MMYY')
elif 0<m<=12:
    print('YYMM')
else:
    print('NA') 0<n<=12 and 0<m<=12 0<n<=12 0<n 0 n 12 0<m<=12 0<m 0 m 12 print('AMBIGUOUS') print 'AMBIGUOUS' elif 0<n<=12:
    print('MMYY') 0<n<=12 0<n 0 n 12 print('MMYY') print 'MMYY' elif 0<m<=12:
    print('YYMM') 0<m<=12 0<m 0 m 12 print('YYMM') print 'YYMM' print('NA') print 'NA' n=int(a[0:2]) int(a[0:2]) n a=input() input() a m=int(a[2:4]) int(a[2:4]) m
a=input()
n=int(a[0:2])
m=int(a[2:4])
if 0<n<=12 and 0<m<=12:
    print('AMBIGUOUS')
elif 0<n<=12:
    print('MMYY')
elif 0<m<=12:
    print('YYMM')
else:
    print('NA')