S=input()
A=int(S[0:2])
B=int(S[2:4])
if (1<=A and A<=12) and (1<=B and B<=12):
  print("AMBIGUOUS")
elif (1<=A and A<=12) and not(1<=B and B<=12):
  print("MMYY")
elif not(1<=A and A<=12) and (1<=B and B<=12):
  print("YYMM")
else:
  print("NA") S=input() S input() input A=int(S[0:2]) A int(S[0:2]) int S[0:2] S 0:2 0 2 B=int(S[2:4]) B int(S[2:4]) int S[2:4] S 2:4 2 4 if (1<=A and A<=12) and (1<=B and B<=12):
  print("AMBIGUOUS")
elif (1<=A and A<=12) and not(1<=B and B<=12):
  print("MMYY")
elif not(1<=A and A<=12) and (1<=B and B<=12):
  print("YYMM")
else:
  print("NA") (1<=A and A<=12) and (1<=B and B<=12) 1<=A and A<=12 1<=A 1 A A<=12 A 12 1<=B and B<=12 1<=B 1 B B<=12 B 12 print("AMBIGUOUS") print "AMBIGUOUS" elif (1<=A and A<=12) and not(1<=B and B<=12):
  print("MMYY") (1<=A and A<=12) and not(1<=B and B<=12) 1<=A and A<=12 1<=A 1 A A<=12 A 12 not(1<=B and B<=12) 1<=B and B<=12 1<=B 1 B B<=12 B 12 print("MMYY") print "MMYY" elif not(1<=A and A<=12) and (1<=B and B<=12):
  print("YYMM") not(1<=A and A<=12) and (1<=B and B<=12) not(1<=A and A<=12) 1<=A and A<=12 1<=A 1 A A<=12 A 12 1<=B and B<=12 1<=B 1 B B<=12 B 12 print("YYMM") print "YYMM" print("NA") print "NA" A=int(S[0:2]) int(S[0:2]) A S=input() input() S B=int(S[2:4]) int(S[2:4]) B
S=input()
A=int(S[0:2])
B=int(S[2:4])
if (1<=A and A<=12) and (1<=B and B<=12):
  print("AMBIGUOUS")
elif (1<=A and A<=12) and not(1<=B and B<=12):
  print("MMYY")
elif not(1<=A and A<=12) and (1<=B and B<=12):
  print("YYMM")
else:
  print("NA")