S = input()
f = int(S[:2])
l = int(S[2:])
if f==0 or f>12:
  if l==0 or l>12:
    print("NA")
  else:
    print("YYMM")
else:
  if l==0 or l>12:
    print("MMYY")
  else:
    print("AMBIGUOUS") S = input() S input() input f = int(S[:2]) f int(S[:2]) int S[:2] S :2 2 l = int(S[2:]) l int(S[2:]) int S[2:] S 2: 2 if f==0 or f>12:
  if l==0 or l>12:
    print("NA")
  else:
    print("YYMM")
else:
  if l==0 or l>12:
    print("MMYY")
  else:
    print("AMBIGUOUS") f==0 or f>12 f==0 f 0 f>12 f 12 if l==0 or l>12:
    print("NA")
  else:
    print("YYMM") l==0 or l>12 l==0 l 0 l>12 l 12 print("NA") print "NA" print("YYMM") print "YYMM" if l==0 or l>12:
    print("MMYY")
  else:
    print("AMBIGUOUS") l==0 or l>12 l==0 l 0 l>12 l 12 print("MMYY") print "MMYY" print("AMBIGUOUS") print "AMBIGUOUS" S = input() input() S f = int(S[:2]) int(S[:2]) f l = int(S[2:]) int(S[2:]) l
S = input()
f = int(S[:2])
l = int(S[2:])
if f==0 or f>12:
  if l==0 or l>12:
    print("NA")
  else:
    print("YYMM")
else:
  if l==0 or l>12:
    print("MMYY")
  else:
    print("AMBIGUOUS")