S = input()

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

if int(S[:2]) == 0 and 0 < int(S[2:]) <= 12:
  print("YYMM")
elif int(S[2:]) == 0 and 0 < int(S[:2]) <= 12:
  print("MMYY")
elif int(S[:2]) == 0 or int(S[2:]) == 0 or (int(S[:2]) > 12 and int(S[2:]) > 12):
  print("NA")
elif int(S[:2]) > 12 and int(S[2:]) <= 12:
  print("YYMM")
elif int(S[:2]) <= 12 and int(S[2:]) > 12:
  print("MMYY")
else:
  print("AMBIGUOUS")