s = input()

s_1 = int(s[0:2])
s_2 = int(s[2:4])

if (s_1>12 or s_1<1) and (s_2>12 or s_2<1):
    print('NA')
elif s_1<=12 and s_1>=1 and s_2<=12 and s_2>=1:
    print('AMBIGUOUS')
elif s_1<=12 and s_1>=1:
    print('MMYY')
else:
    print('YYMM') s = input() s input() input s_1 = int(s[0:2]) s_1 int(s[0:2]) int s[0:2] s 0:2 0 2 s_2 = int(s[2:4]) s_2 int(s[2:4]) int s[2:4] s 2:4 2 4 if (s_1>12 or s_1<1) and (s_2>12 or s_2<1):
    print('NA')
elif s_1<=12 and s_1>=1 and s_2<=12 and s_2>=1:
    print('AMBIGUOUS')
elif s_1<=12 and s_1>=1:
    print('MMYY')
else:
    print('YYMM') (s_1>12 or s_1<1) and (s_2>12 or s_2<1) s_1>12 or s_1<1 s_1>12 s_1 12 s_1<1 s_1 1 s_2>12 or s_2<1 s_2>12 s_2 12 s_2<1 s_2 1 print('NA') print 'NA' elif s_1<=12 and s_1>=1 and s_2<=12 and s_2>=1:
    print('AMBIGUOUS') s_1<=12 and s_1>=1 and s_2<=12 and s_2>=1 s_1<=12 and s_1>=1 and s_2<=12 s_1<=12 and s_1>=1 s_1<=12 s_1 12 s_1>=1 s_1 1 s_2<=12 s_2 12 s_2>=1 s_2 1 print('AMBIGUOUS') print 'AMBIGUOUS' elif s_1<=12 and s_1>=1:
    print('MMYY') s_1<=12 and s_1>=1 s_1<=12 s_1 12 s_1>=1 s_1 1 print('MMYY') print 'MMYY' print('YYMM') print 'YYMM' s = input() input() s s_1 = int(s[0:2]) int(s[0:2]) s_1 s_2 = int(s[2:4]) int(s[2:4]) s_2
s = input()

s_1 = int(s[0:2])
s_2 = int(s[2:4])

if (s_1>12 or s_1<1) and (s_2>12 or s_2<1):
    print('NA')
elif s_1<=12 and s_1>=1 and s_2<=12 and s_2>=1:
    print('AMBIGUOUS')
elif s_1<=12 and s_1>=1:
    print('MMYY')
else:
    print('YYMM')