S = input()
 
if int(S[:2]) > 12 or int(S[:2]) == 0:
  if int(S[2:]) > 12 or int(S[2:]) == 0: print('NA')
  else: print('YYMM')
else:
  if int(S[2:]) > 12 or int(S[2:]) == 0: print('MMYY')
  else: print('AMBIGUOUS') S = input() S input() input if int(S[:2]) > 12 or int(S[:2]) == 0:
  if int(S[2:]) > 12 or int(S[2:]) == 0: print('NA')
  else: print('YYMM')
else:
  if int(S[2:]) > 12 or int(S[2:]) == 0: print('MMYY')
  else: print('AMBIGUOUS') int(S[:2]) > 12 or int(S[:2]) == 0 int(S[:2]) > 12 int(S[:2]) int S[:2] S :2 2 12 int(S[:2]) == 0 int(S[:2]) int S[:2] S :2 2 0 if int(S[2:]) > 12 or int(S[2:]) == 0: print('NA')
  else: print('YYMM') int(S[2:]) > 12 or int(S[2:]) == 0 int(S[2:]) > 12 int(S[2:]) int S[2:] S 2: 2 12 int(S[2:]) == 0 int(S[2:]) int S[2:] S 2: 2 0 if int(S[2:]) > 12 or int(S[2:]) == 0: print('MMYY')
  else: print('AMBIGUOUS') int(S[2:]) > 12 or int(S[2:]) == 0 int(S[2:]) > 12 int(S[2:]) int S[2:] S 2: 2 12 int(S[2:]) == 0 int(S[2:]) int S[2:] S 2: 2 0 S = input() input() S
S = input()
 
if int(S[:2]) > 12 or int(S[:2]) == 0:
  if int(S[2:]) > 12 or int(S[2:]) == 0: print('NA')
  else: print('YYMM')
else:
  if int(S[2:]) > 12 or int(S[2:]) == 0: print('MMYY')
  else: print('AMBIGUOUS')