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