yymm = input()

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

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