s = input()

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

if 1 <= s_a <=12 and 1 <= s_b <=12:
  ans = "AMBIGUOUS"
elif not(1 <= s_a <=12) and 1 <= s_b <=12:
  ans = "YYMM"
elif 1 <= s_a <=12 and not(1 <= s_b <=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 1 <= s_a <=12 and 1 <= s_b <=12:
  ans = "AMBIGUOUS"
elif not(1 <= s_a <=12) and 1 <= s_b <=12:
  ans = "YYMM"
elif 1 <= s_a <=12 and not(1 <= s_b <=12):
  ans = "MMYY"
else:
  ans = "NA" 1 <= s_a <=12 and 1 <= s_b <=12 1 <= s_a <=12 1 <= s_a 1 s_a 12 1 <= s_b <=12 1 <= s_b 1 s_b 12 ans = "AMBIGUOUS" ans "AMBIGUOUS" elif not(1 <= s_a <=12) and 1 <= s_b <=12:
  ans = "YYMM" not(1 <= s_a <=12) and 1 <= s_b <=12 not(1 <= s_a <=12) 1 <= s_a <=12 1 <= s_a 1 s_a 12 1 <= s_b <=12 1 <= s_b 1 s_b 12 ans = "YYMM" ans "YYMM" elif 1 <= s_a <=12 and not(1 <= s_b <=12):
  ans = "MMYY" 1 <= s_a <=12 and not(1 <= s_b <=12) 1 <= s_a <=12 1 <= s_a 1 s_a 12 not(1 <= s_b <=12) 1 <= s_b <=12 1 <= s_b 1 s_b 12 ans = "MMYY" ans "MMYY" ans = "NA" ans "NA" print(ans) print ans s = input() input() s ans = "MMYY" "MMYY" ans ans = "NA" "NA" ans s_a = int(s[:2]) int(s[:2]) s_a ans = "AMBIGUOUS" "AMBIGUOUS" ans ans = "YYMM" "YYMM" ans s_b = int(s[2:]) int(s[2:]) s_b
s = input()

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

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

print(ans)