s = int(input())
s1 = s // 100
s2 = s % 100
c = 0
l = ["NA","YYMM","MMYY","AMBIGUOUS"]
if 1<=s2<=12:
  c += 1
if 1<=s1<=12:
  c += 2
print(l[c]) s = int(input()) s int(input()) int input() input s1 = s // 100 s1 s // 100 s 100 s2 = s % 100 s2 s % 100 s 100 c = 0 c 0 l = ["NA","YYMM","MMYY","AMBIGUOUS"] l ["NA","YYMM","MMYY","AMBIGUOUS"] "NA" "YYMM" "MMYY" "AMBIGUOUS" if 1<=s2<=12:
  c += 1 1<=s2<=12 1<=s2 1 s2 12 c += 1 c 1 if 1<=s1<=12:
  c += 2 1<=s1<=12 1<=s1 1 s1 12 c += 2 c 2 print(l[c]) print l[c] l c s2 = s % 100 s % 100 s2 c += 1 1 c c = 0 0 c c += 2 2 c s = int(input()) int(input()) s s1 = s // 100 s // 100 s1 l = ["NA","YYMM","MMYY","AMBIGUOUS"] ["NA","YYMM","MMYY","AMBIGUOUS"] l
s = int(input())
s1 = s // 100
s2 = s % 100
c = 0
l = ["NA","YYMM","MMYY","AMBIGUOUS"]
if 1<=s2<=12:
  c += 1
if 1<=s1<=12:
  c += 2
print(l[c])