S = input()
L = int(S[:2])
R = int(S[2:])

if 1<=L<=12 and 1<=R<=12:
  print("AMBIGUOUS")
elif 1<=L<=12:
  print("MMYY")
elif 1<=R<=12:
  print("YYMM")
else:
  print("NA") S = input() S input() input L = int(S[:2]) L int(S[:2]) int S[:2] S :2 2 R = int(S[2:]) R int(S[2:]) int S[2:] S 2: 2 if 1<=L<=12 and 1<=R<=12:
  print("AMBIGUOUS")
elif 1<=L<=12:
  print("MMYY")
elif 1<=R<=12:
  print("YYMM")
else:
  print("NA") 1<=L<=12 and 1<=R<=12 1<=L<=12 1<=L 1 L 12 1<=R<=12 1<=R 1 R 12 print("AMBIGUOUS") print "AMBIGUOUS" elif 1<=L<=12:
  print("MMYY") 1<=L<=12 1<=L 1 L 12 print("MMYY") print "MMYY" elif 1<=R<=12:
  print("YYMM") 1<=R<=12 1<=R 1 R 12 print("YYMM") print "YYMM" print("NA") print "NA" S = input() input() S R = int(S[2:]) int(S[2:]) R L = int(S[:2]) int(S[:2]) L
S = input()
L = int(S[:2])
R = int(S[2:])

if 1<=L<=12 and 1<=R<=12:
  print("AMBIGUOUS")
elif 1<=L<=12:
  print("MMYY")
elif 1<=R<=12:
  print("YYMM")
else:
  print("NA")