S = input()
a = int(S[0:2])
b = int(S[2:])

if 1 <= a <= 12 and a <= b <= 12:
  print("AMBIGUOUS")
elif 1 <= a <= 12:
  print("MMYY")
elif 1 <= 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:]) b int(S[2:]) int S[2:] S 2: 2 if 1 <= a <= 12 and a <= b <= 12:
  print("AMBIGUOUS")
elif 1 <= a <= 12:
  print("MMYY")
elif 1 <= b <= 12:
  print("YYMM")
else:
  print("NA") 1 <= a <= 12 and a <= b <= 12 1 <= a <= 12 1 <= a 1 a 12 a <= b <= 12 a <= b a b 12 print("AMBIGUOUS") print "AMBIGUOUS" elif 1 <= a <= 12:
  print("MMYY") 1 <= a <= 12 1 <= a 1 a 12 print("MMYY") print "MMYY" elif 1 <= b <= 12:
  print("YYMM") 1 <= b <= 12 1 <= b 1 b 12 print("YYMM") print "YYMM" print("NA") print "NA" a = int(S[0:2]) int(S[0:2]) a b = int(S[2:]) int(S[2:]) b S = input() input() S
S = input()
a = int(S[0:2])
b = int(S[2:])

if 1 <= a <= 12 and a <= b <= 12:
  print("AMBIGUOUS")
elif 1 <= a <= 12:
  print("MMYY")
elif 1 <= b <= 12:
  print("YYMM")
else:
  print("NA")