s = list(input())
s = [int(i+j) for (i,j) in zip(s[::2],s[1::2])]

if 1 <= s[0] <= 12:
  if 1 <= s[1] <= 12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1 <= s[1] <= 12:
    print("YYMM")
  else:
    print("NA") s = list(input()) s list(input()) list input() input int(i+j) for (i,j) in zip(s[::2],s[1::2]) for (i,j) in zip(s[::2],s[1::2]) (i,j) i j zip(s[::2],s[1::2]) zip s[::2] s ::2 2 s[1::2] s 1::2 1 2 for (i,j) in zip(s[::2],s[1::2]) int(i+j) int i+j i j s = [int(i+j) for (i,j) in zip(s[::2],s[1::2])] s [int(i+j) for (i,j) in zip(s[::2],s[1::2])] if 1 <= s[0] <= 12:
  if 1 <= s[1] <= 12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1 <= s[1] <= 12:
    print("YYMM")
  else:
    print("NA") 1 <= s[0] <= 12 1 <= s[0] 1 s[0] s 0 12 if 1 <= s[1] <= 12:
    print("AMBIGUOUS")
  else:
    print("MMYY") 1 <= s[1] <= 12 1 <= s[1] 1 s[1] s 1 12 print("AMBIGUOUS") print "AMBIGUOUS" print("MMYY") print "MMYY" if 1 <= s[1] <= 12:
    print("YYMM")
  else:
    print("NA") 1 <= s[1] <= 12 1 <= s[1] 1 s[1] s 1 12 print("YYMM") print "YYMM" print("NA") print "NA" s = [int(i+j) for (i,j) in zip(s[::2],s[1::2])] [int(i+j) for (i,j) in zip(s[::2],s[1::2])] s s = list(input()) list(input()) s
s = list(input())
s = [int(i+j) for (i,j) in zip(s[::2],s[1::2])]

if 1 <= s[0] <= 12:
  if 1 <= s[1] <= 12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1 <= s[1] <= 12:
    print("YYMM")
  else:
    print("NA")