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