S = int(input())

L = S // 100 # 前半2桁
R = S % 100 # 後半2桁

if L > 12 or L == 0:
  if R > 12 or R == 0: print('NA')
  else: print('YYMM')
else:
  if R > 12 or R == 0: print('MMYY')
  else: print('AMBIGUOUS') S = int(input()) S int(input()) int input() input L = S // 100 L S // 100 S 100 R = S % 100 R S % 100 S 100 if L > 12 or L == 0:
  if R > 12 or R == 0: print('NA')
  else: print('YYMM')
else:
  if R > 12 or R == 0: print('MMYY')
  else: print('AMBIGUOUS') L > 12 or L == 0 L > 12 L 12 L == 0 L 0 if R > 12 or R == 0: print('NA')
  else: print('YYMM') R > 12 or R == 0 R > 12 R 12 R == 0 R 0 if R > 12 or R == 0: print('MMYY')
  else: print('AMBIGUOUS') R > 12 or R == 0 R > 12 R 12 R == 0 R 0 S = int(input()) int(input()) S R = S % 100 S % 100 R L = S // 100 S // 100 L
S = int(input())

L = S // 100 # 前半2桁
R = S % 100 # 後半2桁

if L > 12 or L == 0:
  if R > 12 or R == 0: print('NA')
  else: print('YYMM')
else:
  if R > 12 or R == 0: print('MMYY')
  else: print('AMBIGUOUS')