S = input()
a = S[0:2]
b = S[2:4]
A = int(a)
B = int(b)
if A>=1 and A <=12:
  if B>= 1 and B <= 12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if B>= 1 and B<= 12:
    print("YYMM")
  else:
    print("NA") S = input() S input() input a = S[0:2] a S[0:2] S 0:2 0 2 b = S[2:4] b S[2:4] S 2:4 2 4 A = int(a) A int(a) int a B = int(b) B int(b) int b if A>=1 and A <=12:
  if B>= 1 and B <= 12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if B>= 1 and B<= 12:
    print("YYMM")
  else:
    print("NA") A>=1 and A <=12 A>=1 A 1 A <=12 A 12 if B>= 1 and B <= 12:
    print("AMBIGUOUS")
  else:
    print("MMYY") B>= 1 and B <= 12 B>= 1 B 1 B <= 12 B 12 print("AMBIGUOUS") print "AMBIGUOUS" print("MMYY") print "MMYY" if B>= 1 and B<= 12:
    print("YYMM")
  else:
    print("NA") B>= 1 and B<= 12 B>= 1 B 1 B<= 12 B 12 print("YYMM") print "YYMM" print("NA") print "NA" b = S[2:4] S[2:4] b a = S[0:2] S[0:2] a A = int(a) int(a) A S = input() input() S B = int(b) int(b) B
S = input()
a = S[0:2]
b = S[2:4]
A = int(a)
B = int(b)
if A>=1 and A <=12:
  if B>= 1 and B <= 12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if B>= 1 and B<= 12:
    print("YYMM")
  else:
    print("NA")