s = input()
n1 = int(s[:2])
n2 = int(s[2:])
if 1 <= n1 <= 12 and 1 <= n2 <= 12:
  print("AMBIGUOUS")
elif (n1 > 12 or n1 == 0) and 1 <= n2 <= 12:
  print("YYMM")
elif (n2 > 12 or n2 == 0) and 1 <= n1 <= 12:
  print("MMYY")
else:
  print("NA") s = input() s input() input n1 = int(s[:2]) n1 int(s[:2]) int s[:2] s :2 2 n2 = int(s[2:]) n2 int(s[2:]) int s[2:] s 2: 2 if 1 <= n1 <= 12 and 1 <= n2 <= 12:
  print("AMBIGUOUS")
elif (n1 > 12 or n1 == 0) and 1 <= n2 <= 12:
  print("YYMM")
elif (n2 > 12 or n2 == 0) and 1 <= n1 <= 12:
  print("MMYY")
else:
  print("NA") 1 <= n1 <= 12 and 1 <= n2 <= 12 1 <= n1 <= 12 1 <= n1 1 n1 12 1 <= n2 <= 12 1 <= n2 1 n2 12 print("AMBIGUOUS") print "AMBIGUOUS" elif (n1 > 12 or n1 == 0) and 1 <= n2 <= 12:
  print("YYMM") (n1 > 12 or n1 == 0) and 1 <= n2 <= 12 n1 > 12 or n1 == 0 n1 > 12 n1 12 n1 == 0 n1 0 1 <= n2 <= 12 1 <= n2 1 n2 12 print("YYMM") print "YYMM" elif (n2 > 12 or n2 == 0) and 1 <= n1 <= 12:
  print("MMYY") (n2 > 12 or n2 == 0) and 1 <= n1 <= 12 n2 > 12 or n2 == 0 n2 > 12 n2 12 n2 == 0 n2 0 1 <= n1 <= 12 1 <= n1 1 n1 12 print("MMYY") print "MMYY" print("NA") print "NA" n1 = int(s[:2]) int(s[:2]) n1 s = input() input() s n2 = int(s[2:]) int(s[2:]) n2
s = input()
n1 = int(s[:2])
n2 = int(s[2:])
if 1 <= n1 <= 12 and 1 <= n2 <= 12:
  print("AMBIGUOUS")
elif (n1 > 12 or n1 == 0) and 1 <= n2 <= 12:
  print("YYMM")
elif (n2 > 12 or n2 == 0) and 1 <= n1 <= 12:
  print("MMYY")
else:
  print("NA")
