S=input()
if int(S[0]+S[1])>0 and int(S[0]+S[1])<13:
  if int(S[2]+S[3])>0 and int(S[2]+S[3])<13:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if int(S[2]+S[3])>0 and int(S[2]+S[3])<13:
    print("YYMM")
  else:
    print("NA")
  S=input() S input() input if int(S[0]+S[1])>0 and int(S[0]+S[1])<13:
  if int(S[2]+S[3])>0 and int(S[2]+S[3])<13:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if int(S[2]+S[3])>0 and int(S[2]+S[3])<13:
    print("YYMM")
  else:
    print("NA")
  int(S[0]+S[1])>0 and int(S[0]+S[1])<13 int(S[0]+S[1])>0 int(S[0]+S[1]) int S[0]+S[1] S[0] S 0 S[1] S 1 0 int(S[0]+S[1])<13 int(S[0]+S[1]) int S[0]+S[1] S[0] S 0 S[1] S 1 13 if int(S[2]+S[3])>0 and int(S[2]+S[3])<13:
    print("AMBIGUOUS")
  else:
    print("MMYY") int(S[2]+S[3])>0 and int(S[2]+S[3])<13 int(S[2]+S[3])>0 int(S[2]+S[3]) int S[2]+S[3] S[2] S 2 S[3] S 3 0 int(S[2]+S[3])<13 int(S[2]+S[3]) int S[2]+S[3] S[2] S 2 S[3] S 3 13 print("AMBIGUOUS") print "AMBIGUOUS" print("MMYY") print "MMYY" if int(S[2]+S[3])>0 and int(S[2]+S[3])<13:
    print("YYMM")
  else:
    print("NA")
  int(S[2]+S[3])>0 and int(S[2]+S[3])<13 int(S[2]+S[3])>0 int(S[2]+S[3]) int S[2]+S[3] S[2] S 2 S[3] S 3 0 int(S[2]+S[3])<13 int(S[2]+S[3]) int S[2]+S[3] S[2] S 2 S[3] S 3 13 print("YYMM") print "YYMM" print("NA") print "NA" S=input() input() S
S=input()
if int(S[0]+S[1])>0 and int(S[0]+S[1])<13:
  if int(S[2]+S[3])>0 and int(S[2]+S[3])<13:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if int(S[2]+S[3])>0 and int(S[2]+S[3])<13:
    print("YYMM")
  else:
    print("NA")
 