s = input()

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

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