s = input()

s_a = int(s[:2])
s_b = int(s[2:])

if s_a >= 1 and s_a <=12 and s_b >= 1 and s_b <=12:
  ans = "AMBIGUOUS"
elif (s_a > 12 or s_a == 0) and s_b >= 1 and s_b <=12:
  ans = "YYMM"
elif (s_b > 12 or s_b == 0) and s_a >= 1 and s_a <=12:
  ans = "MMYY"
else:
  ans = "NA"

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

s_a = int(s[:2])
s_b = int(s[2:])

if s_a >= 1 and s_a <=12 and s_b >= 1 and s_b <=12:
  ans = "AMBIGUOUS"
elif (s_a > 12 or s_a == 0) and s_b >= 1 and s_b <=12:
  ans = "YYMM"
elif (s_b > 12 or s_b == 0) and s_a >= 1 and s_a <=12:
  ans = "MMYY"
else:
  ans = "NA"

print(ans)